eVOLVER.py
Detailed description of the eVOLVER.py file.
This file is where the main function resides for the experimental DPU code, ie it is the script that is run to carry out an experiment on eVOVLER.
To start an experiment on the command line, run the following command:
If you would like to see the help menu:
Which will bring up something similar to the following:
General Information
This file contains the lower level functions that deal with communications and carrying out commands that the user specifies in the custom_script. Additionally, this file handles experiment initialization and data collection, setting up data directories, and doing data transformations based on calibrations.
When the script is ran, a connection is first established with the server, then the initialize_exp function is run which creates all data directories and requests the active calibrations from the server. Active calibrations are calibrations with the active field set to true. There should be only 1 active calibration of a given type. Active calibrations are set via the GUI, but they can be set programatically (see the event on the server).
The eVOLVER code then enters a infinite loop which does nothing except reset the socketio conection occasionally to prevent buildup of broadcast messages. Because the custom_functions are tied to the broadcast even to the server, the main thread does not need to do anything besides wait for server websocket events.
EvolverNamespace Class
This is a socketio class responsible for handling communications with the server on the RPi. Each function beginning with on_ is called when the corresponding event occurs on the websocket connection. For example, if the connect event occurs, the on_connect function will run.
This class is also being used as the eVOLVER experiment class. TODO: Ideally this would be a second class and not be tacked onto the socketio class - it will be updated in a future version.
The start time and OD blank information is stored as a class variable. Additionally, all low level functions for interacting with the eVOLVER RPi are located here.
broadcast event
Upon receipt of a broadcast event and new data from the eVOLVER RPi, the on_broadcast function is called. This will log the experiment time, do data transformations based on calibration data, save the resulting data, and then call the custom_functions in custom_script.py. This function is set within custom_script.py.