From 99a7416ec648565d738733b728aedc8922b182fe Mon Sep 17 00:00:00 2001 From: "Bansemer, Robert" Date: Mon, 7 Oct 2024 16:19:42 +0200 Subject: [PATCH] Fix time axis for lower record lengths The time axis now goes to either the value of `DATa:STOP` or the record length, depending on which of the two is lower. --- PyTektronixScope/PyTektronixScope.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PyTektronixScope/PyTektronixScope.py b/PyTektronixScope/PyTektronixScope.py index d266180..9c8297b 100644 --- a/PyTektronixScope/PyTektronixScope.py +++ b/PyTektronixScope/PyTektronixScope.py @@ -358,7 +358,11 @@ def read_data_one_channel(self, channel=None, data_start=None, self.x_0 = self.get_out_waveform_horizontal_zero() self.delta_x = self.get_out_waveform_horizontal_sampling_interval() - X_axis = self.x_0 + np.arange(self.data_start-1, self.data_stop)*self.delta_x + X_axis = (self.x_0 + + np.arange(self.data_start-1, + min((self.data_stop, + self.get_horizontal_record_length()))) * + self.delta_x) buffer = self.ask_raw('CURVE?') res = np.frombuffer(buffer, dtype=np.dtype('int16').newbyteorder('>'),