-
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
Rigol dg1062 #1082
Rigol dg1062 #1082
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1082 +/- ##
==========================================
- Coverage 79.78% 79.77% -0.01%
==========================================
Files 48 48
Lines 6657 6664 +7
==========================================
+ Hits 5311 5316 +5
- Misses 1346 1348 +2 |
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.
Left a few minor inline comments but looks fine otherwise
super().__init__(name, address, terminator="\n", **kwargs) | ||
|
||
channels = ChannelList(self, "channel", DG1062Channel, | ||
snapshotable=True) |
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.
You may want to set this false? I think as it is the channels will be in the snapshot twice
|
||
super().__init__(parent, name) | ||
|
||
self.parent = parent |
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 looks redundant to me. I would prefer to add a parent property to the baseclass. We should have done that a long time ago to not have to call _parent
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.
Of course, you can remove line 29.
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.
Right now it seems we do need both lines. Line 27 does not automatically add parent to self.
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.
It adds it but only as _parent which IMHO is a bug in the Channel class. There should be a non private way to get the parent so I would add a parent property to the Channel clase
@property
def parent(self):
return self.parent
Note that we already have a root instrument property. Perhaps we can use that here
|
||
Example: | ||
>>> gd = DG1062("gd", "TCPIP0::169.254.187.99::inst0::INSTR") | ||
>>> gd.channels[0].apply(waveform="SIN", freq=1E3, ampl=1.0, offset=0, phase=0) |
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.
Is there a good way to know the valid arguments. Perhaps even just a ref to the relevant page in a manual
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.
The valid arguments depend on the waveform, which makes this a bit tricky. If you give wrong arguments I raise a ValueError and list the arguments expected. See the example notebook.
Perhaps I can build an alternate interface which looks something like:
gd.channel[0].apply.sin(freq, ampl, offset, phase)
The advantage of that is that we can then have proper doc strings which the user can refer to.
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.
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.
sweet!
… driver/rigol_dg_1062_feature_add
Added sync param
…/rigol_dg_1062_feature_add
…ough the help built-in 2) Made an acceptable example notebook
…/rigol_dg_1062_feature_add
@jenshnielsen can you have another look at this, please? |
log = logging.getLogger(__name__) | ||
|
||
|
||
def sane_partial(func, docstring, **kwargs): |
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.
shall this reside in "helpers" somewhere?
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.
Yeah that could be helpful. Where exactly would you propose to put this?
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.
qcodes/utils/helpers.py
should be an OK place. Although that file is already huge...
self.add_parameter( | ||
"polarity", | ||
get_cmd=f":SOUR{channel}:BURS:GATE:POL?", | ||
set_cmd=f":SOUR{channel}:BURS:GATE:POL {{}}", |
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.
just for my understanding, why are double brackets needed here?
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.
https://www.python.org/dev/peps/pep-0498/#specification
f"{{}}"
gives you "{}"
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.
that i know, just haven't seen visa commands which contain brackets for the values ;)
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.
Nor do you see that here, it's a string to be formatted later by Command
. See https://github.com/QCoDeS/Qcodes/blob/master/qcodes/utils/command.py
So here we want to have set_cmd=":SOUR1:BURS:GATE:POL {}"
etc.
|
||
def trigger(self) ->None: | ||
""" | ||
Send a soft trigger to the instrument. This only works if the trigger |
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.
"soft" means "from software"/"from the driver"?
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.
Yes. I will make this more clear
qcodes/utils/helpers.py
Outdated
@@ -581,3 +582,32 @@ def attribute_set_to(object_: Any, attribute_name: str, new_value: Any): | |||
setattr(object_, attribute_name, new_value) | |||
yield | |||
setattr(object_, attribute_name, old_value) | |||
|
|||
|
|||
def sane_partial(func, docstring, **kwargs): |
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.
Could you give this a more descriptive name. Sane_partial tells very little about why this is more sane
@sohailc Looks good but I think we should find a better name for sane_partial |
|
Ok, I will change it to |
A driver for the Rigol DG1062