Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeprecate ManualParameter and more parameter changes #802

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qcodes/instrument/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ def __init__(self,
self._channels = channels
self._param_name = param_name

def get(self) -> tuple:
def get_raw(self) -> tuple:
"""
Return a tuple containing the data from each of the channels in the
list
"""
return tuple(chan.parameters[self._param_name].get() for chan
in self._channels)

def set(self, value):
def set_raw(self, value):
"""
Set all parameters to this value

Expand Down
7 changes: 5 additions & 2 deletions qcodes/instrument/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,11 @@ def __init__(self, name, instrument=None,

class ManualParameter(Parameter):
def __init__(self, name, instrument=None, initial_value=None, **kwargs):
"""
A simple alias for a parameter that does not have a set or
a get function. Useful for parameters that do not have a direct
instrument mapping.
"""
super().__init__(name=name, instrument=instrument,
get_cmd=None, set_cmd=None,
initial_value=initial_value, **kwargs)
warnings.warn('Parameter {}: `ManualParameter` is deprecated, use '
'`Parameter` instead with `set_cmd=None`.'.format(self))
4 changes: 2 additions & 2 deletions qcodes/instrument_drivers/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def __init__(self,
# extend metadata
self._meta_attrs.extend(["division_value"])

def set(self, value: Union[int, float]) -> None:
def set_raw(self, value: Union[int, float]) -> None:
instrument_value = value * self.division_value
self._save_val(value)
self.v1.set(instrument_value)

def get(self) -> Union[int, float]:
def get_raw(self) -> Union[int, float]:
"""
Returns:
number: value at which was set at the sample
Expand Down
6 changes: 3 additions & 3 deletions qcodes/tests/instrument_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __init__(self, **kwargs):
shapes = tuple(np.shape(v) for v in self._return)
super().__init__(name='multigetter', names=names, shapes=shapes)

def get(self):
def get_raw(self):
return self._return


Expand Down Expand Up @@ -201,7 +201,7 @@ def __init__(self, instrument=None, name='testparameter'):
setpoint_names=setpoint_names,
setpoint_units=setpoint_units)

def get(self):
def get_raw(self):
items = (np.zeros(5), np.ones(5))
self._save_val(items)
return items
Expand Down Expand Up @@ -231,7 +231,7 @@ def __init__(self, instrument=None, name='testparameter'):
setpoint_names=setpoint_names,
setpoint_units=setpoint_units)

def get(self):
def get_raw(self):
item = np.ones(5) + 1
self._save_val(item)
return item
2 changes: 1 addition & 1 deletion qcodes/tests/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def __init__(self, *args, count=1, msg=None, **kwargs):
# also need a _signal_queue, but that has to be added later
super().__init__(*args, **kwargs)

def get(self):
def get_raw(self):
self._count -= 1
if self._count <= 0:
raise _QcodesBreak
Expand Down
10 changes: 5 additions & 5 deletions qcodes/tests/test_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._get_count = 0

def get(self):
def get_raw(self):
self._get_count += 1
self._save_val(42)
return 42
Expand Down Expand Up @@ -287,15 +287,15 @@ def __init__(self, return_val, *args, **kwargs):
self._get_count = 0
super().__init__(*args, **kwargs)

def get(self):
def get_raw(self):
self._get_count += 1
self._save_val(self._return_val)
return self._return_val


class SettableArray(SimpleArrayParam):
# this is not allowed - just created to raise an error in the test below
def set(self, v):
def set_raw(self, v):
self.v = v


Expand Down Expand Up @@ -418,7 +418,7 @@ def __init__(self, return_val, *args, **kwargs):
self._get_count = 0
super().__init__(*args, **kwargs)

def get(self):
def get_raw(self):
self._get_count += 1
self._save_val(self._return_val)
return self._return_val
Expand All @@ -427,7 +427,7 @@ def get(self):
class SettableMulti(SimpleMultiParam):
# this is not fully suported - just created to raise a warning in the test below.
# We test that the warning is raised
def set(self, v):
def set_raw(self, v):
print("Calling set")
self.v = v

Expand Down