From 95efbd734d3d89ff94f1a7df4f81b3a53079c1f0 Mon Sep 17 00:00:00 2001 From: LorenzoMonti Date: Mon, 7 Feb 2022 10:28:35 +0100 Subject: [PATCH] fix-issue-6: Set get_sweeptime() when get trace --- src/Anritsu_MS2830A.py | 8 ++++---- src/pyvisa_commands.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Anritsu_MS2830A.py b/src/Anritsu_MS2830A.py index f8a8099..4f9dc43 100644 --- a/src/Anritsu_MS2830A.py +++ b/src/Anritsu_MS2830A.py @@ -96,9 +96,9 @@ class Anritsu_MS2830A(): # TIME SWEEP # ###################################### - def do_get_sweeptime(self): + def get_sweeptime(self): """ - gets the center frequency + query the sweep time """ return float(self._visainstrument.query('swe:time?')) @@ -294,12 +294,12 @@ class Anritsu_MS2830A(): # TRACE # ###################################### - def get_trace(self, tracenumber=1, sleeping_time=25): + def get_trace(self, tracenumber=1): """ gets trace data """ # in ASCII form (slow, but human readable) and binary (fast, but more difficult to debug) - sleep(sleeping_time) + sleep(self.get_sweeptime() + 1) trace = self._visainstrument.query_ascii_values("TRAC? TRAC%i" %(tracenumber) , container = np.array) # Trace A (default) return trace diff --git a/src/pyvisa_commands.py b/src/pyvisa_commands.py index 8b9e0d7..f113b49 100644 --- a/src/pyvisa_commands.py +++ b/src/pyvisa_commands.py @@ -15,9 +15,11 @@ print("Who am i? " + inst.query("*IDN?")) inst.write("*RST") # Preset print("Self Test: " + inst.query("*TST?")) +print("SW: " + inst.query("swe:time?")) +#inst.write("INST SPECT") # set Spectrum Analyzer -inst.write("INST SPECT") # set Spectrum Analyzer +""" ###################################### # FREQUENCY # ###################################### @@ -72,3 +74,4 @@ print(track) #inst.write("*WAI") #print("Measurement status query: " + inst.query("MSTAT?")) +""" \ No newline at end of file -- GitLab