From 1683f28898f2e04f95144340d36c25e873d310e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Weber?= Date: Tue, 14 May 2024 17:15:14 +0200 Subject: [PATCH] renamed old plugin as legacy --- README.rst | 2 +- ...0.py => daq_0Dviewer_LockInSR830Legacy.py} | 45 ++++++++++--------- .../plugins_0D/daq_0Dviewer_SR830.py | 4 +- 3 files changed, 27 insertions(+), 24 deletions(-) rename src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/{daq_0Dviewer_LockInSR830.py => daq_0Dviewer_LockInSR830Legacy.py} (92%) diff --git a/README.rst b/README.rst index 065bba2..db94fe1 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,7 @@ Below is the list of instruments included in this plugin Viewer0D ++++++++ -* * **LockinSR830**: LockIn Amplifier SR830 +* **LockinSR830**: LockIn Amplifier SR830 diff --git a/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830.py b/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830Legacy.py similarity index 92% rename from src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830.py rename to src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830Legacy.py index 936d153..ace6ca5 100644 --- a/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830.py +++ b/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LockInSR830Legacy.py @@ -16,8 +16,24 @@ import numpy as np import re - -class DAQ_0DViewer_LockInSR830(DAQ_Viewer_base): +##checking VISA ressources +try: + from pyvisa import ResourceManager + + VISA_rm = ResourceManager() + devices = list(VISA_rm.list_resources()) + device = '' + for dev in devices: + if 'GPIB' in dev: + device = dev + break +except Exception as e: + devices = [] + device = '' + raise e + + +class DAQ_0DViewer_LockInSR830Legacy(DAQ_Viewer_base): """ ==================== ======================== **Attributes** **Type** @@ -29,23 +45,9 @@ class DAQ_0DViewer_LockInSR830(DAQ_Viewer_base): *settings* ==================== ======================== """ - data_grabed_signal=Signal(list) - channels=['X', 'Y', 'MAG', 'PHA', 'Aux In 1', 'Aux In 2', 'Aux In 3', 'Aux In 4', 'Ref frequency', 'CH1 display', 'CH2 display'] - - ##checking VISA ressources - try: - from pyvisa import ResourceManager - VISA_rm = ResourceManager() - devices = list(VISA_rm.list_resources()) - device = '' - for dev in devices: - if 'GPIB' in dev: - device = dev - break - except Exception as e: - devices = [] - device = '' - raise e + data_grabed_signal = Signal(list) + channels = ['X', 'Y', 'MAG', 'PHA', 'Aux In 1', 'Aux In 2', 'Aux In 3', 'Aux In 4', 'Ref frequency', 'CH1 display', + 'CH2 display'] params = comon_parameters + [ {'title': 'VISA:', 'name': 'VISA_ressources', 'type': 'list', 'limits': devices, 'value': device}, @@ -119,7 +121,8 @@ def ini_detector(self, controller=None): else: self.controller = controller else: - self.controller = self.VISA_rm.open_resource(self.settings.child(('VISA_ressources')).value()) + VISA_rm = ResourceManager() + self.controller = VISA_rm.open_resource(self.settings.child(('VISA_ressources')).value()) self.controller.timeout = self.settings.child(('timeout')).value() idn = self.controller.query('OUTX1;*IDN?;') @@ -229,4 +232,4 @@ def stop(self): if __name__ == '__main__': - main(__file__, init=False) \ No newline at end of file + main(__file__, init=False) diff --git a/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_SR830.py b/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_SR830.py index 923116e..e8ca946 100644 --- a/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_SR830.py +++ b/src/pymodaq_plugins_stanford_research_systems/daq_viewer_plugins/plugins_0D/daq_0Dviewer_SR830.py @@ -147,7 +147,7 @@ def grab_data(self, Naverage=1, **kwargs): self.controller.reset_buffer() start = perf_counter() self.controller.start_buffer() - COUNTS = 100 + COUNTS = 10 self.controller.wait_for_buffer(COUNTS, timeout=60, timestep=0.01) print(f'acq time: {perf_counter() - start}s, should be: {COUNTS / rate}') ch1 = self.controller.get_buffer(1) @@ -190,4 +190,4 @@ def stop(self): if __name__ == '__main__': - main(__file__) + main(__file__, init=False)