Configuration classes
The configuration parameters provided in the configuration files are used to create the Configs
class object. This object is used to store the configuration parameters and to provide the configuration parameters to the other classes.
Configs class
Class for storing all configurations given in the configuration file.
This class organises the configuration parameters into those releated to ODE, solver, simulator, emulator and plotter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_file |
PathLike
|
The path to the configuration file |
required |
ode |
ODEConfig
|
The ODE configurations |
field(init=False)
|
solver |
SolverConfig
|
The solver configurations |
field(init=False)
|
simulator |
SimulatorConfig
|
The simulator configurations |
field(init=False)
|
emulator |
EmulatorConfig
|
The emulator configurations |
field(init=False)
|
plotter |
PlotterConfig
|
The plotter configurations |
field(init=False)
|
Each of these configurations are instances of the respective configuration classes.
Source code in emulode/config.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
|
The ode
, solver
, simulation
, emulation
and plotter
members are instances of the Config
abstract base class.
Config abstract base class
Bases: ABC
Abstract class for the configuration file. This class should be inherited by other configuration classes.
This defines the basic structure of all the congiguration classes. It
contains the config_dict
which is the dictionary representation of the
configuration file and the required_keys
which is a list of keys that
must be present in the configuration file. These checks are performed in
the __init__
method.
Every configuration class should have a validate
method which validates
the data in the configuration class and a __repr__
method which returns
a string representation of the configuration class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the configuration file |
required |
required_keys |
list[str]
|
A list of keys that must be present in the configuration file |
required |
Source code in emulode/config.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 |
|
The Config
abstract base class is used to define the configuration parameters for the ode
, solver
, simulation
, emulation
and plotter
members of the Configs
class.
Note: In the following classes, all parameters other than
config_dict
are optional. Theconfig_dict
parameter is a dictionary containing the default configuration parameters (as typically read from a configuration file). The optional parameters if provided will override the parameters in theconfig_dict
dictionary.
ODEConfig class
Bases: Config
Class for the ODE configuration file.
This class contains the chosen ODE and the parameters for the chosen ODE. The
required_keys
for this class are "chosen_ode" and "parameters".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the 'ode' part of the configuration file |
required |
chosen_ode |
str
|
The chosen ODE |
None
|
parameters |
dict
|
The parameters for the chosen ODE |
None
|
Source code in emulode/config.py
62 63 64 65 66 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 102 103 104 105 106 107 108 |
|
SolverConfig class
Bases: Config
Class for the solver configuration file.
This class contains parameters related to the solver. The required_keys
for
this class are "initial_conditions", "t_range", "n_steps" and "transience".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the 'solver' part of the configuration file |
required |
initial_conditions |
list[float]
|
The initial conditions for the ODE |
None
|
t_range |
list[float]
|
The time range for the simulation in the form [t_initial, t_final] |
None
|
n_steps |
int
|
The number of steps for the simulation |
None
|
transience |
float
|
The transience for the simulation (as a fraction between 0 and 1) |
None
|
Source code in emulode/config.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
SimulatorConfig class
Bases: Config
Class for the simulator configuration file.
This class contains parameters related to the simulator. The required_keys
for
this class are "parameter_of_interest", "range" and
"n_simulation_points".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the 'simulator' part of the configuration file |
required |
parameter_of_interest |
str
|
The parameter of interest (Must be one of parameters in ODE) |
None
|
parameter_range |
tuple[float]
|
The range for the simulation in the form (min, max) |
None
|
n_simulation_points |
int
|
The number of simulation points |
None
|
Source code in emulode/config.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
EmulatorConfig class
Bases: Config
Class for the emulator configuration file.
This class contains parameters related to the emulator. The required_keys
for
this class are "n_layers", "n_prediction_points" and "n_iterations".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the 'emulator' part of the configuration file |
required |
n_layers |
int
|
The number of layers in the emulator |
None
|
n_prediction_points |
int
|
The number of prediction points |
None
|
n_iterations |
int
|
The number of iterations for the emulator |
None
|
Source code in emulode/config.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
PlotterConfig class
Bases: Config
Class for the plotter configuration file.
This class contains parameters related to the plotter. The required_keys
for
this class are "directory", "filename", "x_label" and "y_label".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_dict |
dict
|
The dictionary representation of the 'plotter' part of the configuration file |
required |
directory |
str
|
The directory to save the plot |
None
|
filename |
str
|
The filename for the plot |
None
|
x_label |
str
|
The x label for the plot |
None
|
y_label |
str
|
The y label for the plot |
None
|
Source code in emulode/config.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|