Configuring models
Once you have obtained a model object from the client the model parameters will be set to their defaults, as specified in the model specification. Model parameters are grouped into input groups. These input groups are either external, singular or array-like. Singular and array-like input group have âmultiplicityâ values set to âoneâ and âmanyâ respectively within the model specification.
Input type | Comment |
---|---|
external | Input from another pre-requisite model |
singular | Single model inputs, e.g. orbit type |
array-like | Groups of inputs that can be added multiple times to the model, e.g. devices in the newupseto model |
The manner you specify model parameters depends on the multiplicity of the input group the parameter is defined within.
External inputs
External inputs represent model pre-requisites or inputs that are calculated externally, i.e. by other models.
A particular modelâs external inputs are described in the model specification (and the model page on the ESA's NoM Server site)
An example of an external input is the trajectory input for the SAPPHIRE solar proton models.
{
"name": "trajectory",
"input_type": "external",
"quantity": "trajectory",
"model_name": ["sapre","sapre_upload","greet"],
"model_result_name": "trajectory",
"required": "true"
}
The above example states that an input âtrajectoryâ is required from any of the listed models, sapre, sapre_upload or greet. This input is required so any models with this input specified cannot run until this external input has been supplied.
The minimum requirements for an external model can range from very specific to more general as shown in the table below.
Requirement | Comment |
---|---|
model_name | An input is required from a specific model |
quantity | An input is required of a particular quantity |
model_result_name | A particular model result is required from the supplied external input |
sapre_model = nom_client.get_model(model_name="sapre")
sapre_result = nom_client.run_model(sapre_model)
# Solar particle models
sapphire_peak_model = nom_client.get_model('sapphire-peak-flux')
sapphire_peak_model.set_external_input(external_input_name="trajectory", external_input=sapre_result)
Single value or singular inputs
The majority of model inputs represent a scalar, vector or matrix of simple inputs such as an array of energies or a temperature. These inputs are considered single valued in that they are specified once per model run.
Single parameters can be specified in two ways:
sapre_model = nom_client.get_model(model_name="sapre")
sapre_model.set_params(missionDuration=10, orbitType="GEN")
""" or """
sapre_params = {"missionDuration": 10, "orbitType": GEN"}
sapre_model.set_params(params=sapre_params)
Editing these set parameters is simply a case of specifying them again.
Multi-valued or array-like inputs
Some models have sets of inputs that can be added multiple times such as the âdevicesâ within the SEU models newupseto/longupset.
Array-like parameters are specified in a similar manner:
# Short term SEU/LET models
newupseto_model = nom_client.get_model('newupseto')
newupseto_model.set_external_input(external_input_name="trajectory", external_input=sapre_gto_result)
newupseto_model.set_params(includeSEPSpectrum=1, includeTrappedSpectrum=0, includeGCRSpectrum=0)
newupseto_model.set_external_input(external_input_name="solarParticleSpectrum", external_input=sapphire_peak_results)
# Add two devices to the model
newupseto_model.new_input_group(input_group_name="device", unique_group_name="mydevice1", params={
"deviceMaterial": 0,
"deviceName": "DEFAULT1",
"index": 0
})
newupseto_model.new_input_group(input_group_name="device", unique_group_name="mydevice2", params={
"deviceMaterial": 3,
"deviceName": "DEFAULT2",
"index": 1,
"Z": 0.1
})
newupseto_model.set_params(numberDevices=2)
# If you want to edit the parameters for a particular device use the 'set_params'
# with an input_group_name and unique_group_name.
newupseto_model.set_params(input_group_name="device",
unique_group_name="mydevice2",
params={"deviceName": "DEFAULT10000000"})