aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2024-10-01 17:41:37 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2024-10-01 17:41:37 -0400
commit9332101350ab84234731debf56aaba1cd82b13ac (patch)
treec392864258ef78919b8c7773f62a3fc40ea47714 /qolab
parent1c3f2d8a1c8153bd787b6747eb012c008ad0ed8f (diff)
downloadqolab-9332101350ab84234731debf56aaba1cd82b13ac.tar.gz
qolab-9332101350ab84234731debf56aaba1cd82b13ac.zip
draft of Siglent sds800xhd scope
Diffstat (limited to 'qolab')
-rw-r--r--qolab/hardware/scope/sds800xhd.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/qolab/hardware/scope/sds800xhd.py b/qolab/hardware/scope/sds800xhd.py
new file mode 100644
index 0000000..6e6f231
--- /dev/null
+++ b/qolab/hardware/scope/sds800xhd.py
@@ -0,0 +1,69 @@
+"""
+Created by Eugeniy E. Mikhailov 2021/11/29
+"""
+
+from qolab.hardware.scope.sds1104x import SDS1104X
+from qolab.hardware.scope._basic import calcSparsingAndNumPoints
+from qolab.hardware.basic import BasicInstrument
+from qolab.hardware.scpi import response2numStr
+from qolab.data.trace import Trace
+import numpy as np
+import scipy.signal
+from pyvisa.constants import InterfaceType
+
+
+class SDS800XHD(SDS1104X):
+ """Siglent SDS800XHD scope"""
+
+ # SDS1104x has actually 8 divisions but its behave like it has 10,
+ # the grabbed trace has more points outside what is visible on the screen
+ vertDivOnScreen = 8
+ horizDivOnScreen = 10
+
+ def __init__(self, resource, *args, **kwds):
+ super().__init__(resource, *args, **kwds)
+ self.config["Device model"] = "SDS800XHD"
+ self.resource.read_termination = "\n"
+ self.numberOfChannels = 4
+ self.maxRequiredPoints = 1000
+ # desired number of points per channel, can return twice more
+
+
+ @BasicInstrument.tsdb_append
+ def getTimePerDiv(self):
+ qstr = "TDIV?"
+ rstr = self.query(qstr)
+ # Careful! TDIV? is undocumented for SDS800XHD scope,
+ # the prescribe command is ":TIMebase:SCALe?".
+ # But "TDIV?" works identical to SDS2304, i.e.
+ # Siglent claims that this model should have same commands as SDS1104X
+ # However response is different.
+ # For example we got '2.00E-08S' instead 'TDIV 2.00E-08S'
+ # expected reply to query: '2.00E-08S'
+ prefix, numberString, unit = response2numStr(
+ rstr, firstSeparator=None, unit="S"
+ )
+ return float(numberString)
+
+
+if __name__ == "__main__":
+ import pyvisa
+
+ print("testing")
+ rm = pyvisa.ResourceManager()
+ print(rm.list_resources())
+ # instr = rm.open_resource("TCPIP::192.168.0.62::INSTR")
+ instr = rm.open_resource("USB0::62700::4119::SDS08A0X806445::0::INSTR")
+ scope = SDS800XHD(instr)
+ print(f"ID: {scope.idn}")
+ # print(f'Ch1 mean: {scope.mean(1)}')
+ print(f"Ch1 available points: {scope.getAvailableNumberOfPoints(1)}")
+ print(f"Sample Rate: {scope.getSampleRate()}")
+ print(f"Time per Div: {scope.getTimePerDiv()}")
+ print(f"Ch1 Volts per Div: {scope.getChanVoltsPerDiv(1)}")
+ print(f"Ch1 Voltage Offset: {scope.getChanVoltageOffset(1)}")
+ print("------ Header start -------------")
+ print(str.join("\n", scope.getHeader()))
+ print("------ Header ends -------------")
+ # ch1 = scope.getTrace(1)
+ # traces = scope.getAllTraces()