aeromaps.models.templates¶
Template classes to implement models in AeroMAPS.
CustomTemplate ¶
CustomTemplate(name='custom_template', configuration_file=None, *args, **kwargs)
Bases: AeroMAPSModel
AeroMAPS model template to be used as a starting point for custom models. The compute() method of custom models does not need to explicitly define inputs, and outputs can be of varying size. However, inputs and outputs must be defined in the init method using input_names and output_names dictionaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the model instance ('custom_template' by default). |
'custom_template'
|
configuration_file
|
str
|
Path to a configuration file (YAML) that contains user-defined input and output names and default values. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
input_names |
dict
|
Dictionary of input variable names populated at model initialisation before MDA chain creation. |
output_names |
dict
|
Dictionary of output variable names populated at model initialisation before MDA chain creation. |
Source code in aeromaps/models/templates.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
compute ¶
compute(input_data)
Compute the outputs based on the inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
Dictionary containing all input data required for the computation, completed at model instantiation with information from yaml files and outputs of other models. |
required |
Returns:
| Type | Description |
|---|---|
output_data
|
Dictionary containing all output data resulting from the computation. Contains outputs defined during model instantiation. |
Source code in aeromaps/models/templates.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
AutoTemplate ¶
AutoTemplate(name='auto_template', *args, **kwargs)
Bases: AeroMAPSModel
AeroMAPS model template to be used as a starting point for auto models. Auto models do not require definition of inputs and outputs in init method. Inputs and outputs are auto generated from compute() method signature. Therefore, the compute() method must explicitly define inputs and outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the model instance ('auto_template' by default). |
'auto_template'
|
Source code in aeromaps/models/templates.py
117 118 119 120 121 122 123 124 125 126 127 128 | |
compute ¶
compute(input1, input2)
Compute the outputs based on the inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input1
|
First input variable. |
required | |
input2
|
Second input variable. |
required |
Returns:
| Type | Description |
|---|---|
output1
|
First output variable. |
output2
|
Second output variable. |
Source code in aeromaps/models/templates.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |