Machines#
Base classes#
- class Machine(**data)[source]#
Bases:
PyRadPlanBaseModelBase class for Machine objects.
Defines minimum meta-data a machine must hold:
- radiation_mode#
The radiation mode of the machine.
- Type:
str
- description#
The description of the machine.
- Type:
str
- machine#
The name of the machine.
- Type:
str
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_datetime_variants
- created_by: str | None#
- created_on: datetime | None#
- data_type: str | None#
- description: str#
- last_modified: datetime | None#
- last_modified_by: str | None#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (
BaseModel) – The BaseModel instance.context (
Any) – The context.
- Return type:
None
- name: Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)]#
- radiation_mode: str#
- version: int#
- class ExternalBeamMachine(**data)[source]#
Bases:
MachineBase class for Machine used for external irradiation.
- sad#
The source-to-axis distance of the machine
- Type:
float
- energies#
List of available photon energies
- Type:
list[float]
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
get_closest_energy_index(energy)Given an energy value, return the closest matching index.
get_energy_index(energy[, round_decimals])Given an energy value, return the index of the exact matching.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
validate_machine_input(data)Validate the input data for the machine model before passing to pydantic.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_datetime_variants
- energies: float64]#
- get_closest_energy_index(energy)[source]#
Given an energy value, return the closest matching index.
- Parameters:
energy (
float) – Energy value to search for- Returns:
Index of the energy level
- Return type:
int
- get_energy_index(energy, round_decimals=4)[source]#
Given an energy value, return the index of the exact matching.
- Parameters:
energy (
float) – Energy value to search forround_decimals (int, optional) – Number of decimals to round the energy values to, by default 4
- Returns:
Index of the energy level
- Return type:
Optional[int]
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (
BaseModel) – The BaseModel instance.context (
Any) – The context.
- Return type:
None
- sad: float#
Photons#
- class PhotonLINAC(**data)[source]#
Bases:
ExternalBeamMachineBase Class for Photon LINAC-like Machines.
Defines minimum meta-data a photon LINAC machine must hold Provides multiple data storage formats, currently supported - SVD Kernel Data (Bortfeld 1993, 10.1118/1.597070).
- scd#
The source-to-collimator distance of the machine
- Type:
float
- pb_kernels#
Pencil-beam kernels for the machine
- Type:
dict[float, PhotonSVDKernel]
- of#
Output factor data
- Type:
np.ndarray
- tpr#
Tissue-to-phantom ratio data
- Type:
np.ndarray
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
get_closest_energy_index(energy)Given an energy value, return the closest matching index.
get_energy_index(energy[, round_decimals])Given an energy value, return the index of the exact matching.
get_kernel_by_energy(energy)Get the pencil beam kernel for a specific energy value.
get_kernel_by_index(ix_energy)Get the pencil beam kernel for a specific energy index.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
validate_machine_input(data)Validate the input data for the machine model before passing to pydantic.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_datetime_variants
validate_pb_kernels
- get_kernel_by_energy(energy)[source]#
Get the pencil beam kernel for a specific energy value.
- Parameters:
energy (
float) – Energy value to search for- Returns:
Pencil beam kernel data
- Return type:
- get_kernel_by_index(ix_energy)[source]#
Get the pencil beam kernel for a specific energy index.
- Parameters:
ix_energy (
int) – Index of the energy level in the stored data- Returns:
Pencil beam kernel data
- Return type:
- key: str#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (
BaseModel) – The BaseModel instance.context (
Any) – The context.
- Return type:
None
- name: str#
- of: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None#
- pb_kernels: dict[float, PhotonSVDKernel] | None#
- radiation_mode: str#
- scd: float#
- tpr: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None#
- class PhotonSVDKernel(**data)[source]#
Bases:
PyRadPlanBaseModelKernel data for photon beams.
- energy#
The maximum energy of the photon beam in MeV (corresponds to the LINAC voltage in MV).
- Type:
float
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
- num_kernel_components
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
get_kernels_at_ssd(ssd)Get the kernel components at a specific SSD value.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
kernel_interpolator
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_kernel_data
validate_kernel_data_shapes
- energy: float#
- get_kernels_at_ssd(ssd)[source]#
Get the kernel components at a specific SSD value.
- Parameters:
ssd (
float) – The SSD value to search for.- Returns:
The kernels at the specified SSD value.
- Return type:
NDArray[Shape[1-, 1-],float64]
- kernel_betas: float64]#
- kernel_data: float64]#
- kernel_pos: float64]#
- kernel_ssds: float64]#
- m: float#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property num_kernel_components#
- penumbra: float#
- primary_fluence: float64]#
Ions#
- class IonAccelerator(**data)[source]#
Bases:
ParticleAcceleratorMachine Model for Ion Accelerators.
Defines minimum meta-data an ion machine must hold Provides multiple data storage formats, currently supported - Pencil-Beam Kernels - Monte Carlo Beam Models.
- sad#
The source-to-axis (-isocenter) distance of the machine
- Type:
float
- Attributes:
has_alpha_beta_kernelsCheck if it has alpha-beta kernels.
has_double_gaussian_kernelCheck if it has double gaussian pencil-beamkernels.
has_focused_gaussian_kernelCheck if it has focused gaussian pencil-beamkernels.
has_let_kernelCheck if it has LET values in the pencil-beam kernels.
has_multi_gaussian_kernelCheck if it has multi gaussian pencil-beamkernels.
has_pb_kernelsTest for existence of valid pencil-beam kernels.
has_single_gaussian_kernelCheck if it has single gaussian pencil-beamkernels.
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
pb_kernels_have_letCheck if the kernel data contains LET values.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
get_closest_energy_index(energy)Given an energy value, return the closest matching index.
get_energy_index(energy[, round_decimals])Given an energy value, return the index of the exact matching.
get_foci_by_index(ix_energy)Get the focus data of the kernel for a specific energy index.
get_focus(ix_energy)Get the focus data of the kernel for a specific energy index.
get_kernel_by_energy(energy)Get the pencil beam kernel for a specific energy value.
get_kernel_by_index(ix_energy)Get the pencil beam kernel for a specific energy index.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
update_kernel_at_index(ix_energy, kernel)Update the pencil beam kernel for a specific energy index.
update_kernel_for_energy(energy, kernel)Update a pencil-beam kernel for a specific energy.
validate_machine_input(data)Validate the input data for the machine model before passing to pydantic.
validate_possible_cast_array(v)Validate if the input can be cast to a float64 array.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_datetime_variants
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (
BaseModel) – The BaseModel instance.context (
Any) – The context.
- Return type:
None
- pb_kernels: dict[float, IonPencilBeamKernel] | None#
- peak_positions: float64]#
- radiation_mode: str#
- class LateralCutOff(**data)[source]#
Bases:
PyRadPlanBaseModelLateral cut-off radius and compensation for ion pencil beam kernels.
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
Validate the lateral cut-off radial distance and depths.
Validate the lateral cut-off compensation factor.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- comp_fac: float64#
- cut_off: float64]#
- depths: float64]#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].