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

Driver/buffered sr830 #653

Merged
merged 9 commits into from
Jun 22, 2017

Conversation

WilliamHPNielsen
Copy link
Contributor

Fixes the fact one can not do buffered acquisition

Changes proposed in this pull request:

  • Add two array parameters representing the internal data buffer

@jenshnielsen

The instrument natively supports this in its TRCL call.
"""

def __init__(self, name, instrument, channel):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that we start moving the typos from the docstring into type annotations. I.e.

def __init__(self, name: srt, instrument: SR830, channel: int):

and so on.

It's imho fine to leave the types in the doc strings too if you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we get rid of all typos altogether! 😉

I totally agree with regard to the types.

channel (int): The relevant channel (1 or 2). The name should
should match this.
"""
if channel not in [1, 2]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this an parameter and probably a tuple i.e. self._valid_channels = (1,2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Seems like better practice.

self.setpoints = (tuple(np.linspace(0, N*dt, N)),)

params = self._instrument.parameters
# YES, it should be: "is not 'none'" NOT "is not None"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why you cant change it to None in the mapping dicts around l 467?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think conceptually there is a difference; the 'none' is the proper response string from the instrument. I would expect the python None to mean that the value doesn't exist, whereas 'none' in this case rather means OFF than "not defined" or "not present".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, perhaps we could avoid the confusion by calling it one of those names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'none' is what the manual calls it, but I'm fine with 'off' or even 'identity'.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any strong opinion. It's probably better to match the manual then

vals=Strings())
self.add_parameter('ch{}_databuffer'.format(ch),
channel=ch,
parameter_class=ChannelBuffer)

# Data transfer
self.add_parameter('X',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do these work, Do they always return from a specific channel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The internal buffer is filled simultaneously for both channels, which is why there is only one buffer_SR etc., but polling is done from either of the two (but not both).

The instrument natively supports this in its TRCL call.
"""

def __init__(self, name: str, instrument: SR830, channel: int):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to do quote i.e. do 'SR830' as a forward declaration because it's defined below the ChannelBuffer and not available when the class is defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check.

@jenshnielsen jenshnielsen merged commit 69434d3 into microsoft:master Jun 22, 2017
@WilliamHPNielsen WilliamHPNielsen deleted the driver/buffered_SR830 branch June 22, 2017 08:24
giulioungaretti pushed a commit that referenced this pull request Jun 22, 2017
Author: William H.P. Nielsen <whpn@mailbox.org>

    Driver/buffered sr830 (#653)
Dominik-Vogel pushed a commit to Dominik-Vogel/Qcodes that referenced this pull request Aug 9, 2017
* fix: miniscule beauty fixes

* feat: add buffer control parameters to driver

* feat: Finish addition of data buffer

Add a data buffer parameter to the SR830 driver class

* fix: handle setpoint booleans correctly

* docs: add example notebook for SR830

* fix: Respond to code review

* fix: add proper forward reference

* fix: remove accidental blank line
peendebak pushed a commit to VandersypenQutech/Qcodes that referenced this pull request Aug 11, 2017
* fix: miniscule beauty fixes

* feat: add buffer control parameters to driver

* feat: Finish addition of data buffer

Add a data buffer parameter to the SR830 driver class

* fix: handle setpoint booleans correctly

* docs: add example notebook for SR830

* fix: Respond to code review

* fix: add proper forward reference

* fix: remove accidental blank line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants