Variables
This module contains definitions of LUME-model variables for use with lume tools. The variables are divided into input and outputs, each with different minimal requirements. Initiating any variable without the minimum requirements will result in an error.
For now, only scalar variables (floats) are supported.
Variable
Bases: BaseModel
, Generic[Value]
Minimum requirements for a variable.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the variable. |
value |
Optional[Value]
|
Value assigned to the variable. |
precision |
Optional[int]
|
Precision to use for the value. |
Source code in lume_model/variables.py
19 20 21 22 23 24 25 26 27 28 29 30 |
|
ScalarVariable
Bases: BaseModel
Base class used for constructing a scalar variable.
Attributes:
Name | Type | Description |
---|---|---|
variable_type |
str
|
Indicates scalar variable. |
units |
Optional[str]
|
Units associated with scalar value. |
parent_variable |
str
|
Variable for which this is an attribute. |
Source code in lume_model/variables.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
InputVariable
Bases: Variable
, Generic[Value]
Base class for input variables.
Attributes:
Name | Type | Description |
---|---|---|
default |
Value
|
Default value assigned to the variable. |
is_constant |
bool
|
Indicates whether the variable is constant. |
Source code in lume_model/variables.py
49 50 51 52 53 54 55 56 57 58 |
|
OutputVariable
Bases: Variable
, Generic[Value]
Base class for output variables. Value and range assignment are optional.
Attributes:
Name | Type | Description |
---|---|---|
default |
Optional[Value]
|
Default value assigned to the variable. |
value_range |
Optional[list]
|
Acceptable range for value. |
Source code in lume_model/variables.py
61 62 63 64 65 66 67 68 69 70 |
|
ScalarInputVariable
Bases: InputVariable[float]
, ScalarVariable
Variable used for representing a scalar input. Scalar variables hold float values. Initialization requires name, default, and value_range.
Attributes:
Name | Type | Description |
---|---|---|
value_range |
list[float]
|
Acceptable range for value. |
Example
variable = ScalarInputVariable(name="example_input", default=0.1, value_range=[0.0, 1.0])
Source code in lume_model/variables.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
ScalarOutputVariable
Bases: OutputVariable[float]
, ScalarVariable
Variable used for representing a scalar output. Scalar variables hold float values. Initialization requires name.
Example
variable = ScalarOutputVariable(name="example_output")
Source code in lume_model/variables.py
89 90 91 92 93 94 95 96 97 98 99 |
|