-
Notifications
You must be signed in to change notification settings - Fork 301
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
feature: Add voltage divider device #492
Conversation
qcodes/instrument_drivers/devices.py
Outdated
""" | ||
Returns: | ||
number: value at which the attached paraemter is (i.e. does not | ||
account for the scaling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should un-indent to the level of number to render correctly
qcodes/instrument_drivers/devices.py
Outdated
""" | ||
Resitive voltage divider | ||
|
||
To be used when you use a voltage divider to measure a parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you measuring the parameter. The example sounds more like you are setting an output?
Output of dac is X -> Voltage divider -> x/10 to actual Experiment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine like this, you can also get values.
@QCoDeS/core moar opinions, else I will just merge and let people try ? |
👍 examples of using it both in input and output would probably make it more clear how it works but that can wait |
Just want to throw two things in here: Maybe its more general then adding devices for all kinds of conversions...? |
I think it makes sense to move the VoltageParameter and also the CurrentParameter from https://github.com/QCoDeS/Qcodes/blob/master/qcodes/instrument_drivers/ithaco/Ithaco_1211.py#L7 here to this location they dont really seem to belong in a specific instrument driver |
@jenshnielsen doc wise, I am not sure I understand. there are both sets and gets in the examples :D |
|
||
def set(self, value: Union[int, float]) -> None: | ||
instrument_value = value * self.division_value | ||
self._save_val(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if instrument does not have a set function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it's going to raise an exception :D as expected :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about setting the parameter's has_set to equal that of the original parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a = MockParabola("yolo")
attn_dac0 = qc.VoltageDivider(a.parabola, 10, "combained", "atteunauted dac")
the error:
>>> attn_dac0(0)
/src/Qcodes/qcodes/instrument/parameter.py in no_setter(*args, **kwargs)
676
677 def no_setter(*args, **kwargs):
--> 678 raise NotImplementedError('This Parameter has no setter defined.')
NotImplementedError: ('This Parameter has no setter defined.', 'setting yolo_parabola to 0')
The difference why using has_set is that one gets the real error i.e. that the underlying parameter has no set :D
Does that make sense ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that would give a clearer error message
6cc453e
to
c2e03fd
Compare
@jenshnielsen more feedback, I would merge other wise :D |
IMHO the current documentation is still not very clear in the distinction between using it as an input or output device. I had to read it several times to understand how it was ment to be used in the two modes and what refers to what but perhaps it's more clear to others. Otherwise 👍 |
6501616
to
2bfab47
Compare
2bfab47
to
35b7dc7
Compare
Author: Giulio Ungaretti <giulio.ungaretti@gmail.com> feature: Add voltage divider device (#492)
Author: Giulio Ungaretti <giulio.ungaretti@gmail.com> feature: Add voltage divider device (#492)
Author: Giulio Ungaretti <giulio.ungaretti@gmail.com> feature: Add voltage divider device (#492)
* feature: Add voltage divider device * fix: Rst polish and save metadata * fix: Save value also when getting * docs: Better docstring
No description provided.