magrittetorch.model.parameters
For data consistency, we define some general Parameter’s which denote the shape of the data tensors.
For example, the number of points Parameters.npoints in the model is fixed, and determines the size of the model positions, velocities, …
- class magrittetorch.model.parameters.Parameter(name: str, legacy_converter: Tuple[str, Callable[[Any], T] | None] | None = None)
Parameter class
- Parameters:
Generic (_type_) – Type of the value of the parameter
- get() T
Returns the value of the parameter
- Raises:
ValueError – If the parameter has not yet been set
- Returns:
The value of the parameter
- Return type:
T
- set(value: T) None
Setter for the value.
- Raises:
ValueError – If the parameter has already been set and the new value is not equal to the old value
- Parameters:
value (T) – New value for parameter
- name: str
name of the parameter
- value: T | None
value of the parameter; None if not yet set
- class magrittetorch.model.parameters.EnumParameter(enum_type: TYPE, name: str, legacy_converter: Tuple[str, Callable[[Any], T] | None] | None = None)
Bases:
Parameter[T],Generic[T,TYPE]- get_enum_type() TYPE
Getter for the enum type
- Returns:
The enum type
- Return type:
TYPE
- class magrittetorch.model.parameters.Parameters
Collection of global model Parameter’s
- Yields:
Parameter – parameters for a model