electrode package
electrode.electrode module
Keeps track of electrode presets; communicates with control GUI and sequencer.
- class electrode.electrode.ElectrodeServer(config_path='./config.json')
Bases:
LabradServerServer for keeping track of electrode presets.
Loads preset values from
PRESETS_PATH(currentlyvalue.json) when started and saves backup files toBACKUP_PATH(currently/dataserver/data/).Electrode presets are stored in JSON files, with a typical entry being of the form
{ "compShim": 0.0, "description": "Zero", "id": 0, "normalModes": { "Bias": 0.0, "CompShim": 0.0, "EastWest": 0.0, "GlobalOffset": 0.0, "HGrad": 0.0, "RodOffset": 0.0, "RodScale": 0.0 }, "values": { "LE": -0.00017701416113289064, "LP": -0.0002633327836823617, "LW": -0.00021936947516227844, "UE": -0.00018548979806110665, "UP": -0.00024036059085730274, "UW": -0.0002263664437981591 }, "volts": { "LE": 0.0, "LP": 0.0, "LW": 0.0, "UE": 0.0, "UP": 0.0, "UW": 0.0 }
- __init__(config_path='./config.json')
- backup_presets(self)
Save a JSON-formatted backup of the presets, to a file in the
electrodefolder of the current day’s dataserver directory. The file name is the time, formatted as%H%M%S.json.
- daily_backup(self)
Called every minute. Checks whether presets have been backed up on the current datetime. If not, calls
backup_presets().
- get_channels(self, c)
- Parameters:
c – LabRAD context
- Returns:
A JSON-formatted string of the channel locations, as set in
config.json.- Return type:
- get_presets(self, c)
Returns a JSON-dumped string of the presets dictionary.
- Parameters:
c – LabRAD context
- Returns:
A JSON-dumped string of the presets dictionary
- Return type:
- load_config(self, path=None)
Set instance attributes defined in
config.json.
- name = 'electrode'
- presets_changed = <labrad.server.Signal object>
- relative_backup_path = '/dataserver/data/'
- relative_presets_path = 'values.json'
- reload_presets(self, c)
Reloads presets from
PRESETS_PATH. If the presets file is not found, create one, with only the zero field preset.- Parameters:
c – LabRAD context
- set_verbose(self, c, flag)
- soft_update(self, c, data)
Like
update_presets(), but only updates keys that are currently in the presets dictionary.
- start_webserver(self)
Starts the electrode calculator web server.
- stopServer(self)
Called when the server is stopped. Shuts down the electrode calculator web server.
- stop_webserver(self)
Stops the electrode calculator web server.
- update_presets(self, c, data)
Updates the presets dictionary with the values in the JSON-formatted string
data. If any of the presets have changed, save a backup file.- Parameters:
c – LabRAD context
data (str) – A JSON-formatted string of the presets
- verbose = False