aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-26 18:57:43 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-26 18:57:43 -0500
commit4cbf2374551683829d32e148770e3d90374386c7 (patch)
treea2a2d1d6f6bf870a73f39543b59710d946104ce4
parent3af263e503dea0c7f5a257edf5096af09ea54263 (diff)
downloadqolab-4cbf2374551683829d32e148770e3d90374386c7.tar.gz
qolab-4cbf2374551683829d32e148770e3d90374386c7.zip
scope have basic tsdb loggers
-rw-r--r--examples/lock_eit.py7
-rw-r--r--qolab/hardware/scope/sds1104x.py5
2 files changed, 9 insertions, 3 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py
index 7efa8d6..7a3951e 100644
--- a/examples/lock_eit.py
+++ b/examples/lock_eit.py
@@ -8,7 +8,6 @@ import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
-# import universal_tsdb as utsdb
import qolab.tsdb as tsdb
import asyncio
import time
@@ -23,6 +22,8 @@ from qolab.data import TraceSetSameX, TraceXY, Trace
l = logging.getLogger('qolab.gui.web')
l.setLevel(logging.INFO)
+l = logging.getLogger('qolab.tsdb')
+l.setLevel(logging.DEBUG)
logger = logging.getLogger('Magnetometer')
logger.setLevel(logging.INFO)
@@ -120,7 +121,7 @@ dfB = freqDeltaMp2 - freqZero
freqDeltaMm2 = freqZero - dfB;
async def main():
- tsdb_client = tsdb.Client('influx', 'http://lumus.phusics.wm.edu:8428', database='qolab')
+ 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')
task_wp_update_loop = asyncio.create_task(update_webpage_loop(update_interval=1))
@@ -136,7 +137,7 @@ async def main():
logger.info("Accessing hardware")
rm = pyvisa.ResourceManager()
instr_scope=rm.open_resource('TCPIP::192.168.0.61::INSTR')
- scope = SDS1104X(instr_scope)
+ scope = SDS1104X(instr_scope, device_nickname='scope.feedback', tsdb_ingester=tsdb_ingester)
instr_rfgen=rm.open_resource('TCPIP::192.168.0.114::INSTR')
rfgen = AgilentE8257D(instr_rfgen)
instr_lockin=rm.open_resource('TCPIP::192.168.0.51::INSTR')
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index c41c53a..540e800 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -2,6 +2,7 @@
Created by Eugeniy E. Mikhailov 2021/11/29
"""
+from qolab.hardware.basic import BasicInstrument
from qolab.hardware.scope import ScopeSCPI
from qolab.hardware.scpi import response2numStr
from qolab.data.trace import Trace, TraceXY
@@ -38,6 +39,7 @@ class SDS1104X(ScopeSCPI):
prefix, numberString, unit = response2numStr(rstr, firstSeparator=' ', unit='pts')
return(int(float(numberString)))
+ @BasicInstrument.tsdb_append
def getSampleRate(self):
rstr = self.query('SAMPLE_RATE?');
# expected reply is like 'SARA 1.00E+09Sa/s'
@@ -128,6 +130,7 @@ class SDS1104X(ScopeSCPI):
prefix, numberString, unit = response2numStr(rstr, firstSeparator=' ', unit='V')
return(float(numberString))
+ @BasicInstrument.tsdb_append
def getTimePerDiv(self):
qstr = f'TDIV?'
rstr = self.query(qstr)
@@ -135,11 +138,13 @@ class SDS1104X(ScopeSCPI):
prefix, numberString, unit = response2numStr(rstr, firstSeparator=' ', unit='S')
return(float(numberString))
+ @BasicInstrument.tsdb_append
def setTimePerDiv(self, timePerDiv):
cstr = f'TDIV {timePerDiv}'
self.write(cstr)
# if out of range, the VAB bit (bit 2) in the STB register to be set
+ @BasicInstrument.tsdb_append
def getTrigDelay(self):
qstr = f'TRIG_DELAY?'
rstr = self.query(qstr)