From 7e1922fd6797c6c38210a9ad2a6fae7811369062 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:47:44 +0200 Subject: [PATCH 01/22] Instrument mocks ManualParameter to parameter --- qcodes/tests/instrument_mocks.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/qcodes/tests/instrument_mocks.py b/qcodes/tests/instrument_mocks.py index c9f2c669be1..6e03ad68236 100644 --- a/qcodes/tests/instrument_mocks.py +++ b/qcodes/tests/instrument_mocks.py @@ -2,7 +2,7 @@ from qcodes.instrument.base import Instrument from qcodes.utils.validators import Numbers -from qcodes.instrument.parameter import MultiParameter, ManualParameter, ArrayParameter +from qcodes.instrument.parameter import MultiParameter, Parameter, ArrayParameter from qcodes.instrument.channel import InstrumentChannel, ChannelList class MockParabola(Instrument): @@ -25,13 +25,15 @@ def __init__(self, name, **kw): # Instrument parameters for parname in ['x', 'y', 'z']: self.add_parameter(parname, unit='a.u.', - parameter_class=ManualParameter, - vals=Numbers(), initial_value=0) + parameter_class=Parameter, + vals=Numbers(), initial_value=0, + get_cmd=None, set_cmd=None) self.add_parameter('noise', unit='a.u.', label='white noise amplitude', - parameter_class=ManualParameter, - vals=Numbers(), initial_value=0) + parameter_class=Parameter, + vals=Numbers(), initial_value=0, + get_cmd=None, set_cmd=None) self.add_parameter('parabola', unit='a.u.', get_cmd=self._measure_parabola) @@ -65,10 +67,12 @@ def __init__(self, name, mock_parabola_inst, **kw): # Instrument parameters for parname in ['x', 'y', 'z']: self.add_parameter(parname, unit='a.u.', - parameter_class=ManualParameter, - vals=Numbers(), initial_value=0) - self.add_parameter('gain', parameter_class=ManualParameter, - initial_value=1) + parameter_class=Parameter, + vals=Numbers(), initial_value=0, + get_cmd=None, set_cmd=None) + self.add_parameter('gain', parameter_class=Parameter, + initial_value=1, + get_cmd=None, set_cmd=None) self.add_parameter('parabola', unit='a.u.', get_cmd=self._get_parabola) @@ -101,11 +105,12 @@ def __init__(self, name='dummy', gates=['dac1', 'dac2', 'dac3'], **kwargs): # make gates for _, g in enumerate(gates): self.add_parameter(g, - parameter_class=ManualParameter, + parameter_class=Parameter, initial_value=0, label='Gate {}'.format(g), unit="V", - vals=Numbers(-800, 400)) + vals=Numbers(-800, 400), + get_cmd=None, set_cmd=None) class DummyChannel(InstrumentChannel): """ @@ -119,11 +124,12 @@ def __init__(self, parent, name, channel): # Add the various channel parameters self.add_parameter('temperature', - parameter_class=ManualParameter, + parameter_class=Parameter, initial_value=0, label="Temperature_{}".format(channel), unit='K', - vals=Numbers(0, 300)) + vals=Numbers(0, 300), + get_cmd=None, set_cmd=None) self.add_parameter(name='dummy_multi_parameter', parameter_class=MultiSetPointParam) From ed33f7d270395162ea750c7078de23e6458142e0 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:48:19 +0200 Subject: [PATCH 02/22] channels ManualParameter -> Parameter --- qcodes/tests/test_channels.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qcodes/tests/test_channels.py b/qcodes/tests/test_channels.py index 849d9d4f092..78e857049f6 100644 --- a/qcodes/tests/test_channels.py +++ b/qcodes/tests/test_channels.py @@ -3,7 +3,7 @@ from qcodes.tests.instrument_mocks import DummyChannelInstrument, DummyChannel from qcodes.utils.validators import Numbers -from qcodes.instrument.parameter import ManualParameter +from qcodes.instrument.parameter import Parameter from hypothesis import given, settings import hypothesis.strategies as hst @@ -142,7 +142,7 @@ def test_loop_simple(self): data.testchanneldummy_ChanA_temperature.ndarray) def test_loop_measure_all_channels(self): - p1 = ManualParameter(name='p1', vals=Numbers(-10, 10)) + p1 = Parameter(name='p1', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) loop = Loop(p1.sweep(-10, 10, 1), 1e-6).each(self.instrument.channels.temperature) data = loop.run() self.assertEqual(data.p1_set.ndarray.shape, (21, )) @@ -151,7 +151,7 @@ def test_loop_measure_all_channels(self): self.assertEqual(getattr(data, 'testchanneldummy_Chan{}_temperature'.format(chan)).ndarray.shape, (21,)) def test_loop_measure_channels_individually(self): - p1 = ManualParameter(name='p1', vals=Numbers(-10, 10)) + p1 = Parameter(name='p1', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) loop = Loop(p1.sweep(-10, 10, 1), 1e-6).each(self.instrument.channels[0].temperature, self.instrument.channels[1].temperature, self.instrument.channels[2].temperature, @@ -164,7 +164,7 @@ def test_loop_measure_channels_individually(self): @given(values=hst.lists(hst.floats(0, 300), min_size=4, max_size=4)) @settings(max_examples=10) def test_loop_measure_channels_by_name(self, values): - p1 = ManualParameter(name='p1', vals=Numbers(-10, 10)) + p1 = Parameter(name='p1', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) for i in range(4): self.instrument.channels[i].temperature(values[i]) loop = Loop(p1.sweep(-10, 10, 1), 1e-6).each(self.instrument.A.temperature, From 0b9fd4b11416fc8f47db4824d9c1a25227af692d Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:48:56 +0200 Subject: [PATCH 03/22] test_combined_loop ManualParamer to Parameter --- qcodes/tests/test_combined_loop.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qcodes/tests/test_combined_loop.py b/qcodes/tests/test_combined_loop.py index 288f49597c1..ec20f969400 100644 --- a/qcodes/tests/test_combined_loop.py +++ b/qcodes/tests/test_combined_loop.py @@ -7,7 +7,7 @@ from .instrument_mocks import DummyInstrument from qcodes.instrument.parameter import combine from qcodes import Task, Loop -from qcodes.instrument.parameter import ManualParameter +from qcodes.instrument.parameter import Parameter class TestLoopCombined(TestCase): @@ -38,7 +38,7 @@ def testLoopCombinedParameterPrintTask(self, npoints, x_start_stop, y_start_stop y_set.reshape(npoints, 1), z_set.reshape(npoints, 1))) - parameters = [ManualParameter(name) for name in ["X", "Y", "Z"]] + parameters = [Parameter(name, get_cmd=None, set_cmd=None) for name in ["X", "Y", "Z"]] sweep_values = combine(*parameters, name="combined").sweep(setpoints) @@ -72,7 +72,7 @@ def testLoopCombinedParameterTwice(self, npoints, x_start_stop, y_start_stop, z_ setpoints = np.hstack((x_set.reshape(npoints, 1), y_set.reshape(npoints, 1), z_set.reshape(npoints, 1))) - parameters = [ManualParameter(name) for name in ["X", "Y", "Z"]] + parameters = [Parameter(name, get_cmd=None, set_cmd=None) for name in ["X", "Y", "Z"]] sweep_values = combine(*parameters, name="combined").sweep(setpoints) @@ -110,7 +110,7 @@ def testLoopCombinedParameterAndMore(self, npoints, x_start_stop, y_start_stop, setpoints = np.hstack((x_set.reshape(npoints, 1), y_set.reshape(npoints, 1), z_set.reshape(npoints, 1))) - parameters = [ManualParameter(name) for name in ["X", "Y", "Z"]] + parameters = [Parameter(name, get_cmd=None, set_cmd=None) for name in ["X", "Y", "Z"]] sweep_values = combine(*parameters, name="combined").sweep(setpoints) @@ -151,7 +151,7 @@ def testLoopCombinedParameterInside(self, npoints, npoints_outer, x_start_stop, setpoints = np.hstack((y_set.reshape(npoints, 1), z_set.reshape(npoints, 1))) - parameters = [ManualParameter(name) for name in ["X", "Y", "Z"]] + parameters = [Parameter(name, get_cmd=None, set_cmd=None) for name in ["X", "Y", "Z"]] sweep_values = combine(parameters[1], parameters[2], name="combined").sweep(setpoints) From b1fd8145f9fbb30c8ddaa03aff8801ded2b68eb1 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:49:41 +0200 Subject: [PATCH 04/22] test_instrument ManualParameter to Parameter --- qcodes/tests/test_instrument.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/qcodes/tests/test_instrument.py b/qcodes/tests/test_instrument.py index e80fe9a0d71..ba9db4ec74a 100644 --- a/qcodes/tests/test_instrument.py +++ b/qcodes/tests/test_instrument.py @@ -4,7 +4,7 @@ from unittest import TestCase from qcodes.instrument.base import Instrument from .instrument_mocks import DummyInstrument, MockParabola -from qcodes.instrument.parameter import ManualParameter +from qcodes.instrument.parameter import Parameter import gc @@ -75,7 +75,7 @@ def test_add_remove_f_p(self): # by desgin one gets the parameter if a function exists and has same # name dac1 = self.instrument['dac1'] - self.assertTrue(isinstance(dac1, ManualParameter)) + self.assertTrue(isinstance(dac1, Parameter)) def test_instances(self): instruments = [self.instrument, self.instrument2] @@ -99,17 +99,19 @@ def test_instances(self): def test_snapshot_value(self): self.instrument.add_parameter('has_snapshot_value', - parameter_class=ManualParameter, + parameter_class=Parameter, initial_value=42, - snapshot_value=True) + snapshot_value=True, + get_cmd=None, set_cmd=None) self.instrument.add_parameter('no_snapshot_value', - parameter_class=ManualParameter, + parameter_class=Parameter, initial_value=42, - snapshot_value=False) + snapshot_value=False, + get_cmd=None, set_cmd=None) snapshot = self.instrument.snapshot() self.assertIn('value', snapshot['parameters']['has_snapshot_value']) self.assertEqual(42, snapshot['parameters']['has_snapshot_value']['value']) - self.assertNotIn('value', snapshot['parameters']['no_snapshot_value']) \ No newline at end of file + self.assertNotIn('value', snapshot['parameters']['no_snapshot_value']) From 3b2db022e27f12ca66f1dbc22518a3f252980249 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:50:12 +0200 Subject: [PATCH 05/22] test_loop ManualParameter to Parameter --- qcodes/tests/test_loop.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/qcodes/tests/test_loop.py b/qcodes/tests/test_loop.py index 6c5a6e85ef2..833192ce02e 100644 --- a/qcodes/tests/test_loop.py +++ b/qcodes/tests/test_loop.py @@ -8,7 +8,7 @@ from qcodes.actions import Task, Wait, BreakIf, _QcodesBreak from qcodes.station import Station from qcodes.data.data_array import DataArray -from qcodes.instrument.parameter import ManualParameter +from qcodes.instrument.parameter import Parameter from qcodes.utils.validators import Numbers from qcodes.utils.helpers import LogCapture @@ -18,9 +18,9 @@ class TestLoop(TestCase): @classmethod def setUpClass(cls): - cls.p1 = ManualParameter('p1', vals=Numbers(-10, 10)) - cls.p2 = ManualParameter('p2', vals=Numbers(-10, 10)) - cls.p3 = ManualParameter('p3', vals=Numbers(-10, 10)) + cls.p1 = Parameter('p1', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) + cls.p2 = Parameter('p2', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) + cls.p3 = Parameter('p3', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) Station().set_measurement(cls.p2, cls.p3) def test_nesting(self): @@ -448,7 +448,7 @@ def g(): self.assertEqual(len(f_calls), 1) -class AbortingGetter(ManualParameter): +class AbortingGetter(Parameter): """ A manual parameter that can only be measured n times before it aborts the loop that's measuring it. @@ -474,7 +474,7 @@ def test_halt(self): self.res = list(np.arange(0, abort_after-1, 1.)) [self.res.append(float('nan')) for i in range(0, abort_after-1)] - p1 = AbortingGetter('p1', count=abort_after, vals=Numbers(-10, 10)) + p1 = AbortingGetter('p1', count=abort_after, vals=Numbers(-10, 10), set_cmd=None) loop = Loop(p1.sweep(0, abort_after, 1), 0.005).each(p1) # we want to test what's in data, so get it ahead of time # because loop.run will not return. @@ -486,7 +486,7 @@ def test_halt(self): class TestMetaData(TestCase): def test_basic(self): - p1 = AbortingGetter('p1', count=2, vals=Numbers(-10, 10)) + p1 = AbortingGetter('p1', count=2, vals=Numbers(-10, 10), set_cmd=None) sv = p1[1:3:1] loop = Loop(sv) From 0f1c19807c3e619c30c8bc887563d68976602f02 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:52:13 +0200 Subject: [PATCH 06/22] test_measure ManualParameter to Parameter --- qcodes/tests/test_measure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qcodes/tests/test_measure.py b/qcodes/tests/test_measure.py index 28e8953887b..ef8c8a94ba1 100644 --- a/qcodes/tests/test_measure.py +++ b/qcodes/tests/test_measure.py @@ -1,7 +1,7 @@ from unittest import TestCase from datetime import datetime -from qcodes.instrument.parameter import ManualParameter +from qcodes.instrument.parameter import Parameter from qcodes.measure import Measure from .instrument_mocks import MultiGetter, MultiSetPointParam @@ -11,7 +11,7 @@ class TestMeasure(TestCase): def setUp(self): - self.p1 = ManualParameter('P1', initial_value=1) + self.p1 = Parameter('P1', initial_value=1, get_cmd=None, set_cmd=None) def test_simple_scalar(self): data = Measure(self.p1).run_temp() @@ -75,4 +75,4 @@ def test_metadata(self): self.assertEqual(c.metadata['arrays']['this_setpoint_set']['label'], 'this setpoint') self.assertEqual(c.metadata['arrays']['this_setpoint_set']['is_setpoint'], True) self.assertEqual(c.metadata['arrays']['this_setpoint_set']['shape'], (5,)) - assert_array_equal(c.this_setpoint_set.ndarray, np.linspace(5, 9, 5)) \ No newline at end of file + assert_array_equal(c.this_setpoint_set.ndarray, np.linspace(5, 9, 5)) From 149a18b56d3cb33bfe10d934897768a6cdc46db6 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:52:54 +0200 Subject: [PATCH 07/22] test_parameter ManualParamer to Parameter --- qcodes/tests/test_parameter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcodes/tests/test_parameter.py b/qcodes/tests/test_parameter.py index 86c491f88ec..0eb426e528d 100644 --- a/qcodes/tests/test_parameter.py +++ b/qcodes/tests/test_parameter.py @@ -8,7 +8,7 @@ from qcodes import Function from qcodes.instrument.parameter import ( Parameter, ArrayParameter, MultiParameter, - ManualParameter, StandardParameter, InstrumentRefParameter) + StandardParameter, InstrumentRefParameter) import qcodes.utils.validators as vals from qcodes.tests.instrument_mocks import DummyInstrument @@ -521,7 +521,7 @@ class TestManualParameter(TestCase): def test_bare_function(self): # not a use case we want to promote, but it's there... - p = ManualParameter('test') + p = Parameter('test', get_cmd=None, set_cmd=None) def doubler(x): p.set(x * 2) From 9a6ca072a510b5fd91e2de9d7231f5cb9b6ebc39 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 15:53:24 +0200 Subject: [PATCH 08/22] test_sweep_values ManualParameter to Parameter --- qcodes/tests/test_sweep_values.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qcodes/tests/test_sweep_values.py b/qcodes/tests/test_sweep_values.py index 7cbcd1b1986..c324fa1e11a 100644 --- a/qcodes/tests/test_sweep_values.py +++ b/qcodes/tests/test_sweep_values.py @@ -1,5 +1,5 @@ from unittest import TestCase -from qcodes.instrument.parameter import StandardParameter, ManualParameter +from qcodes.instrument.parameter import StandardParameter, Parameter from qcodes.instrument.sweep_values import SweepValues from qcodes.utils.validators import Numbers @@ -7,8 +7,8 @@ class TestSweepValues(TestCase): def setUp(self): - self.c0 = ManualParameter('c0', vals=Numbers(-10, 10)) - self.c1 = ManualParameter('c1') + self.c0 = Parameter('c0', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) + self.c1 = Parameter('c1', get_cmd=None, set_cmd=None) self.getter = StandardParameter('c2', get_cmd=lambda: 42) @@ -103,7 +103,7 @@ def test_valid(self): self.assertFalse(c0_sv6 is c0_sv7) def test_base(self): - p = ManualParameter('p') + p = Parameter('p', get_cmd=None, set_cmd=None) with self.assertRaises(NotImplementedError): iter(SweepValues(p)) From bb6073c81669ff21b83e6d10b6e666ea2e98b660 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 16:10:44 +0200 Subject: [PATCH 09/22] cleanup test_parameter --- qcodes/tests/test_parameter.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qcodes/tests/test_parameter.py b/qcodes/tests/test_parameter.py index 0eb426e528d..c4a82371e55 100644 --- a/qcodes/tests/test_parameter.py +++ b/qcodes/tests/test_parameter.py @@ -8,7 +8,7 @@ from qcodes import Function from qcodes.instrument.parameter import ( Parameter, ArrayParameter, MultiParameter, - StandardParameter, InstrumentRefParameter) + InstrumentRefParameter) import qcodes.utils.validators as vals from qcodes.tests.instrument_mocks import DummyInstrument @@ -65,7 +65,7 @@ def test_default_attributes(self): self.assertEqual(p.name, name) self.assertEqual(p.label, name) self.assertEqual(p.unit, '') - self.assertEqual(p.full_name, name) + self.assertEqual(str(p), name) # default validator is all numbers p.validate(-1000) @@ -103,7 +103,7 @@ def test_explicit_attributes(self): self.assertEqual(p.name, name) self.assertEqual(p.label, label) self.assertEqual(p.unit, unit) - self.assertEqual(p.full_name, name) + self.assertEqual(str(p), name) with self.assertRaises(ValueError): p.validate(-1000) @@ -256,7 +256,7 @@ def test_default_attributes(self): self.assertIsNone(p.setpoint_names) self.assertIsNone(p.setpoint_labels) - self.assertEqual(p.full_name, name) + self.assertEqual(str(p), name) self.assertEqual(p._get_count, 0) snap = p.snapshot(update=True) @@ -333,12 +333,12 @@ def test_full_name(self): for instrument in blank_instruments: p = SimpleArrayParam([6, 7], 'fred', (2,)) p._instrument = instrument - self.assertEqual(p.full_name, 'fred') + self.assertEqual(str(p), 'fred') # and finally an instrument that really has a name p = SimpleArrayParam([6, 7], 'wilma', (2,)) p._instrument = named_instrument - self.assertEqual(p.full_name, 'astro_wilma') + self.assertEqual(str(p), 'astro_wilma') def test_constructor_errors(self): bad_constructors = [ @@ -392,7 +392,7 @@ def test_default_attributes(self): self.assertIsNone(p.setpoint_names) self.assertIsNone(p.setpoint_labels) - self.assertEqual(p.full_name, name) + self.assertEqual(str(p), name) self.assertEqual(p._get_count, 0) snap = p.snapshot(update=True) @@ -488,7 +488,7 @@ def test_full_name_s(self): p = SimpleMultiParam([0, [1, 2, 3], [[4, 5], [6, 7]]], name, names, shapes) p._instrument = instrument - self.assertEqual(p.full_name, name) + self.assertEqual(str(p), name) self.assertEqual(p.full_names, names) @@ -496,7 +496,7 @@ def test_full_name_s(self): p = SimpleMultiParam([0, [1, 2, 3], [[4, 5], [6, 7]]], name, names, shapes) p._instrument = named_instrument - self.assertEqual(p.full_name, 'astro_mixed_dimensions') + self.assertEqual(str(p), 'astro_mixed_dimensions') self.assertEqual(p.full_names, ['astro_0D', 'astro_1D', 'astro_2D']) @@ -551,7 +551,7 @@ def parse_set_p(self, val): return '{:d}'.format(val) def test_param_cmd_with_parsing(self): - p = StandardParameter('p_int', get_cmd=self.get_p, get_parser=int, + p = Parameter('p_int', get_cmd=self.get_p, get_parser=int, set_cmd=self.set_p, set_parser=self.parse_set_p) p(5) From b6a80e715598acc598cc3d6ddc08190513e8bdf6 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 3 Oct 2017 16:13:23 +0200 Subject: [PATCH 10/22] cleanup test_sweep_values --- qcodes/tests/test_sweep_values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcodes/tests/test_sweep_values.py b/qcodes/tests/test_sweep_values.py index c324fa1e11a..1e29bd6c6f0 100644 --- a/qcodes/tests/test_sweep_values.py +++ b/qcodes/tests/test_sweep_values.py @@ -1,5 +1,5 @@ from unittest import TestCase -from qcodes.instrument.parameter import StandardParameter, Parameter +from qcodes.instrument.parameter import Parameter from qcodes.instrument.sweep_values import SweepValues from qcodes.utils.validators import Numbers @@ -10,7 +10,7 @@ def setUp(self): self.c0 = Parameter('c0', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) self.c1 = Parameter('c1', get_cmd=None, set_cmd=None) - self.getter = StandardParameter('c2', get_cmd=lambda: 42) + self.getter = Parameter('c2', get_cmd=lambda: 42) def test_errors(self): c0 = self.c0 From 905654e19b3714615710449419fde4f1cd1a2d94 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 4 Oct 2017 16:38:22 +0200 Subject: [PATCH 11/22] Ithaco ManualParameter to Parameter --- qcodes/instrument_drivers/ithaco/Ithaco_1211.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qcodes/instrument_drivers/ithaco/Ithaco_1211.py b/qcodes/instrument_drivers/ithaco/Ithaco_1211.py index e7bae5cedd3..25812b01e6e 100644 --- a/qcodes/instrument_drivers/ithaco/Ithaco_1211.py +++ b/qcodes/instrument_drivers/ithaco/Ithaco_1211.py @@ -1,6 +1,5 @@ from qcodes import Instrument from qcodes.instrument.parameter import MultiParameter -from qcodes.instrument.parameter import ManualParameter from qcodes.utils.validators import Enum, Bool @@ -65,39 +64,39 @@ def __init__(self, name, **kwargs): super().__init__(name, **kwargs) self.add_parameter('sens', - parameter_class=ManualParameter, initial_value=1e-8, label='Sensitivity', unit='A/V', + get_cmd=None, set_cmd=None, vals=Enum(1e-11, 1e-10, 1e-09, 1e-08, 1e-07, 1e-06, 1e-05, 1e-4, 1e-3)) self.add_parameter('invert', - parameter_class=ManualParameter, initial_value=True, label='Inverted output', + get_cmd=None, set_cmd=None, vals=Bool()) self.add_parameter('sens_factor', - parameter_class=ManualParameter, initial_value=1, label='Sensitivity factor', unit=None, + get_cmd=None, set_cmd=None, vals=Enum(0.1, 1, 10)) self.add_parameter('suppression', - parameter_class=ManualParameter, initial_value=1e-7, label='Suppression', unit='A', + get_cmd=None, set_cmd=None, vals=Enum(1e-10, 1e-09, 1e-08, 1e-07, 1e-06, 1e-05, 1e-4, 1e-3)) self.add_parameter('risetime', - parameter_class=ManualParameter, initial_value=0.3, label='Rise Time', unit='msec', + get_cmd=None, set_cmd=None, vals=Enum(0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100, 300, 1000)) From 4a50e634efbdc5817b457902a167e0f002e11701 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 4 Oct 2017 16:46:56 +0200 Subject: [PATCH 12/22] QDAC to Parameter --- qcodes/instrument_drivers/QDev/QDac.py | 7 +++---- qcodes/instrument_drivers/QDev/QDac_channels.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/qcodes/instrument_drivers/QDev/QDac.py b/qcodes/instrument_drivers/QDev/QDac.py index de07e143f20..303fcfa52fa 100644 --- a/qcodes/instrument_drivers/QDev/QDac.py +++ b/qcodes/instrument_drivers/QDev/QDac.py @@ -10,7 +10,6 @@ from operator import xor from collections import OrderedDict -from qcodes.instrument.parameter import ManualParameter from qcodes.instrument.visa import VisaInstrument from qcodes.utils import validators as vals @@ -129,13 +128,13 @@ def __init__(self, name, address, num_chans=48, update_currents=True): self.add_parameter(name='ch{:02}_sync_delay'.format(i), label='Channel {} sync pulse delay'.format(i), unit='s', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0) self.add_parameter(name='ch{:02}_sync_duration'.format(i), label='Channel {} sync pulse duration'.format(i), unit='s', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0.01) for board in range(6): @@ -158,7 +157,7 @@ def __init__(self, name, address, num_chans=48, update_currents=True): self.add_parameter(name='fast_voltage_set', label='fast voltage set', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Bool(), initial_value=False, docstring=""""Toggles if DC voltage set should unset any ramp attached to this channel. diff --git a/qcodes/instrument_drivers/QDev/QDac_channels.py b/qcodes/instrument_drivers/QDev/QDac_channels.py index aec6ce74f40..2a1e406517c 100644 --- a/qcodes/instrument_drivers/QDev/QDac_channels.py +++ b/qcodes/instrument_drivers/QDev/QDac_channels.py @@ -12,7 +12,6 @@ from qcodes.instrument.channel import InstrumentChannel, ChannelList from qcodes.instrument.channel import MultiChannelInstrumentParameter -from qcodes.instrument.parameter import ManualParameter from qcodes.instrument.visa import VisaInstrument from qcodes.utils import validators as vals @@ -93,14 +92,14 @@ def __init__(self, parent, name, channum): self.add_parameter(name='sync_delay', label='Channel {} sync pulse delay'.format(channum), unit='s', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0 ) self.add_parameter(name='sync_duration', label='Channel {} sync pulse duration'.format(channum), unit='s', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0.01 ) @@ -246,7 +245,7 @@ def __init__(self, name, address, num_chans=48, update_currents=True): self.add_parameter(name='fast_voltage_set', label='fast voltage set', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Bool(), initial_value=False, docstring=""""Deprecated with no functionality""") From 2af02cb454721ecd472be2928690a3359c9aa445 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 4 Oct 2017 16:47:37 +0200 Subject: [PATCH 13/22] IVVI to parameter --- qcodes/instrument_drivers/QuTech/IVVI.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qcodes/instrument_drivers/QuTech/IVVI.py b/qcodes/instrument_drivers/QuTech/IVVI.py index 39d3b455e83..24738a1f969 100644 --- a/qcodes/instrument_drivers/QuTech/IVVI.py +++ b/qcodes/instrument_drivers/QuTech/IVVI.py @@ -6,7 +6,6 @@ import threading from qcodes import VisaInstrument, validators as vals -from qcodes.instrument.parameter import ManualParameter from qcodes.utils.validators import Bool, Numbers @@ -80,7 +79,7 @@ def __init__(self, name, address, reset=False, numdacs=16, dac_step=10, get_cmd=self._get_version) self.add_parameter('check_setpoints', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=False, label='Check setpoints', vals=Bool(), @@ -90,7 +89,7 @@ def __init__(self, name, address, reset=False, numdacs=16, dac_step=10, # Time to wait before sending a set DAC command to the IVVI self.add_parameter('dac_set_sleep', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0.05, label='DAC set sleep', unit='s', @@ -102,7 +101,7 @@ def __init__(self, name, address, reset=False, numdacs=16, dac_step=10, # Minimum time to wait before the read buffer contains data self.add_parameter('dac_read_buffer_sleep', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=0.025, label='DAC read buffer sleep', unit='s', From 36e23158ad87baf1dfb2bb7ff07ba96ffb1e886d Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:06:19 +0200 Subject: [PATCH 14/22] stanford -> Parameter --- qcodes/instrument_drivers/stanford_research/SIM928.py | 5 ++--- qcodes/instrument_drivers/stanford_research/SR560.py | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/qcodes/instrument_drivers/stanford_research/SIM928.py b/qcodes/instrument_drivers/stanford_research/SIM928.py index 1eb79100dae..ce8edb308b7 100644 --- a/qcodes/instrument_drivers/stanford_research/SIM928.py +++ b/qcodes/instrument_drivers/stanford_research/SIM928.py @@ -3,7 +3,6 @@ import numpy as np import time -from qcodes.instrument.parameter import ManualParameter from qcodes.instrument.visa import VisaInstrument from qcodes.utils import validators as vals @@ -60,12 +59,12 @@ def __init__(self, name, address, slot_names=None, **kw): label="Step size when changing the voltage " "smoothly on module " "{}".format(module_name), - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers(0, 20), initial_value=0.005) self.add_parameter('smooth_timestep', unit='s', label="Delay between sending the write commands" "when changing the voltage smoothly", - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers(0, 1), initial_value=0.05) super().connect_message() diff --git a/qcodes/instrument_drivers/stanford_research/SR560.py b/qcodes/instrument_drivers/stanford_research/SR560.py index c4a5a139a6e..317e50d9c52 100644 --- a/qcodes/instrument_drivers/stanford_research/SR560.py +++ b/qcodes/instrument_drivers/stanford_research/SR560.py @@ -1,5 +1,4 @@ from qcodes import Instrument -from qcodes.instrument.parameter import ManualParameter from qcodes.instrument.parameter import MultiParameter from qcodes.utils.validators import Bool, Enum @@ -83,27 +82,27 @@ def __init__(self, name, **kwargs): 10000, 20000, 50000] self.add_parameter('cutoff_lo', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value='DC', label='High pass', unit='Hz', vals=Enum(*cutoffs)) self.add_parameter('cutoff_hi', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=1e6, label='Low pass', unit='Hz', vals=Enum(*cutoffs)) self.add_parameter('invert', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=True, label='Inverted output', vals=Bool()) self.add_parameter('gain', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=10, label='Gain', unit=None, From a0de53e5ef00e4438decba106d76ddb280374923 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:08:17 +0200 Subject: [PATCH 15/22] Mercury to Parameter --- qcodes/instrument_drivers/oxford/mercuryiPS.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcodes/instrument_drivers/oxford/mercuryiPS.py b/qcodes/instrument_drivers/oxford/mercuryiPS.py index 0be32a943b2..c86cc4b0951 100644 --- a/qcodes/instrument_drivers/oxford/mercuryiPS.py +++ b/qcodes/instrument_drivers/oxford/mercuryiPS.py @@ -3,7 +3,7 @@ import time import numpy as np -from qcodes import IPInstrument, MultiParameter, ManualParameter +from qcodes import IPInstrument, MultiParameter from qcodes.utils.validators import Enum, Bool class MercuryiPSArray(MultiParameter): @@ -80,7 +80,7 @@ def __init__(self, name, address=None, port=7020, axes=None, **kwargs): self.add_parameter('hold_after_set', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=Bool(), initial_value=False, docstring='Should the driver block while waiting for the Magnet power supply ' From e4da3d590e7c8688197b6088dd20197b6d3f8452 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:09:39 +0200 Subject: [PATCH 16/22] ZI -> Parameter --- qcodes/instrument_drivers/ZI/ZIUHFLI.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qcodes/instrument_drivers/ZI/ZIUHFLI.py b/qcodes/instrument_drivers/ZI/ZIUHFLI.py index a5e75cbbd31..4f58ca85749 100644 --- a/qcodes/instrument_drivers/ZI/ZIUHFLI.py +++ b/qcodes/instrument_drivers/ZI/ZIUHFLI.py @@ -10,7 +10,6 @@ download and installation instructions. ''') -from qcodes.instrument.parameter import ManualParameter from qcodes.instrument.parameter import MultiParameter from qcodes.instrument.base import Instrument from qcodes.utils import validators as vals @@ -796,7 +795,7 @@ def __init__(self, name, device_ID, **kwargs): unit='V') self.add_parameter('signal_output{}_ampdef'.format(sigout), - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value='Vpk', label="Signal output amplitude's definition", unit='V', @@ -1084,7 +1083,7 @@ def __init__(self, name, device_ID, **kwargs): label='Sweep timeout', unit='s', initial_value=600, - parameter_class=ManualParameter) + get_cmd=None, set_cmd=None) ######################################## # THE SWEEP ITSELF From 52a3f55ebde5b5b21b7bc7bd54327ea6c67531fe Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:11:44 +0200 Subject: [PATCH 17/22] Signalhound to Parameter --- .../signal_hound/USB_SA124B.py | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/qcodes/instrument_drivers/signal_hound/USB_SA124B.py b/qcodes/instrument_drivers/signal_hound/USB_SA124B.py index fe42a252211..2a9fb718ba1 100644 --- a/qcodes/instrument_drivers/signal_hound/USB_SA124B.py +++ b/qcodes/instrument_drivers/signal_hound/USB_SA124B.py @@ -4,7 +4,6 @@ import logging from qcodes import Instrument, validators as vals -from qcodes.instrument.parameter import ManualParameter class SignalHound_USB_SA124B(Instrument): @@ -68,28 +67,28 @@ def __init__(self, name, dll_path=None, **kwargs): label='Frequency ', unit='Hz', initial_value=5e9, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers()) self.add_parameter('span', label='Span ', unit='Hz', initial_value=.25e6, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers()) self.add_parameter('power', label='Power ', unit='dBm', initial_value=0, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers(max_value=20)) self.add_parameter('ref_lvl', label='Reference power ', unit='dBm', initial_value=0, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers(max_value=20)) self.add_parameter('external_reference', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=False, vals=vals.Bool()) self.add_parameter('device_type', @@ -97,37 +96,37 @@ def __init__(self, name, dll_path=None, **kwargs): self.add_parameter('device_mode', initial_value='sweeping', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Anything()) self.add_parameter('acquisition_mode', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value='average', vals=vals.Enum('average', 'min-max')) self.add_parameter('scale', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value='log-scale', vals=vals.Enum('log-scale', 'lin-scale', 'log-full-scale', 'lin-full-scale')) self.add_parameter('running', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=False, vals=vals.Bool()) self.add_parameter('decimation', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=1, vals=vals.Ints(1, 8)) self.add_parameter('bandwidth', label='Bandwidth', unit='Hz', initial_value=0, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers()) # rbw Resolution bandwidth in Hz. RBW can be arbitrary. self.add_parameter('rbw', label='Resolution Bandwidth', unit='Hz', initial_value=1e3, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers()) # vbw Video bandwidth in Hz. VBW must be less than or equal to RBW. # VBW can be arbitrary. For best performance use RBW as the VBW. @@ -135,7 +134,7 @@ def __init__(self, name, dll_path=None, **kwargs): label='Video Bandwidth', unit='Hz', initial_value=1e3, - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, vals=vals.Numbers()) self.openDevice() From 677436c3d1646f2efa29bb2acb3a21fd8c458773 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:12:22 +0200 Subject: [PATCH 18/22] M4i to Parameter --- qcodes/instrument_drivers/Spectrum/M4i.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qcodes/instrument_drivers/Spectrum/M4i.py b/qcodes/instrument_drivers/Spectrum/M4i.py index 79fe172f8f6..16523de1db4 100644 --- a/qcodes/instrument_drivers/Spectrum/M4i.py +++ b/qcodes/instrument_drivers/Spectrum/M4i.py @@ -17,7 +17,6 @@ from functools import partial from qcodes.utils.validators import Enum, Numbers, Anything from qcodes.instrument.base import Instrument -from qcodes.instrument.parameter import ManualParameter try: import pyspcm except ImportError: @@ -83,7 +82,7 @@ def __init__(self, name, cardid='spcm0', **kwargs): # add parameters for getting self.add_parameter('card_id', label='card id', - parameter_class=ManualParameter, + get_cmd=None, set_cmd=None, initial_value=cardid, vals=Anything(), docstring='The card ID') From 3f63b69496a63b95bff3c8584b1f98d4b5c61d48 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:13:11 +0200 Subject: [PATCH 19/22] decadac to Parameter --- qcodes/instrument_drivers/Harvard/Decadac.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qcodes/instrument_drivers/Harvard/Decadac.py b/qcodes/instrument_drivers/Harvard/Decadac.py index cdc216a939b..2d031e43914 100644 --- a/qcodes/instrument_drivers/Harvard/Decadac.py +++ b/qcodes/instrument_drivers/Harvard/Decadac.py @@ -1,6 +1,6 @@ from time import time from functools import partial -from qcodes import VisaInstrument, InstrumentChannel, ChannelList, ManualParameter +from qcodes import VisaInstrument, InstrumentChannel, ChannelList from qcodes.utils import validators as vals @@ -199,9 +199,9 @@ def __init__(self, parent, name, channel, min_val=-5, max_val=5): # Manual parameters to control whether DAC channels should ramp to voltages or jump self._ramp_val = vals.Numbers(0, 10) - self.add_parameter("enable_ramp", parameter_class=ManualParameter, initial_value=False, + self.add_parameter("enable_ramp", get_cmd=None, set_cmd=None, initial_value=False, vals=vals.Bool()) - self.add_parameter("ramp_rate", parameter_class=ManualParameter, initial_value=0.1, + self.add_parameter("ramp_rate", get_cmd=None, set_cmd=None, initial_value=0.1, vals=self._ramp_val, unit="V/s") # Add ramp function to the list of functions From f2bcf36c484cb1c310a65e2f67a0581727a90bb9 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:14:50 +0200 Subject: [PATCH 20/22] IVVI StandardParameter to Parameter --- qcodes/instrument_drivers/QuTech/IVVI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcodes/instrument_drivers/QuTech/IVVI.py b/qcodes/instrument_drivers/QuTech/IVVI.py index 24738a1f969..9b216718bc8 100644 --- a/qcodes/instrument_drivers/QuTech/IVVI.py +++ b/qcodes/instrument_drivers/QuTech/IVVI.py @@ -510,7 +510,7 @@ def adjust_parameter_validator(self, param): function prevents that. Args: - param (StandardParameter): a dac of the IVVI instrument + param (Parameter): a dac of the IVVI instrument """ if not isinstance(param._vals, Numbers): raise Exception('Only the Numbers validator is supported.') From 28aa7e5f7e88e74db5e05c0f2ba32c1ffce9a8f9 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 09:15:13 +0200 Subject: [PATCH 21/22] devicesices standardparameter to parameter --- qcodes/instrument_drivers/devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcodes/instrument_drivers/devices.py b/qcodes/instrument_drivers/devices.py index ff8f32da126..e255120569b 100644 --- a/qcodes/instrument_drivers/devices.py +++ b/qcodes/instrument_drivers/devices.py @@ -1,6 +1,6 @@ from typing import Union -from qcodes import Parameter, StandardParameter, Instrument +from qcodes import Parameter, Instrument class VoltageDivider(Parameter): @@ -44,7 +44,7 @@ class VoltageDivider(Parameter): """ def __init__(self, - v1: StandardParameter, + v1: Parameter, division_value: Union[int, float], name: str=None, label: str=None, From 35d51c5a2a6d37c089039a92277419a3387b83ec Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 5 Oct 2017 10:40:53 +0200 Subject: [PATCH 22/22] Revert deprecation of full_parameter The current dataset needs it --- qcodes/instrument/parameter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qcodes/instrument/parameter.py b/qcodes/instrument/parameter.py index 8d4fe186a05..f45dd300ef4 100644 --- a/qcodes/instrument/parameter.py +++ b/qcodes/instrument/parameter.py @@ -514,8 +514,11 @@ def inter_delay(self, inter_delay): # Deprecated @property def full_name(self): - warnings.warn('Attribute `full_name` is deprecated, please use ' - 'str(parameter)') +# This can fully be replaced by str(parameter) in the future we +# may want to deprecate this but the current dataset makes heavy use +# of it in more complicated ways so keep it for now. +# warnings.warn('Attribute `full_name` is deprecated, please use ' +# 'str(parameter)') return str(self) def set_validator(self, vals):