Skip to content

WorkflowConfig

Top-level configuration model for a simulation workflow.

Defines the root directory, simulations to run, builder logic, and aggregation strategies. Can be saved/loaded from YAML.

def my_function(x, y):
    result = x + y
    return result

Bases: BaseModel

Top-level configuration model for a simulation workflow.

This class defines how simulations are structured, executed, and aggregated. It is typically serialized/deserialized to YAML for reproducible workflows.

Attributes:

Name Type Description
root_folder PathType

Root directory where simulation results will be saved. default: 'results'

keep_hfss_solutions bool

If True the HFSS solution are kept (allowing for field plotting) for every iteration. Should be False as keeping all solution takes a lot of memory. default: False

pyaedt_file_parameters PyaedtFileParameters

Configuration for how the .aedt file is opened and managed during simulation. See PyaedtFileParameters for full control over versioning, licensing, and graphical behavior.

simulations dict[str, SUPPORTED_ANALYSIS]

Mapping of simulation names to simulation configuration objects. Each value must be one of the supported analysis types:

These are selected using a type field discriminator, as defined in SUPPORTED_ANALYSIS.

builder SUPPORTED_BUILDERS | None

Optional object used to modify the HFSS model before simulation.

Supported builder types:

The builder must define a type field used for runtime selection.

builder_sweep list[DictSweep]

parameter sweep applied to the builder phase. each DictSweep instance allows for iteration over dict values.

For example:

`DictSweep(constants={'a':1}, parameters={'b': [1,2], 'c':[3,4]}, strategy='product')

--> {'a': 1, 'b': 1, 'c': 3} --> {'a': 1, 'b': 1, 'c': 4} --> {'a': 1, 'b': 2, 'c': 3} --> {'a': 1, 'b': 2, 'c': 4} `

aggregation_dict dict[str, list[str]]

Optional aggregation rules for result post-processing.

Each key maps to a list of strings which should be all simulation identifiers. This dict is converted to Aggregator which than go for each key and aggregate its list of identifiers (e.g., flattening, validation, merging by UID).

See pycaddy.aggregator.Aggregator for behavior.

load_from_yaml classmethod

load_from_yaml(path: str | Path) -> WorkflowConfig

Load a workflow configuration from a YAML file.

Parameters:

Name Type Description Default
path str | Path

Source file path.

required

Returns:

Name Type Description
WorkflowConfig WorkflowConfig

Parsed configuration object.

Source code in src/quansys/workflow/config.py
@classmethod
def load_from_yaml(cls, path: str | Path) -> WorkflowConfig:
    """
    Load a workflow configuration from a YAML file.

    Args:
        path: Source file path.

    Returns:
        WorkflowConfig: Parsed configuration object.
    """
    return parse_yaml_file_as(cls, path)

save_to_yaml

save_to_yaml(path: str | Path) -> None

Save this configuration to a YAML file.

Parameters:

Name Type Description Default
path str | Path

Target file path.

required
Source code in src/quansys/workflow/config.py
def save_to_yaml(self, path: str | Path) -> None:
    """
    Save this configuration to a YAML file.

    Args:
        path: Target file path.
    """
    to_yaml_file(path, self, map_indent=4)