Skip to content

Commit

Permalink
Fix parameter warnings (#776)
Browse files Browse the repository at this point in the history
* Instrument mocks ManualParameter to parameter

* channels ManualParameter -> Parameter

* test_combined_loop ManualParamer to Parameter

* test_instrument ManualParameter to Parameter

* test_loop ManualParameter to Parameter

* test_measure ManualParameter to Parameter

* test_parameter ManualParamer to Parameter

* test_sweep_values ManualParameter to Parameter

* cleanup test_parameter

* cleanup test_sweep_values

* Ithaco ManualParameter to Parameter

* QDAC to Parameter

* IVVI to parameter

* stanford -> Parameter

* Mercury to Parameter

* ZI -> Parameter

* Signalhound to Parameter

* M4i to Parameter

* decadac to Parameter

* IVVI StandardParameter to Parameter

* devicesices standardparameter to parameter

* Revert deprecation of full_parameter

The current dataset needs it
  • Loading branch information
jenshnielsen authored and WilliamHPNielsen committed Oct 5, 2017
1 parent 01a75a1 commit 8033c88
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 110 deletions.
7 changes: 5 additions & 2 deletions qcodes/instrument/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions qcodes/instrument_drivers/Harvard/Decadac.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions qcodes/instrument_drivers/QDev/QDac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand All @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions qcodes/instrument_drivers/QDev/QDac_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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""")
Expand Down
9 changes: 4 additions & 5 deletions qcodes/instrument_drivers/QuTech/IVVI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(),
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -511,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.')
Expand Down
3 changes: 1 addition & 2 deletions qcodes/instrument_drivers/Spectrum/M4i.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 2 additions & 3 deletions qcodes/instrument_drivers/ZI/ZIUHFLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions qcodes/instrument_drivers/devices.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Union

from qcodes import Parameter, StandardParameter, Instrument
from qcodes import Parameter, Instrument


class VoltageDivider(Parameter):
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions qcodes/instrument_drivers/ithaco/Ithaco_1211.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions qcodes/instrument_drivers/oxford/mercuryiPS.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 '
Expand Down
27 changes: 13 additions & 14 deletions qcodes/instrument_drivers/signal_hound/USB_SA124B.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging

from qcodes import Instrument, validators as vals
from qcodes.instrument.parameter import ManualParameter


class SignalHound_USB_SA124B(Instrument):
Expand Down Expand Up @@ -68,74 +67,74 @@ 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',
get_cmd=self._do_get_device_type)

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.
self.add_parameter('vbw',
label='Video Bandwidth',
unit='Hz',
initial_value=1e3,
parameter_class=ManualParameter,
get_cmd=None, set_cmd=None,
vals=vals.Numbers())

self.openDevice()
Expand Down
5 changes: 2 additions & 3 deletions qcodes/instrument_drivers/stanford_research/SIM928.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down
Loading

0 comments on commit 8033c88

Please sign in to comment.