opticks.imaging_model.imager_component

Classes

ImagerComponent(**data)

Common base class for the generic imager components.

class ImagerComponent(**data)[source]

Common base class for the generic imager components.

Subclasses define their YAML parameters as Pydantic field annotations.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

classmethod from_yaml_file(file_path)[source]

Initialise an Imager component from YAML file.

Parameters:

file_path (Path) – Filepath containing design data file (YAML)

Returns:

component_data – Component object from the input data

classmethod from_yaml_text(yaml_text)[source]

Initialise an Imager component from YAML text.

Parameters:

yaml_text (str) – Text containing design data (YAML)

Returns:

component_data – Component object from the input data

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

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

to_yaml_file(file_path)[source]

Serialise the component to a YAML file.

Return type:

None

Parameters:

file_path (Path) – Filepath to write the YAML data

to_yaml_text()[source]

Serialise the component to a YAML string.

Allows Unicode characters in the dump.

Return type:

str

Returns:

str – YAML text representation of the component