CADETProcess.dataStructure.parameter.Sized#
- class CADETProcess.dataStructure.parameter.Sized(*args: Any, size: int | tuple, **kwargs: Any)[source]#
Bases:
ParameterBaseDescriptor for parameters with size that potentially depends on instance attributes.
- Attributes:
- sizetuple
Expected size or dimensions of the parameter. Individual elements can be either integers or strings indicating other instance parameters that influence the size.
Methods
Determine whether the size is independent of other parameters.
get_size(value) -> int
Calculates the size of the given value. Override for custom behavior.
get_expected_size(instance) -> int
Computes the expected size based on the instance’s other attributes.
check_size(instance, value)
Validates that the provided value’s size matches the expected size.
- check_size(instance: Any, value: Any) None[source]#
Validate that the provided value’s size matches the expected size.
- Parameters:
- instanceobject
The instance associated with the parameter.
- valueAny
The value whose size needs to be validated.
- Raises:
- ValueError
If the value’s size does not match the expected size.
- get_expected_size(instance: Any) int[source]#
Compute the expected size based on the instance’s other attributes.
- Parameters:
- instanceobject
The instance whose attributes determine the expected size.
- Returns:
- int
Computed expected size based on instance attributes.
- Raises:
- ValueError
If an attribute, on which the size depends, is not set.