phlower.settings.PhlowerModelSetting

class phlower.settings.PhlowerModelSetting(*, variable_dimensions=None, inputs, labels=None, fields=None, network)[source]

Bases: BaseModel

Methods

check_duplicate_names()

get_name_to_dimensions()

resolve()

Resolve network relationship.

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

variable_dimensions

dictionary which maps variable name to value

inputs

settings for input feature values

labels

settings for output feature value

fields

name of variables in simulation field which are treated as constant

network

define structure of neural network

Parameters:
  • variable_dimensions (dict[str, Annotated[PhysicalDimensions, PlainValidator(func=~phlower._base._dimension._validate, json_schema_input_type=~typing.Any), PlainSerializer(func=~phlower._base._dimension._serialize, return_type=PydanticUndefined, when_used=always)]])

  • inputs (list[ModelIOSetting])

  • labels (list[ModelIOSetting])

  • fields (list[ModelIOSetting])

  • network (GroupModuleSetting)

fields: list[ModelIOSetting]
name of variables in simulation field which are treated as constant

in calculation.

For example, support matrix for input graph structure.

inputs: list[ModelIOSetting]

settings for input feature values

labels: list[ModelIOSetting]

settings for output feature value

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'fields': FieldInfo(annotation=list[ModelIOSetting], required=False, default_factory=list, frozen=True), 'inputs': FieldInfo(annotation=list[ModelIOSetting], required=True), 'labels': FieldInfo(annotation=list[ModelIOSetting], required=False, default_factory=list, frozen=True), 'network': FieldInfo(annotation=GroupModuleSetting, required=True), 'variable_dimensions': FieldInfo(annotation=dict[str, Annotated[PhysicalDimensions, PlainValidator, PlainSerializer]], required=False, default_factory=<lambda>, validate_default=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

network: GroupModuleSetting

define structure of neural network

resolve()[source]

Resolve network relationship. Following items are checked.

  • network is a valid DAG, not cycled graph.

  • input keywards in a module is defined as output in the precedent module.

  • set positive integer value to the value which is defined as -1 in nodes.

Return type:

None

variable_dimensions: dict[str, PhysicalDimensionsClass]

dictionary which maps variable name to value