From 49967fdda61bd75fd47b1eaf70fd651c2e7ed66f Mon Sep 17 00:00:00 2001 From: Etienne Dumur Date: Fri, 22 Nov 2024 09:45:25 +0100 Subject: [PATCH 1/3] add slope threshold parameter --- .../drivers/Tektronix/FCA3100.py | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py index 14d99ccf8..097533313 100644 --- a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py +++ b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py @@ -3,7 +3,7 @@ from typing import Any, Tuple from qcodes.instrument import VisaInstrument from qcodes.parameters import MultiParameter, Parameter, ParameterWithSetpoints -from qcodes.validators import Arrays, Ints +from qcodes.utils.validators import Arrays, Ints log = logging.getLogger(__name__) @@ -63,13 +63,6 @@ def __init__(self, instrument:"FCA3100", **kwargs: Any ) -> None: - """ - Parameter for a complete time statistics containing all measured switching times. - - Args: - name: name of the complete time statistics - instrument: Instrument to which the complete time statistic is bound to. - """ super().__init__(name=name, instrument=instrument, label='Times till switching', @@ -86,8 +79,8 @@ def get_raw(self) -> np.ndarray: """ assert isinstance(self.instrument, FCA3100) self.instrument.write('CALCulate:AVERage:STATe 0') - self.instrument.write('ARM:COUN {}'.format(self.instrument.samples_number.get_latest())) - data_str=self.instrument.ask("READ:ARRay? {}".format(self.instrument.samples_number.get_latest())) + self._instrument.write('ARM:COUN {}'.format(self._instrument.samples_number.get_latest())) + data_str=self.root_instrument.ask("READ:ARRay? {}".format(self.root_instrument.samples_number.get_latest())) data = np.array(data_str.rstrip().split(",")).astype("float64") return data @@ -179,4 +172,26 @@ def __init__(self, vals=Arrays(shape=(self.samples_number.get_latest,)) ) + self.add_parameter(name='threshold_slope_A', + label='threshold_slope_A', + get_cmd='INPut1:SLOPe?', + set_cmd='INPut1:SLOPe {}', + get_parser=str, + unit='', + docstring='trigger slope @ threshold channel A' + ) + + self.add_parameter(name='threshold_slope_B', + label='threshold_slope_B', + get_cmd='INPut2:SLOPe?', + set_cmd='INPut2:SLOPe {}', + get_parser=str, + unit='', + docstring='trigger slope @ threshold channel B' + ) + self.connect_message() + + def startread(self): + self.ask("Read?") + return \ No newline at end of file From 3c1bcee0de026e6e36aa5a8c26f3290ad14836ed Mon Sep 17 00:00:00 2001 From: Etienne Dumur Date: Wed, 11 Dec 2024 15:50:10 +0100 Subject: [PATCH 2/3] Correction from jenshnielsen --- .../drivers/Tektronix/FCA3100.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py index 097533313..ba1c9fc02 100644 --- a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py +++ b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py @@ -3,7 +3,7 @@ from typing import Any, Tuple from qcodes.instrument import VisaInstrument from qcodes.parameters import MultiParameter, Parameter, ParameterWithSetpoints -from qcodes.utils.validators import Arrays, Ints +from qcodes.validators import Arrays, Ints log = logging.getLogger(__name__) @@ -79,7 +79,7 @@ def get_raw(self) -> np.ndarray: """ assert isinstance(self.instrument, FCA3100) self.instrument.write('CALCulate:AVERage:STATe 0') - self._instrument.write('ARM:COUN {}'.format(self._instrument.samples_number.get_latest())) + self.instrument.write('ARM:COUN {}'.format(self.instrument.samples_number.get_latest())) data_str=self.root_instrument.ask("READ:ARRay? {}".format(self.root_instrument.samples_number.get_latest())) data = np.array(data_str.rstrip().split(",")).astype("float64") return data @@ -190,8 +190,4 @@ def __init__(self, docstring='trigger slope @ threshold channel B' ) - self.connect_message() - - def startread(self): - self.ask("Read?") - return \ No newline at end of file + self.connect_message() \ No newline at end of file From 4dcc99f27fc541f5709eef12f4450b865cbeae9b Mon Sep 17 00:00:00 2001 From: Etienne Dumur Date: Wed, 11 Dec 2024 15:57:51 +0100 Subject: [PATCH 3/3] make mypy happy root_instrument -> instrument --- src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py index ba1c9fc02..4ff2efeaf 100644 --- a/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py +++ b/src/qcodes_contrib_drivers/drivers/Tektronix/FCA3100.py @@ -80,7 +80,7 @@ def get_raw(self) -> np.ndarray: assert isinstance(self.instrument, FCA3100) self.instrument.write('CALCulate:AVERage:STATe 0') self.instrument.write('ARM:COUN {}'.format(self.instrument.samples_number.get_latest())) - data_str=self.root_instrument.ask("READ:ARRay? {}".format(self.root_instrument.samples_number.get_latest())) + data_str=self.instrument.ask("READ:ARRay? {}".format(self.instrument.samples_number.get_latest())) data = np.array(data_str.rstrip().split(",")).astype("float64") return data