-
Notifications
You must be signed in to change notification settings - Fork 3
Parameter storage
The framework.channel
and framework.station
classes as well as the derived framework.sim_station
class allow to save arbitrary parameters via the generic function set_parameter(key, value)
or via the shorthand station[key] = value
or channel[key] = value
respectively.
The parameters can be retrieved via get_parameter(key)
or just the shorthand station[key]
.
The parameter keys needs to be of type framework.parameters.stationParameters
or framework.parameters.channelParameters
respectively. This is to guarantee well defined parameter names that are unique and meaningful.
Parameters are set via
from NuRadioReco.utilities import units
from NuRadioReco.framework.parameters import stationParameters as stnp
nu_zenith = 23 * units.deg
station.set_parameter(stnp.nu_zenith, nu_zenith)
# or
station[stnp.nu_zenith] = nu_zenith
and retrieved via
from NuRadioReco.utilities import units
from NuRadioReco.framework.parameters import stationParameters as stnp
nu_zenith = station.get_parameter(stnp.nu_zenith)
# or
nu_zenith = station[stnp.nu_zenith]
print('the neutrino zenith angle is {:.1f}deg'.format(nu_zenith/units.deg))
To add a new parameter just add this parameter into the stationParameters
or channelParameters
class of the file framework.parameters.py
. Make sure to add a meaningful description.
The parameter storage functionality also allow to save uncertainties of all parameters:
from NuRadioReco.utilities import units
from NuRadioReco.framework.parameters import stationParameters as stnp
nu_zenith = 23 * units.deg
nu_zenith_error = 2 * units.deg
station.set_parameter(stnp.nu_zenith, nu_zenith)
station.set_parameter_error(stnp.nu_zenith, nu_zenith_error)