Main
main
¶
Models for the configuration.
Classes¶
MainConfiguration
¶
Bases: BaseModel
Configuration of simulation.
Attributes¶
model_config
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='forbid')
Forbid the extra fields.
config_version
class-attribute
instance-attribute
¶
config_version: str = Field(default='0.1.0', description='Version of the configuration file.')
Version of the configuration file.
run
class-attribute
instance-attribute
¶
run: RunConfiguration = Field(default_factory=RunConfiguration, description='Configuration for the run.')
Configuration for the run.
cosmology
class-attribute
instance-attribute
¶
cosmology: CosmologyConfiguration = Field(default_factory=CosmologyConfiguration, description='Configuration for the cosmology.')
Configuration for the cosmology.
selection
class-attribute
instance-attribute
¶
selection: SelectionConfiguration = Field(default_factory=SelectionConfiguration, description='Configuration for the selection.', exclude=True)
Configuration for the selection.
post_processing
class-attribute
instance-attribute
¶
post_processing: PostProcessingConfiguration = Field(default_factory=PostProcessingConfiguration, description='Configuration for the post-processing.', exclude=True)
Configuration for the post-processing.
advanced
class-attribute
instance-attribute
¶
advanced: AdvancedConfiguration = Field(default_factory=AdvancedConfiguration, description='Configuration for the advanced features.')
Configuration for the advanced features.
parameters
class-attribute
instance-attribute
¶
parameters: dict[str, Any] = Field(default_factory=dict, description='Parameter graph configuration consumed by GraphSimulator.')
Parameter graph configuration consumed by GraphSimulator.
Functions¶
from_file
classmethod
¶
from_file(filename: str | Path, encoding: str = 'utf-8') -> MainConfiguration
Read from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str | Path
|
File name. |
required |
encoding
|
str
|
File encoding. |
'utf-8'
|
Returns:
| Type | Description |
|---|---|
MainConfiguration
|
Configuration. |
to_file
¶
to_file(filename: str | Path, encoding: str = 'utf-8', exclude_none: bool = True, exclude_defaults: bool = False, round_trip: bool = False, **kwargs: Any) -> None
Write to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str | Path
|
File name. |
required |
encoding
|
str
|
Encoding of the file. |
'utf-8'
|
exclude_none
|
bool
|
Exclude None entries. |
True
|
exclude_defaults
|
bool
|
Exclude entries set to default. |
False
|
round_trip
|
bool
|
If True, use ruyaml to preserve comments/order. |
False
|
**kwargs
|
Any
|
Extra arguments passed to yaml.safe_dump (or ruyaml.YAML.dump). |
{}
|