From d60fafb3f04f3500c55a5274a3a6695b384fd253 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Thu, 22 Aug 2024 14:58:19 -0700 Subject: [PATCH 1/8] fix: moved waitcomplete() into same call as print to avoid any extra delay in opc() for TSPIEEE4882Commands --- src/tm_devices/drivers/pi/ieee488_2_commands.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tm_devices/drivers/pi/ieee488_2_commands.py b/src/tm_devices/drivers/pi/ieee488_2_commands.py index 917220d6..86d7b0c8 100644 --- a/src/tm_devices/drivers/pi/ieee488_2_commands.py +++ b/src/tm_devices/drivers/pi/ieee488_2_commands.py @@ -286,8 +286,7 @@ def opc(self, write: bool = False) -> str: if write: self._pi_device.write("opc()") return "" - self.wai() - return self._pi_device.query("print([[1]])") + return self._pi_device.query("waitcomplete() print([[1]])") def rst(self) -> None: r"""Send the Reset (``reset()``) command.""" From 6993f1a62b4efd8ce2cf7242606edc756712693e Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Thu, 22 Aug 2024 15:25:57 -0700 Subject: [PATCH 2/8] refactor: updated load_script function in tsp_device.py to require a script_name, and added the script_body input to allow usage without a local tsp file. --- .../2400/smu_2400_load_script_and_run.py | 2 +- .../smu24xx/smu24xx_standard.py | 5 +-- .../source_measure_units/smu60xx/smu6xxx.py | 5 +-- src/tm_devices/drivers/pi/tsp_device.py | 31 +++++++++---------- tests/test_smu.py | 15 +++++++++ 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/examples/source_measure_units/2400/smu_2400_load_script_and_run.py b/examples/source_measure_units/2400/smu_2400_load_script_and_run.py index e105ef85..b0637650 100644 --- a/examples/source_measure_units/2400/smu_2400_load_script_and_run.py +++ b/examples/source_measure_units/2400/smu_2400_load_script_and_run.py @@ -26,7 +26,7 @@ # Capture the path to the script file and load it to working memory. print(pathlib.Path.cwd()) fileandpath = f"{pathlib.Path.cwd()}\\KEI2400_TTI_Driver\\simple_resistivity_measure.tsp" -smu2400.load_script(fileandpath, script_name="resistivityscript", run_script=True) +smu2400.load_script(script_name="resistivityscript", file_path=fileandpath, run_script=True) # Call the resistivity measurement function on the instrument with the desired current, # then print the result to the console. diff --git a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py index ce03b005..9f2016b2 100644 --- a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py +++ b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py @@ -122,9 +122,10 @@ def set_and_check( # noqa: PLR0913 def load_script( self, - file_path: Union[str, os.PathLike[str]], # noqa: ARG002 - script_name: str = "", # noqa: ARG002 + script_name: str, # noqa: ARG002 *, + script_body: str = "", # noqa: ARG002 + file_path: Union[str, os.PathLike[str], None] = None, # noqa: ARG002 run_script: bool = False, # noqa: ARG002 to_nv_memory: bool = False, # noqa: ARG002 ) -> None: diff --git a/src/tm_devices/drivers/pi/source_measure_units/smu60xx/smu6xxx.py b/src/tm_devices/drivers/pi/source_measure_units/smu60xx/smu6xxx.py index f8ccb825..566b70fc 100644 --- a/src/tm_devices/drivers/pi/source_measure_units/smu60xx/smu6xxx.py +++ b/src/tm_devices/drivers/pi/source_measure_units/smu60xx/smu6xxx.py @@ -122,9 +122,10 @@ def set_and_check( # noqa: PLR0913 def load_script( self, - file_path: Union[str, os.PathLike[str]], # noqa: ARG002 - script_name: str = "", # noqa: ARG002 + script_name: str, # noqa: ARG002 *, + script_body: str = "", # noqa: ARG002 + file_path: Union[str, os.PathLike[str], None] = None, # noqa: ARG002 run_script: bool = False, # noqa: ARG002 to_nv_memory: bool = False, # noqa: ARG002 ) -> None: diff --git a/src/tm_devices/drivers/pi/tsp_device.py b/src/tm_devices/drivers/pi/tsp_device.py index 3a686898..3894a323 100644 --- a/src/tm_devices/drivers/pi/tsp_device.py +++ b/src/tm_devices/drivers/pi/tsp_device.py @@ -127,38 +127,35 @@ def get_buffers(self, *args: str) -> Dict[str, List[float]]: def load_script( self, - file_path: Union[str, os.PathLike[str]], - script_name: str = "", + script_name: str, *, + script_body: str = "", + file_path: Union[str, os.PathLike[str], None] = None, run_script: bool = False, to_nv_memory: bool = False, ) -> None: """Upload a TSP script to the instrument. Args: - file_path: The file path of the script to read from the Python code's filesystem and - load on the instrument. - script_name: A string indicating what to name the script being loaded on the instrument, - if empty, 'loadfuncs' is used as the script name. + script_name: A string indicating what to name the script being loaded on the instrument. + script_body: TSP content to load on the instrument, overwritten if file_path defined. + file_path: a *.tsp file from the local filesystem to use as the `script_body`. run_script: Boolean indicating if the script should be run immediately after loading. to_nv_memory: Boolean indicating if the script is to be saved to non-volatile memory. """ - if not script_name: - script_name = "loadfuncs" + if file_path is not None: + with open(file_path, encoding="utf-8") as script_tsp: + script_body = script_tsp.read() # Check if the script exists, delete it if it does self.write(f"if {script_name} ~= nil then script.delete('{script_name}') end") - with open(file_path, encoding="utf-8") as script: - self.write(f"loadscript {script_name}") - while tsp_command := script.readline(): - # TODO: Check and Send Valid Commands - self.write(tsp_command.strip()) - self.write("endscript") + # Load the script + self.write(f"loadscript {script_name}\n{script_body}\nendscript") - # Save to NV Memory - if to_nv_memory: - self.write(f"{script_name}.save()") + # Save to NV Memory + if to_nv_memory: + self.write(f"{script_name}.save()") if run_script: self.run_script(script_name) diff --git a/tests/test_smu.py b/tests/test_smu.py index 175600a9..3b655823 100644 --- a/tests/test_smu.py +++ b/tests/test_smu.py @@ -51,6 +51,7 @@ def test_smu( # noqa: PLR0915 assert "Query" in stdout smu.load_script( + "loadfuncs", file_path=f"{Path(os.path.realpath(__file__)).parent}/samples/tsp_script.tsp", run_script=True, to_nv_memory=True, @@ -73,6 +74,20 @@ def test_smu( # noqa: PLR0915 assert "tsp_function.save()" not in stdout assert "tsp_function()" not in stdout smu.expect_esr(0) + smu.load_script( + script_name="tsp_function", + script_body=( + Path(os.path.realpath(__file__)).parent / "samples" / "tsp_script.tsp" + ).read_text(), + run_script=True, + ) + stdout = capsys.readouterr().out + assert "loadscript tsp_function" in stdout + assert "if tsp_function ~= nil then script.delete('tsp_function') end" in stdout + assert "endscript" in stdout + assert "tsp_function.save()" not in stdout + assert "tsp_function()" in stdout + smu.expect_esr(0) with mock.patch("pyvisa.highlevel.VisaLibraryBase.clear", mock.MagicMock(return_value=None)): assert smu.query_expect_timeout("INVALID?", timeout_ms=1) == "" From 377c68970c020f9730a69fce562ad2f51b647ca0 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Thu, 22 Aug 2024 16:24:00 -0700 Subject: [PATCH 3/8] fix: fix unit tests for tsp opc and load_script --- src/tm_devices/drivers/pi/tsp_device.py | 2 +- tests/sim_devices/daq/daq6510.yaml | 2 +- tests/sim_devices/dmm/dmm6500.yaml | 2 +- tests/sim_devices/dmm/dmm7510.yaml | 2 +- tests/sim_devices/dmm/dmm7512.yaml | 2 +- tests/sim_devices/smu/smu2450.yaml | 2 +- tests/sim_devices/smu/smu2460.yaml | 2 +- tests/sim_devices/smu/smu2461.yaml | 2 +- tests/sim_devices/smu/smu2470.yaml | 2 +- tests/sim_devices/smu/smu2601a.yaml | 2 +- tests/sim_devices/smu/smu2601b.yaml | 9 +++------ tests/sim_devices/smu/smu2601b_pulse.yaml | 2 +- tests/sim_devices/smu/smu2602a.yaml | 2 +- tests/sim_devices/smu/smu2602b.yaml | 2 +- tests/sim_devices/smu/smu2604a.yaml | 2 +- tests/sim_devices/smu/smu2604b.yaml | 2 +- tests/sim_devices/smu/smu2606b.yaml | 2 +- tests/sim_devices/smu/smu2611a.yaml | 2 +- tests/sim_devices/smu/smu2611b.yaml | 2 +- tests/sim_devices/smu/smu2612a.yaml | 2 +- tests/sim_devices/smu/smu2612b.yaml | 2 +- tests/sim_devices/smu/smu2614a.yaml | 2 +- tests/sim_devices/smu/smu2614b.yaml | 2 +- tests/sim_devices/smu/smu2634a.yaml | 2 +- tests/sim_devices/smu/smu2634b.yaml | 2 +- tests/sim_devices/smu/smu2635a.yaml | 2 +- tests/sim_devices/smu/smu2635b.yaml | 2 +- tests/sim_devices/smu/smu2636a.yaml | 2 +- tests/sim_devices/smu/smu2636b.yaml | 2 +- tests/sim_devices/smu/smu2651a.yaml | 2 +- tests/sim_devices/smu/smu2657a.yaml | 2 +- tests/sim_devices/ss/ss3706a.yaml | 2 +- tests/test_smu.py | 17 +++++++++-------- 33 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/tm_devices/drivers/pi/tsp_device.py b/src/tm_devices/drivers/pi/tsp_device.py index 3894a323..088b05a4 100644 --- a/src/tm_devices/drivers/pi/tsp_device.py +++ b/src/tm_devices/drivers/pi/tsp_device.py @@ -145,7 +145,7 @@ def load_script( """ if file_path is not None: with open(file_path, encoding="utf-8") as script_tsp: - script_body = script_tsp.read() + script_body = script_tsp.read().strip() # Check if the script exists, delete it if it does self.write(f"if {script_name} ~= nil then script.delete('{script_name}') end") diff --git a/tests/sim_devices/daq/daq6510.yaml b/tests/sim_devices/daq/daq6510.yaml index 38a0dca8..8ac9e542 100644 --- a/tests/sim_devices/daq/daq6510.yaml +++ b/tests/sim_devices/daq/daq6510.yaml @@ -7,7 +7,7 @@ devices: r: KEITHLEY INSTRUMENTS,MODEL DAQ6510,04089762,1.6.3 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/dmm/dmm6500.yaml b/tests/sim_devices/dmm/dmm6500.yaml index b1e83a04..e691e50e 100644 --- a/tests/sim_devices/dmm/dmm6500.yaml +++ b/tests/sim_devices/dmm/dmm6500.yaml @@ -7,7 +7,7 @@ devices: r: KEITHLEY INSTRUMENTS,MODEL DMM6500,01418035,1.0.0 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/dmm/dmm7510.yaml b/tests/sim_devices/dmm/dmm7510.yaml index 9e0b1f2f..4f1ea04e 100644 --- a/tests/sim_devices/dmm/dmm7510.yaml +++ b/tests/sim_devices/dmm/dmm7510.yaml @@ -7,7 +7,7 @@ devices: r: KEITHLEY INSTRUMENTS,MODEL DMM7510,00000170,1.0.0 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/dmm/dmm7512.yaml b/tests/sim_devices/dmm/dmm7512.yaml index a45f19f2..8a494cc1 100644 --- a/tests/sim_devices/dmm/dmm7512.yaml +++ b/tests/sim_devices/dmm/dmm7512.yaml @@ -7,7 +7,7 @@ devices: r: KEITHLEY INSTRUMENTS,MODEL DMM7512,00000171,1.0.0 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/smu/smu2450.yaml b/tests/sim_devices/smu/smu2450.yaml index 3bbee855..10236a21 100644 --- a/tests/sim_devices/smu/smu2450.yaml +++ b/tests/sim_devices/smu/smu2450.yaml @@ -7,7 +7,7 @@ devices: r: Keithley Instruments Inc., Model 2450, 01419964, 3.3.5 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/smu/smu2460.yaml b/tests/sim_devices/smu/smu2460.yaml index 05574cfa..5900db3e 100644 --- a/tests/sim_devices/smu/smu2460.yaml +++ b/tests/sim_devices/smu/smu2460.yaml @@ -7,7 +7,7 @@ devices: r: Keithley Instruments Inc., Model 2460, 01419964, 3.3.5 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/smu/smu2461.yaml b/tests/sim_devices/smu/smu2461.yaml index 4b870651..23df9025 100644 --- a/tests/sim_devices/smu/smu2461.yaml +++ b/tests/sim_devices/smu/smu2461.yaml @@ -7,7 +7,7 @@ devices: r: Keithley Instruments Inc., Model 2461, 01419964, 3.3.5 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/smu/smu2470.yaml b/tests/sim_devices/smu/smu2470.yaml index 190dc701..b5e2df0a 100644 --- a/tests/sim_devices/smu/smu2470.yaml +++ b/tests/sim_devices/smu/smu2470.yaml @@ -7,7 +7,7 @@ devices: r: Keithley Instruments Inc., Model 2470, 01419964, 3.3.5 - q: waitcomplete() - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: eventlog.clear() - q: status.clear() diff --git a/tests/sim_devices/smu/smu2601a.yaml b/tests/sim_devices/smu/smu2601a.yaml index 8cfa094f..bbd3a0fc 100644 --- a/tests/sim_devices/smu/smu2601a.yaml +++ b/tests/sim_devices/smu/smu2601a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2601b.yaml b/tests/sim_devices/smu/smu2601b.yaml index 2cc44970..11ea57a8 100644 --- a/tests/sim_devices/smu/smu2601b.yaml +++ b/tests/sim_devices/smu/smu2601b.yaml @@ -7,11 +7,8 @@ devices: r: Keithley Instruments Inc., Model 2601B, 4498311, 3.3.5 - q: print(available(gpib)) r: 'true' - - q: loadscript loadfuncs - - q: loadscript tsp_function - - q: print("TEK") - - q: '"""Sample script used in test_smu.py."""' - - q: endscript + - q: loadscript loadfuncs\n"""Sample script used in test_smu.py."""\nprint("TEK")\nendscript + - q: loadscript tsp_function\n"""Sample script used in test_smu.py."""\nprint("TEK")\nendscript - q: loadfuncs.save() - q: loadfuncs() - q: errorqueue.clear() @@ -20,7 +17,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2601b_pulse.yaml b/tests/sim_devices/smu/smu2601b_pulse.yaml index 124a2d51..24242f4e 100644 --- a/tests/sim_devices/smu/smu2601b_pulse.yaml +++ b/tests/sim_devices/smu/smu2601b_pulse.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2602a.yaml b/tests/sim_devices/smu/smu2602a.yaml index b204c514..4464171d 100644 --- a/tests/sim_devices/smu/smu2602a.yaml +++ b/tests/sim_devices/smu/smu2602a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2602b.yaml b/tests/sim_devices/smu/smu2602b.yaml index bf6a5b13..726bf119 100644 --- a/tests/sim_devices/smu/smu2602b.yaml +++ b/tests/sim_devices/smu/smu2602b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2604a.yaml b/tests/sim_devices/smu/smu2604a.yaml index dc15222c..7cee65b8 100644 --- a/tests/sim_devices/smu/smu2604a.yaml +++ b/tests/sim_devices/smu/smu2604a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2604b.yaml b/tests/sim_devices/smu/smu2604b.yaml index ac91d766..182a3e6d 100644 --- a/tests/sim_devices/smu/smu2604b.yaml +++ b/tests/sim_devices/smu/smu2604b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2606b.yaml b/tests/sim_devices/smu/smu2606b.yaml index ce796b15..6f825e06 100644 --- a/tests/sim_devices/smu/smu2606b.yaml +++ b/tests/sim_devices/smu/smu2606b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2611a.yaml b/tests/sim_devices/smu/smu2611a.yaml index ca34b1da..1596797e 100644 --- a/tests/sim_devices/smu/smu2611a.yaml +++ b/tests/sim_devices/smu/smu2611a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2611b.yaml b/tests/sim_devices/smu/smu2611b.yaml index b3c8bf4f..cd9810b9 100644 --- a/tests/sim_devices/smu/smu2611b.yaml +++ b/tests/sim_devices/smu/smu2611b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2612a.yaml b/tests/sim_devices/smu/smu2612a.yaml index d1c055b5..0e13e831 100644 --- a/tests/sim_devices/smu/smu2612a.yaml +++ b/tests/sim_devices/smu/smu2612a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2612b.yaml b/tests/sim_devices/smu/smu2612b.yaml index 3ee13fa5..91008575 100644 --- a/tests/sim_devices/smu/smu2612b.yaml +++ b/tests/sim_devices/smu/smu2612b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2614a.yaml b/tests/sim_devices/smu/smu2614a.yaml index f3ee64b2..43c21b49 100644 --- a/tests/sim_devices/smu/smu2614a.yaml +++ b/tests/sim_devices/smu/smu2614a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2614b.yaml b/tests/sim_devices/smu/smu2614b.yaml index 9a15e4d3..2fd9cebc 100644 --- a/tests/sim_devices/smu/smu2614b.yaml +++ b/tests/sim_devices/smu/smu2614b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2634a.yaml b/tests/sim_devices/smu/smu2634a.yaml index abfef220..224c4b58 100644 --- a/tests/sim_devices/smu/smu2634a.yaml +++ b/tests/sim_devices/smu/smu2634a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2634b.yaml b/tests/sim_devices/smu/smu2634b.yaml index d80af8f9..b4a0bed0 100644 --- a/tests/sim_devices/smu/smu2634b.yaml +++ b/tests/sim_devices/smu/smu2634b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2635a.yaml b/tests/sim_devices/smu/smu2635a.yaml index 6375e4ec..354a6323 100644 --- a/tests/sim_devices/smu/smu2635a.yaml +++ b/tests/sim_devices/smu/smu2635a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2635b.yaml b/tests/sim_devices/smu/smu2635b.yaml index 62910dac..5547d027 100644 --- a/tests/sim_devices/smu/smu2635b.yaml +++ b/tests/sim_devices/smu/smu2635b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2636a.yaml b/tests/sim_devices/smu/smu2636a.yaml index 6bf53b4a..ee527805 100644 --- a/tests/sim_devices/smu/smu2636a.yaml +++ b/tests/sim_devices/smu/smu2636a.yaml @@ -11,7 +11,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2636b.yaml b/tests/sim_devices/smu/smu2636b.yaml index 9e119fbc..d7cf971f 100644 --- a/tests/sim_devices/smu/smu2636b.yaml +++ b/tests/sim_devices/smu/smu2636b.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2651a.yaml b/tests/sim_devices/smu/smu2651a.yaml index 332177f4..8861be87 100644 --- a/tests/sim_devices/smu/smu2651a.yaml +++ b/tests/sim_devices/smu/smu2651a.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/smu/smu2657a.yaml b/tests/sim_devices/smu/smu2657a.yaml index ad832a31..1c8db918 100644 --- a/tests/sim_devices/smu/smu2657a.yaml +++ b/tests/sim_devices/smu/smu2657a.yaml @@ -20,7 +20,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/sim_devices/ss/ss3706a.yaml b/tests/sim_devices/ss/ss3706a.yaml index 09d918fc..c13bdfa1 100644 --- a/tests/sim_devices/ss/ss3706a.yaml +++ b/tests/sim_devices/ss/ss3706a.yaml @@ -21,7 +21,7 @@ devices: - q: print(status.standard.enable) r: 1 - q: opc() - - q: print([[1]]) + - q: waitcomplete() print([[1]]) r: 1 - q: reset() - q: status.request_enable = 1 diff --git a/tests/test_smu.py b/tests/test_smu.py index 3b655823..47d416b9 100644 --- a/tests/test_smu.py +++ b/tests/test_smu.py @@ -31,6 +31,7 @@ def test_smu( # noqa: PLR0915 device_manager: The DeviceManager object. capsys: The captured stdout and stderr. """ + device_manager.verbose = True smu: SMU2601B = device_manager.add_smu("smu2601b-hostname", alias="smu-device") assert id(device_manager.get_smu(number_or_alias="smu-device")) == id(smu) assert id(device_manager.get_smu(number_or_alias=smu.device_number)) == id(smu) @@ -75,18 +76,18 @@ def test_smu( # noqa: PLR0915 assert "tsp_function()" not in stdout smu.expect_esr(0) smu.load_script( - script_name="tsp_function", - script_body=( - Path(os.path.realpath(__file__)).parent / "samples" / "tsp_script.tsp" - ).read_text(), + script_name="loadfuncs", + script_body=(Path(os.path.realpath(__file__)).parent / "samples" / "tsp_script.tsp") + .read_text() + .strip(), run_script=True, ) stdout = capsys.readouterr().out - assert "loadscript tsp_function" in stdout - assert "if tsp_function ~= nil then script.delete('tsp_function') end" in stdout + assert "loadscript loadfuncs" in stdout + assert "if loadfuncs ~= nil then script.delete('loadfuncs') end" in stdout assert "endscript" in stdout - assert "tsp_function.save()" not in stdout - assert "tsp_function()" in stdout + assert "loadfuncs.save()" not in stdout + assert "loadfuncs()" in stdout smu.expect_esr(0) with mock.patch("pyvisa.highlevel.VisaLibraryBase.clear", mock.MagicMock(return_value=None)): From 1ce59ea1e6bba867d838ea0e6b570166a5d96f90 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Thu, 22 Aug 2024 16:27:13 -0700 Subject: [PATCH 4/8] feat: pretty printing of verbose multiline write commands, mainly for tsp. --- src/tm_devices/drivers/pi/pi_device.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tm_devices/drivers/pi/pi_device.py b/src/tm_devices/drivers/pi/pi_device.py index 2b83e5cb..8b999268 100644 --- a/src/tm_devices/drivers/pi/pi_device.py +++ b/src/tm_devices/drivers/pi/pi_device.py @@ -870,7 +870,18 @@ def write(self, command: str, opc: bool = False, verbose: bool = True) -> None: SystemError: ``*OPC?`` did not return "1" after sending the command. """ if self._verbose and verbose: - print_with_timestamp(f"({self._name_and_alias}) Write >> {command!r}") + if "\n" in command: + # Format any multiline command to print out with a single timestamp + # followed by as many (whitespace padded) f'>> {cmd}' lines as it has + commands_iter = iter(repr(command.strip()).split("\\n")) + spaces = " " * len( + print_with_timestamp( + f"({self._name_and_alias}) Write >> {next(commands_iter)}" + ).split(">> ")[0] + ) + print(*[f"{spaces}>> {cmd}" for cmd in commands_iter], sep="\n") + else: + print_with_timestamp(f"({self._name_and_alias}) Write >> {command!r}") try: self._visa_resource.write(command) From b441b2d71cde9ef659e0dc40fa9f45892afd9339 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Wed, 18 Sep 2024 16:10:34 -0700 Subject: [PATCH 5/8] fix: documentation and renamed TSPDevice.write_buffers() to export_buffers() --- CHANGELOG.md | 7 +++ .../2600/smu_2651_fast_adc_usage.py | 4 +- src/tm_devices/drivers/device.py | 5 ++ src/tm_devices/drivers/pi/pi_device.py | 1 + src/tm_devices/drivers/pi/tsp_device.py | 53 +++++++++++++------ tests/test_smu.py | 9 +++- 6 files changed, 59 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 883648c6..8c8b8e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Things to be included in the next release go here. - Added a config option (`default_visa_timeout`) to specify the default VISA timeout for all initial VISA device connections. - Added a new function, `register_additional_usbtmc_mapping()`, to enable users to add USBTMC connection information for devices that don't have native support for USBTMC connections in `tm_devices` yet. +- Added `TSPDevice.export_buffers()`. ### Changed @@ -29,6 +30,12 @@ Things to be included in the next release go here. - Reduced the out-of-the box `default_visa_timeout` value from 30 seconds to 5 seconds. - _**SEMI-BREAKING CHANGE**_: Changed the `USB_MODEL_ID_LOOKUP` constant to use `SupportedModels` as keys instead of values to make the documentation clearer. - _**SEMI-BREAKING CHANGE**_: Changed the `DEVICE_DRIVER_MODEL_MAPPING` constant to use `SupportedModels` as keys instead of values to make the documentation clearer. +- _**SEMI-BREAKING CHANGE**_: Changed the input parameter order in `TSPDevice.load_script()` and updated it to accept raw string input in addition to the `file_path` parameter for the script content. +- Verbosity with `PIDevice.write()` now handles multiline printing. + +### Deprecated + +- renamed `TSPDevice.write_buffers()` to `TSPDevice.export_buffers()` for clarity. ### Fixed diff --git a/examples/source_measure_units/2600/smu_2651_fast_adc_usage.py b/examples/source_measure_units/2600/smu_2651_fast_adc_usage.py index f4058972..93a8c14f 100644 --- a/examples/source_measure_units/2600/smu_2651_fast_adc_usage.py +++ b/examples/source_measure_units/2600/smu_2651_fast_adc_usage.py @@ -123,7 +123,7 @@ def capture_pulse_i(inst: SMU2651A) -> None: smua.source.output = 0 - inst.write_buffers(I_FILENAME, "smua.nvbuffer1.timestamps", "smua.nvbuffer2", "smua.nvbuffer1") + inst.export_buffers(I_FILENAME, "smua.nvbuffer1.timestamps", "smua.nvbuffer2", "smua.nvbuffer1") def capture_pulse_v(inst: SMU2651A) -> None: @@ -216,7 +216,7 @@ def capture_pulse_v(inst: SMU2651A) -> None: smua.source.output = 0 - inst.write_buffers(V_FILENAME, "smua.nvbuffer1.timestamps", "smua.nvbuffer2", "smua.nvbuffer1") + inst.export_buffers(V_FILENAME, "smua.nvbuffer1.timestamps", "smua.nvbuffer2", "smua.nvbuffer1") # RUN TEST diff --git a/src/tm_devices/drivers/device.py b/src/tm_devices/drivers/device.py index 9566b840..be8cf37b 100644 --- a/src/tm_devices/drivers/device.py +++ b/src/tm_devices/drivers/device.py @@ -427,6 +427,11 @@ def close(self) -> None: def has_errors(self) -> bool: """Check if the device has any errors. + !!! warning + In v3 this method will return a tuple containing a bool and a list of instances of + device error info dataclasses (would replace + [`get_eventlog_status()`][tm_devices.drivers.pi.pi_device.PIDevice]). + Returns: A boolean indicating if any errors were found in the device. """ diff --git a/src/tm_devices/drivers/pi/pi_device.py b/src/tm_devices/drivers/pi/pi_device.py index e7196f09..a87d6649 100644 --- a/src/tm_devices/drivers/pi/pi_device.py +++ b/src/tm_devices/drivers/pi/pi_device.py @@ -110,6 +110,7 @@ def get_eventlog_status(self) -> Tuple[bool, str]: Returns: Boolean indicating no error, String containing concatenated contents of event log. """ + # TODO: in v3 - This will be deprecated by the has_errors def turn_channel_off(self, channel_str: str) -> None: """Turn off the specified channel. diff --git a/src/tm_devices/drivers/pi/tsp_device.py b/src/tm_devices/drivers/pi/tsp_device.py index 088b05a4..81af7f8f 100644 --- a/src/tm_devices/drivers/pi/tsp_device.py +++ b/src/tm_devices/drivers/pi/tsp_device.py @@ -2,6 +2,8 @@ from __future__ import annotations +import warnings + from abc import ABC from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING, Union @@ -80,6 +82,26 @@ def expect_esr(self, esr: Union[int, str], error_string: str = "") -> Tuple[bool return result, failure_message + def export_buffers(self, filepath: str, *args: str, sep: str = ",") -> None: + """Export one or more of the device's buffers to the given filepath. + + Args: + filepath: A string representing the path of the file to write to. + args: The buffer name(s) to export. + sep: The delimiter used to separate data. Defaults to ",". + """ + with open(filepath, mode="w", encoding="utf-8") as file: + buffer_data = self.get_buffers(*args) + column_length = max(len(x) for x in buffer_data.values()) + file.write(sep.join(buffer_data) + "\n") + for index in range(column_length): + file.write( + sep.join( + [str(ls[index]) if index < len(ls) else "" for ls in buffer_data.values()] + ) + + "\n" + ) + def get_buffers(self, *args: str) -> Dict[str, List[float]]: """Get the contents of one or more buffers on the device. @@ -138,12 +160,13 @@ def load_script( Args: script_name: A string indicating what to name the script being loaded on the instrument. - script_body: TSP content to load on the instrument, overwritten if file_path defined. - file_path: a *.tsp file from the local filesystem to use as the `script_body`. + script_body: TSP content to load on the instrument, overwritten if `file_path` defined. + file_path: a *.tsp file from the local filesystem to read and use as the `script_body`. run_script: Boolean indicating if the script should be run immediately after loading. to_nv_memory: Boolean indicating if the script is to be saved to non-volatile memory. """ if file_path is not None: + # script_body argument is overwritten by file contents with open(file_path, encoding="utf-8") as script_tsp: script_body = script_tsp.read().strip() @@ -153,7 +176,7 @@ def load_script( # Load the script self.write(f"loadscript {script_name}\n{script_body}\nendscript") - # Save to NV Memory + # Save to Non-Volatile Memory (script definition survives power cycle) if to_nv_memory: self.write(f"{script_name}.save()") @@ -247,18 +270,14 @@ def write_buffers(self, filepath: str, *args: str, sep: str = ",") -> None: args: The buffer name(s) to export. sep: The delimiter used to separate data. Defaults to ",". """ - with open(filepath, mode="w", encoding="utf-8") as file: - buffer_data = self.get_buffers(*args) - column_length = max(len(x) for x in buffer_data.values()) - file.write(sep.join(buffer_data) + "\n") - for index in range(column_length): - file.write( - sep.join( - [str(ls[index]) if index < len(ls) else "" for ls in buffer_data.values()] - ) - + "\n" - ) + # TODO: Deprecation - remove in next major version v3 + warnings.warn( + DeprecationWarning("Use export_buffers(...) instead."), + stacklevel=2, + ) + self.export_buffers(filepath, *args, sep=sep) - ################################################################################################ - # Private Methods - ################################################################################################ + +################################################################################################ +# Private Methods +################################################################################################ diff --git a/tests/test_smu.py b/tests/test_smu.py index 8295ae70..949d2385 100644 --- a/tests/test_smu.py +++ b/tests/test_smu.py @@ -232,8 +232,15 @@ def test_smu( # noqa: PLR0915 assert str(value) in stdout filepath = f"./temp_test_{sys.version_info.major}{sys.version_info.minor}.csv" - try: + + # TODO: remove this deprecation check in v3 + with mock.patch( + "tm_devices.drivers.pi.tsp_device.TSPDevice.export_buffers", mock.MagicMock() + ), pytest.warns(DeprecationWarning, match=r"Use export_buffers\(\.\.\.\) instead"): smu.write_buffers(filepath, "smua.nvbuffer1") + + try: + smu.export_buffers(filepath, "smua.nvbuffer1") assert os.path.exists(filepath) # noqa: PTH110 with open(filepath, encoding="utf-8") as file: lines = file.readlines() From 8b58a37624c9d71dbd061696656d2a71ac6acdc2 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Thu, 19 Sep 2024 12:00:50 -0700 Subject: [PATCH 6/8] fix: addressed PR comments --- CHANGELOG.md | 6 +++--- src/tm_devices/drivers/device.py | 2 +- tests/test_smu.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8b8e9a..5b6e67a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ Things to be included in the next release go here. - Added a config option (`default_visa_timeout`) to specify the default VISA timeout for all initial VISA device connections. - Added a new function, `register_additional_usbtmc_mapping()`, to enable users to add USBTMC connection information for devices that don't have native support for USBTMC connections in `tm_devices` yet. -- Added `TSPDevice.export_buffers()`. +- Added `TSPDevice.export_buffers()` to write tsp buffer data fields to file, default is comma separated values with buffer names header. ### Changed @@ -31,11 +31,11 @@ Things to be included in the next release go here. - _**SEMI-BREAKING CHANGE**_: Changed the `USB_MODEL_ID_LOOKUP` constant to use `SupportedModels` as keys instead of values to make the documentation clearer. - _**SEMI-BREAKING CHANGE**_: Changed the `DEVICE_DRIVER_MODEL_MAPPING` constant to use `SupportedModels` as keys instead of values to make the documentation clearer. - _**SEMI-BREAKING CHANGE**_: Changed the input parameter order in `TSPDevice.load_script()` and updated it to accept raw string input in addition to the `file_path` parameter for the script content. -- Verbosity with `PIDevice.write()` now handles multiline printing. +- Verbosity with `PIDevice.write()` now handles multiline input printouts. ### Deprecated -- renamed `TSPDevice.write_buffers()` to `TSPDevice.export_buffers()` for clarity. +- Renamed `TSPDevice.write_buffers()` to `TSPDevice.export_buffers()` for clarity. ### Fixed diff --git a/src/tm_devices/drivers/device.py b/src/tm_devices/drivers/device.py index be8cf37b..0707ebc4 100644 --- a/src/tm_devices/drivers/device.py +++ b/src/tm_devices/drivers/device.py @@ -429,7 +429,7 @@ def has_errors(self) -> bool: !!! warning In v3 this method will return a tuple containing a bool and a list of instances of - device error info dataclasses (would replace + device error info dataclasses (this will replace [`get_eventlog_status()`][tm_devices.drivers.pi.pi_device.PIDevice]). Returns: diff --git a/tests/test_smu.py b/tests/test_smu.py index 949d2385..4cbb6319 100644 --- a/tests/test_smu.py +++ b/tests/test_smu.py @@ -31,7 +31,6 @@ def test_smu( # noqa: PLR0915 device_manager: The DeviceManager object. capsys: The captured stdout and stderr. """ - device_manager.verbose = True smu: SMU2601B = device_manager.add_smu("smu2601b-hostname", alias="smu-device") assert id(device_manager.get_smu(number_or_alias="smu-device")) == id(smu) assert id(device_manager.get_smu(number_or_alias=smu.device_number)) == id(smu) @@ -236,8 +235,9 @@ def test_smu( # noqa: PLR0915 # TODO: remove this deprecation check in v3 with mock.patch( "tm_devices.drivers.pi.tsp_device.TSPDevice.export_buffers", mock.MagicMock() - ), pytest.warns(DeprecationWarning, match=r"Use export_buffers\(\.\.\.\) instead"): + ) as mock_obj, pytest.warns(DeprecationWarning, match=r"Use export_buffers\(\.\.\.\) instead"): smu.write_buffers(filepath, "smua.nvbuffer1") + assert mock_obj.called try: smu.export_buffers(filepath, "smua.nvbuffer1") From 95daee5f3bc61c5ce21e80a010df51e1b5038808 Mon Sep 17 00:00:00 2001 From: "Danowski, Luke" Date: Tue, 15 Oct 2024 16:26:44 -0700 Subject: [PATCH 7/8] fix: perform garbage collection of TSP environment on cleanup. --- CHANGELOG.md | 4 ++++ .../source_measure_units/smu24xx/smu24xx_standard.py | 4 ++++ src/tm_devices/drivers/pi/tsp_device.py | 11 +++++++---- tests/sim_devices/daq/daq6510.yaml | 1 + tests/sim_devices/dmm/dmm6500.yaml | 1 + tests/sim_devices/dmm/dmm7510.yaml | 1 + tests/sim_devices/dmm/dmm7512.yaml | 1 + tests/sim_devices/smu/smu2450.yaml | 1 + tests/sim_devices/smu/smu2460.yaml | 1 + tests/sim_devices/smu/smu2461.yaml | 1 + tests/sim_devices/smu/smu2470.yaml | 1 + tests/sim_devices/smu/smu2601a.yaml | 1 + tests/sim_devices/smu/smu2601b.yaml | 1 + tests/sim_devices/smu/smu2601b_pulse.yaml | 1 + tests/sim_devices/smu/smu2602a.yaml | 1 + tests/sim_devices/smu/smu2602b.yaml | 1 + tests/sim_devices/smu/smu2604a.yaml | 1 + tests/sim_devices/smu/smu2604b.yaml | 1 + tests/sim_devices/smu/smu2606b.yaml | 1 + tests/sim_devices/smu/smu2611a.yaml | 1 + tests/sim_devices/smu/smu2611b.yaml | 1 + tests/sim_devices/smu/smu2612a.yaml | 1 + tests/sim_devices/smu/smu2612b.yaml | 1 + tests/sim_devices/smu/smu2614a.yaml | 1 + tests/sim_devices/smu/smu2614b.yaml | 1 + tests/sim_devices/smu/smu2634a.yaml | 1 + tests/sim_devices/smu/smu2634b.yaml | 1 + tests/sim_devices/smu/smu2635a.yaml | 1 + tests/sim_devices/smu/smu2635b.yaml | 1 + tests/sim_devices/smu/smu2636a.yaml | 1 + tests/sim_devices/smu/smu2636b.yaml | 1 + tests/sim_devices/smu/smu2651a.yaml | 1 + tests/sim_devices/smu/smu2657a.yaml | 1 + tests/sim_devices/smu/smu6430.yaml | 1 + tests/sim_devices/smu/smu6514.yaml | 1 + tests/sim_devices/smu/smu6517b.yaml | 1 + tests/sim_devices/ss/ss3706a.yaml | 1 + 37 files changed, 49 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9e8de7..3a4a5248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Valid subsections within a version are: Things to be included in the next release go here. +### Added + +- Now `collectgarbage()` is called with cleanup of TSPDevice children. + --- ## v2.4.0 (2024-09-19) diff --git a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py index 9f2016b2..0a1e9b89 100644 --- a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py +++ b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py @@ -136,3 +136,7 @@ def load_script( ################################################################################################ # Private Methods ################################################################################################ + + def _cleanup(self) -> None: + """Perform the cleanup defined for the device.""" + PIDevice._cleanup(self) # noqa: SLF001 diff --git a/src/tm_devices/drivers/pi/tsp_device.py b/src/tm_devices/drivers/pi/tsp_device.py index 81af7f8f..8506265d 100644 --- a/src/tm_devices/drivers/pi/tsp_device.py +++ b/src/tm_devices/drivers/pi/tsp_device.py @@ -277,7 +277,10 @@ def write_buffers(self, filepath: str, *args: str, sep: str = ",") -> None: ) self.export_buffers(filepath, *args, sep=sep) - -################################################################################################ -# Private Methods -################################################################################################ + ################################################################################################ + # Private Methods + ################################################################################################ + def _cleanup(self) -> None: + """Perform the cleanup defined for the device.""" + super()._cleanup() + self.write("collectgarbage()") diff --git a/tests/sim_devices/daq/daq6510.yaml b/tests/sim_devices/daq/daq6510.yaml index 8ac9e542..10e28ec8 100644 --- a/tests/sim_devices/daq/daq6510.yaml +++ b/tests/sim_devices/daq/daq6510.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm6500.yaml b/tests/sim_devices/dmm/dmm6500.yaml index e691e50e..e9852c7d 100644 --- a/tests/sim_devices/dmm/dmm6500.yaml +++ b/tests/sim_devices/dmm/dmm6500.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm7510.yaml b/tests/sim_devices/dmm/dmm7510.yaml index 4f1ea04e..a3ab4ecd 100644 --- a/tests/sim_devices/dmm/dmm7510.yaml +++ b/tests/sim_devices/dmm/dmm7510.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm7512.yaml b/tests/sim_devices/dmm/dmm7512.yaml index 8a494cc1..418d0f1b 100644 --- a/tests/sim_devices/dmm/dmm7512.yaml +++ b/tests/sim_devices/dmm/dmm7512.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2450.yaml b/tests/sim_devices/smu/smu2450.yaml index 10236a21..1c8a7503 100644 --- a/tests/sim_devices/smu/smu2450.yaml +++ b/tests/sim_devices/smu/smu2450.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2460.yaml b/tests/sim_devices/smu/smu2460.yaml index 5900db3e..e055d331 100644 --- a/tests/sim_devices/smu/smu2460.yaml +++ b/tests/sim_devices/smu/smu2460.yaml @@ -13,6 +13,7 @@ devices: - q: status.clear() - q: reset() - q: smu.source.sweeplinear("SolarCell", 0, 0.53, 56, 0.1) + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2461.yaml b/tests/sim_devices/smu/smu2461.yaml index 23df9025..45582f6c 100644 --- a/tests/sim_devices/smu/smu2461.yaml +++ b/tests/sim_devices/smu/smu2461.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2470.yaml b/tests/sim_devices/smu/smu2470.yaml index b5e2df0a..e5c0ef55 100644 --- a/tests/sim_devices/smu/smu2470.yaml +++ b/tests/sim_devices/smu/smu2470.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2601a.yaml b/tests/sim_devices/smu/smu2601a.yaml index bbd3a0fc..918892e9 100644 --- a/tests/sim_devices/smu/smu2601a.yaml +++ b/tests/sim_devices/smu/smu2601a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2601b.yaml b/tests/sim_devices/smu/smu2601b.yaml index 11ea57a8..e08146ff 100644 --- a/tests/sim_devices/smu/smu2601b.yaml +++ b/tests/sim_devices/smu/smu2601b.yaml @@ -29,6 +29,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() - q: status.node_enable = 1 - q: print(status.node_enable) r: 1 diff --git a/tests/sim_devices/smu/smu2601b_pulse.yaml b/tests/sim_devices/smu/smu2601b_pulse.yaml index 24242f4e..8cfd52d2 100644 --- a/tests/sim_devices/smu/smu2601b_pulse.yaml +++ b/tests/sim_devices/smu/smu2601b_pulse.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2602a.yaml b/tests/sim_devices/smu/smu2602a.yaml index 4464171d..46bbdf5c 100644 --- a/tests/sim_devices/smu/smu2602a.yaml +++ b/tests/sim_devices/smu/smu2602a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2602b.yaml b/tests/sim_devices/smu/smu2602b.yaml index 726bf119..6a85a12d 100644 --- a/tests/sim_devices/smu/smu2602b.yaml +++ b/tests/sim_devices/smu/smu2602b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2604a.yaml b/tests/sim_devices/smu/smu2604a.yaml index 7cee65b8..7bda280a 100644 --- a/tests/sim_devices/smu/smu2604a.yaml +++ b/tests/sim_devices/smu/smu2604a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2604b.yaml b/tests/sim_devices/smu/smu2604b.yaml index 182a3e6d..df0a1a25 100644 --- a/tests/sim_devices/smu/smu2604b.yaml +++ b/tests/sim_devices/smu/smu2604b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2606b.yaml b/tests/sim_devices/smu/smu2606b.yaml index 6f825e06..b7958699 100644 --- a/tests/sim_devices/smu/smu2606b.yaml +++ b/tests/sim_devices/smu/smu2606b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2611a.yaml b/tests/sim_devices/smu/smu2611a.yaml index 1596797e..f30cb484 100644 --- a/tests/sim_devices/smu/smu2611a.yaml +++ b/tests/sim_devices/smu/smu2611a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2611b.yaml b/tests/sim_devices/smu/smu2611b.yaml index cd9810b9..f7e01632 100644 --- a/tests/sim_devices/smu/smu2611b.yaml +++ b/tests/sim_devices/smu/smu2611b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2612a.yaml b/tests/sim_devices/smu/smu2612a.yaml index 0e13e831..4a0c4fc1 100644 --- a/tests/sim_devices/smu/smu2612a.yaml +++ b/tests/sim_devices/smu/smu2612a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2612b.yaml b/tests/sim_devices/smu/smu2612b.yaml index 91008575..3355842c 100644 --- a/tests/sim_devices/smu/smu2612b.yaml +++ b/tests/sim_devices/smu/smu2612b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2614a.yaml b/tests/sim_devices/smu/smu2614a.yaml index 43c21b49..08500e87 100644 --- a/tests/sim_devices/smu/smu2614a.yaml +++ b/tests/sim_devices/smu/smu2614a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2614b.yaml b/tests/sim_devices/smu/smu2614b.yaml index 2fd9cebc..a6eda98f 100644 --- a/tests/sim_devices/smu/smu2614b.yaml +++ b/tests/sim_devices/smu/smu2614b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2634a.yaml b/tests/sim_devices/smu/smu2634a.yaml index 224c4b58..73113d76 100644 --- a/tests/sim_devices/smu/smu2634a.yaml +++ b/tests/sim_devices/smu/smu2634a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2634b.yaml b/tests/sim_devices/smu/smu2634b.yaml index b4a0bed0..b35e8f9c 100644 --- a/tests/sim_devices/smu/smu2634b.yaml +++ b/tests/sim_devices/smu/smu2634b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2635a.yaml b/tests/sim_devices/smu/smu2635a.yaml index 354a6323..81b687a1 100644 --- a/tests/sim_devices/smu/smu2635a.yaml +++ b/tests/sim_devices/smu/smu2635a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2635b.yaml b/tests/sim_devices/smu/smu2635b.yaml index 5547d027..271b6e3e 100644 --- a/tests/sim_devices/smu/smu2635b.yaml +++ b/tests/sim_devices/smu/smu2635b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2636a.yaml b/tests/sim_devices/smu/smu2636a.yaml index ee527805..4b7954d6 100644 --- a/tests/sim_devices/smu/smu2636a.yaml +++ b/tests/sim_devices/smu/smu2636a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2636b.yaml b/tests/sim_devices/smu/smu2636b.yaml index d7cf971f..6fef3be0 100644 --- a/tests/sim_devices/smu/smu2636b.yaml +++ b/tests/sim_devices/smu/smu2636b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2651a.yaml b/tests/sim_devices/smu/smu2651a.yaml index 8861be87..f99a2492 100644 --- a/tests/sim_devices/smu/smu2651a.yaml +++ b/tests/sim_devices/smu/smu2651a.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2657a.yaml b/tests/sim_devices/smu/smu2657a.yaml index 1c8db918..32550b72 100644 --- a/tests/sim_devices/smu/smu2657a.yaml +++ b/tests/sim_devices/smu/smu2657a.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu6430.yaml b/tests/sim_devices/smu/smu6430.yaml index 3fb3be73..b4a109cb 100644 --- a/tests/sim_devices/smu/smu6430.yaml +++ b/tests/sim_devices/smu/smu6430.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/smu/smu6514.yaml b/tests/sim_devices/smu/smu6514.yaml index a5f2d89a..7ab91a7e 100644 --- a/tests/sim_devices/smu/smu6514.yaml +++ b/tests/sim_devices/smu/smu6514.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/smu/smu6517b.yaml b/tests/sim_devices/smu/smu6517b.yaml index af63e9d6..b2084dba 100644 --- a/tests/sim_devices/smu/smu6517b.yaml +++ b/tests/sim_devices/smu/smu6517b.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/ss/ss3706a.yaml b/tests/sim_devices/ss/ss3706a.yaml index c13bdfa1..561f23a8 100644 --- a/tests/sim_devices/ss/ss3706a.yaml +++ b/tests/sim_devices/ss/ss3706a.yaml @@ -32,6 +32,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) From 1fbb22f256414ed6ab69c24e356e77332b5310ae Mon Sep 17 00:00:00 2001 From: Luke <111022789+ldantek@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:58:58 -0700 Subject: [PATCH 8/8] Update CHANGELOG.md Co-authored-by: Nicholas Felt Signed-off-by: Luke <111022789+ldantek@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a4a5248..9b7e4114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ Things to be included in the next release go here. ### Added -- Now `collectgarbage()` is called with cleanup of TSPDevice children. +- `collectgarbage()` is now called during cleanup of `TSPDevice` children. ---