diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2022-01-07 13:47:09 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2022-01-07 13:47:09 -0500 |
commit | 89a05b3ce0f13a7685abf069753e10c77dce74dc (patch) | |
tree | 61252a83d65112b688fe868837e8cfa63ebf53f8 /examples | |
parent | 88aae05251b532e8e9f8e325455a8d6f43cffb89 (diff) | |
download | qolab-89a05b3ce0f13a7685abf069753e10c77dce74dc.tar.gz qolab-89a05b3ce0f13a7685abf069753e10c77dce74dc.zip |
another examples
Diffstat (limited to 'examples')
-rw-r--r-- | examples/grab_eit_shapes.py | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/examples/grab_eit_shapes.py b/examples/grab_eit_shapes.py new file mode 100644 index 0000000..a79b8ea --- /dev/null +++ b/examples/grab_eit_shapes.py @@ -0,0 +1,89 @@ + +import logging +# this should be done before justpy is called or log formatter does not work +logging.basicConfig(format='%(asctime)s %(levelname)8s %(name)s: %(message)s', datefmt='%m/%d/%Y %H:%M:%S') + +import justpy as jp +import pyvisa +import numpy as np +import matplotlib as mpl +import matplotlib.pyplot as plt + +import qolab.tsdb as tsdb +import asyncio +import time + +import qolab.gui.web as gui +from qolab.hardware import BasicInstrument +from qolab.hardware.scope import SDS1104X +from qolab.hardware.rf_generator import AgilentE8257D +from qolab.hardware.lockin import SRS_SR865A +from qolab.feedback import PID +from qolab.data import TraceSetSameX, TraceXY, Trace +from qolab.hardware.i_server import I800 + +l = logging.getLogger('qolab.gui.web') +l.setLevel(logging.INFO) +l = logging.getLogger('qolab.tsdb') +l.setLevel(logging.INFO) +logger = logging.getLogger('Magnetometer') +logger.setLevel(logging.INFO) + +def getConfig(apparatus): + config = apparatus.config.copy() + ai = apparatus.instruments + for n, i in ai.items(): + config[n]=i.getConfig() + return config + +if __name__ == '__main__': + + # TSDB logger setting + tsdb_client = tsdb.Client('influx', 'http://lumus.physics.wm.edu:8428', database='qolab') + tsdb_ingester = tsdb.Ingester(tsdb_client, batch=11, measurement_prefix='VAMPIRE.HighPower') + + # creating Apparatus with all instruments to be logged + apparatus = Apparatus(tsdb_ingester=tsdb_ingester, device_nickname='magnetometer',) + apparatus.config['Device type'] = 'QOL VAMPIRE HighPower magnetometer' + apparatus.config['Device model'] = 'v0.1' + apparatus.config['FnamePrefix'] = 'magnetometer_eit' + apparatus.config['SavePath'] = '/mnt/qol_grp_data/data.VAMPIRE.HighPower' + + app_nickname=apparatus.config['DeviceNickname'] + + logger.info("Accessing hardware") + rm = pyvisa.ResourceManager() + instr_scope=rm.open_resource('TCPIP::192.168.0.61::INSTR') + scope_fdbk = SDS1104X(instr_scope, device_nickname='.'.join([app_nickname, 'scope.feedback']), tsdb_ingester=tsdb_ingester) + instr_scope=rm.open_resource('TCPIP::192.168.0.62::INSTR') + scope_mon = SDS1104X(instr_scope, device_nickname='.'.join([app_nickname, 'scope.monitor']), tsdb_ingester=tsdb_ingester) + instr_rfgen=rm.open_resource('TCPIP::192.168.0.114::INSTR') + rfgen = AgilentE8257D(instr_rfgen, device_nickname='.'.join([app_nickname, 'rfgen']), tsdb_ingester=tsdb_ingester) + instr_lockin=rm.open_resource('TCPIP::192.168.0.51::INSTR') + lockin = SRS_SR865A(instr_lockin, device_nickname='.'.join([app_nickname, 'lockin']), tsdb_ingester=tsdb_ingester) + + # adding instruments to apparatus + apparatus.instruments={} + ai = apparatus.instruments + ai['rfgen'] = rfgen + ai['lockin'] = lockin + ai['cellTemperatureController'] = I800(device_nickname='.'.join([app_nickname, 'cellTemperatureController']), tsdb_ingester=tsdb_ingester) + ai['scope.feedback'] = scope_fdbk + # scope_fdbk.setRoll(False) + # scope_fdbk.setRun(True) + # scope_fdbk.setTimePerDiv(0.0005) + # scope_fdbk.setChanVoltsPerDiv(1, 0.02) + # scope_fdbk.setChanVoltsPerDiv(3, 0.02) + scope_mon.config['SavePath'] = '/mnt/qol_grp_data/data.VAMPIRE.HighPower' + scope_mon.config['FnamePrefix'] = 'scope_eit' + ai['scope.monitor'] = scope_mon + # scope_mon.setRoll(False) + # scope_mon.setRun(True) + # scope_mon.setTimePerDiv(0.0005) + # scope_mon.setChanVoltsPerDiv(2, 0.002) + # scope_mon.setChanVoltageOffset(2, -0.0726) + + # if we want to save new set of traces repeat this two commands + scope_fdbk.config['tags']['apparatus']=getConfig(apparatus) + scope_fdbk.save( maxRequiredPoints=1000 ) + |