23.2. VMXi Beamline Parameters

VMXi, like other MX beamlines, makes use of a beamline parameters file (i02-2-config/scripts/beamlineParameters), an ASCII key-value store that is editable by beamline staff.

Use within GDA is similar to other MX beamlines, but VMXi uses its own dictionary-like class to access parameters.

The core implementation is located in gdascripts.parameters.beamline_parameters (in gda-core.git) and includes both parser and access objects.

VMXi makes use of the core parser (and so the file syntax is identical) but provides its own access class as parameters.VmxiParameters (in i02-2-config). A global instance of the access class is stored in this module and is accessed through parameters.getParameters.

The store can be updated through parameters.reloadParameters.

For example:

>>> import parameters
>>> bl_params = parameters.getParameters()
>>> print bl_params["example_key"]
"example_value"
>>> print bl_params.example_key
"example_value"
>>>
>>> # change value for example_key in beamlineParameters file
>>> print bl_params.example_key
"example_value"
>>> parameters.reloadParameters()
>>> print bl_params.example_key
"new_example_value"
>>>
>>> print bl_params["wrong_key"]
KeyError: "wrong_key"
>>> print bl_params.wrong_key
AttributeError: Property wrong_key is not set