pyopticon.majumdar_lab_widgets.sri_gc_fid_widget module
- class pyopticon.majumdar_lab_widgets.sri_gc_fid_widget.SRIGasChromatographFIDWidget(parent_dashboard, name, nickname, gas_labels, gas_columns, calibration_functions, default_logfile_path=None)
Bases:
GenericWidgetA widget representing an SRI gas chromatograph’s flame ionization detector (FID). We use an SRI 8610c GC.
This widget doesn’t communicate with the GC via serial. The GC should be controlled using SRI’s PeakSimple application. PeakSimple can be programmed to log GC FID data to a ‘.res’ file, with a row appended to the file every time a new GC scan is completed. This widget watches that file and displays the results. The benefit is that the GC data then ends up in the same RichardView file as all the MFC and other data, simplifying postprocessing.
One can make this widget extract several gases’ data from the logfile. The gases’ names are passed as one argument. A .res files contains a bunch of columns of data, so you pass this constructor the indices of the columns that correspond to the peak areas for those gases.
The logfile just contains peak areas, but you can pass in calibration functions that map peak areas to concentrations according to some calibration curve. Since the GC FID has different sensitivity settings (low, medium, and high), you can pass a set of calibration functions for each, and select which to use with a dropdown. The calibration functions are passed using a dict whose keys are the labels (probably a subset of ‘Low’,’Medium’,and ‘High’) and whose values are a tuple of calibration functions for the respective gases. For example, {‘Low’:(ch4_cal_function_lo,co2_cal_function_lo), ‘Medium’:(ch4_cal_function_med,co2_cal_function_med)}. It probably makes sense to define the calibration functions using Numpy’s interp function to interpolate between a range of calibration points, e.g. ‘ch4_cal_function_lo = lambda x: np.interp(x,[0,514,1024,1430],[0,20,40,60])’.
- Parameters:
parent_dashboard (richardview.dashboard.RichardViewDashboard) – The dashboard object to which this device will be added
name (str) – The name that the widget will be labeled with, and under which its data will be logged, e.g. “Methane Mass Flow Controller”
nickname (str) – A shortened nickname that can be used to identify the widget in automation scripts, e.g. “CH4 MFC”
gas_labels (list) – The labels of the different gases to be logged. You may want to include units, e.g. ‘CO2 (ppm)’
gas_columns (list) – The indices of the columns corresponding to the gases’ respective peak areas in the GC FID logfile format
calibration_functions (dict) – A dict specifying calibration functions for each gas at one or more sensitivity settings; see the description above.
default_logfile_path (str, optional) – The default path of the GC FID logfile. Can be used to avoid clicking through the file location choosing dialog every time.
- on_serial_open(success)
If the device initialized unsuccessfully, set its readout to ‘No Reading’
- disable_button()
Disable the file dialog button.
- on_handshake()
“On handshake, disable the file chooser button and run an update.
- on_update()
Poll the GC logfile and updates the readout with the latest values.
- on_serial_close()
When serial is closed, set all readouts to ‘No Reading’.
- _update_file_to_watch()
Prompt the user to select a new file to watch.