Skip to content

Comments

Add support for array parameters to MultiChannelInstrumentParameter#2

Merged
spauka merged 18 commits intospauka:feat/channelizationfrom
jenshnielsen:feat/channelization_with_array
Jun 16, 2017
Merged

Add support for array parameters to MultiChannelInstrumentParameter#2
spauka merged 18 commits intospauka:feat/channelizationfrom
jenshnielsen:feat/channelization_with_array

Conversation

@jenshnielsen
Copy link

Changes proposed in this pull request:

  • Add support for ArrayParameters to MultiChannelInstrumentParameter
  • Error cleanly if tying to use a MultiParameter i.e. slice a MultiChannelInstrumentParameter
  • Some relevant tests

WilliamHPNielsen and others added 9 commits June 9, 2017 16:48
Add a QDac driver using the new channelisation feature
Make the paramclass returned by __getattr__ be customisable.
Add a channelised driver for the QDac. This requires changing the base code
for channels a bit to allow for custom MultiChannelInstrumentParameter
subclasses.
Copy link
Owner

@spauka spauka left a comment

Choose a reason for hiding this comment

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

Hey,

Changes look good and hopefully it was reasonably intuitive to convert the QDac into a channelized instrument. A few minor points raised in the review, although I'm not too fussed about any of them.

One suggestion for improving the readability of code given the 1-indexing of channels, if functions such as _set_voltage are part of the QDacChannel then it is possible to use the channum set for each class rather than having to do chan-1 repeatedly.

Something like:

class QDacChannel(InstrumentChannel):
  ...
  def __init__(self, parent, name, channum):
    ...
    self._channum = channum

  def _set_voltage(self, v_set):
    ...
    atten = self.vrange.get_latest() 
    ...
    self.write('set {} {:.6f}'.format(self._channum, v_set)

Perhaps you want to add single channel indexing examples to the notebook, to demonstrate the equivalence between qdac.channels[0] and qdac.ch01.

label=label,
unit='C',
get_cmd='tem {} {}'.format(board, sensor),
get_parser=self._num_verbose)
Copy link
Owner

Choose a reason for hiding this comment

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

Should these be channelized as well?
Are there more parameters that are board specific, similar to slots in the Harvard DAC?

Choose a reason for hiding this comment

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

They could be channelised, but noone uses them, so I think it's okay to leave them for now.

self.visa_handle.read()))

# take care of the rest of the output
for ii in range(50):
Copy link
Owner

Choose a reason for hiding this comment

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

should reference self.num_chans?

Choose a reason for hiding this comment

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

Or maybe not... It's not so clear why this output is exactly 50 lines long (firmware design choice), but it will not change with self.num_chans. But I agree that magic numbers should be avoided.

self.write('status')
FW_str = self._write_response
FW_version = float(FW_str.replace('Software Version: ', ''))
for ii in range(50):
Copy link
Owner

Choose a reason for hiding this comment

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

self.num_chans here too?

Choose a reason for hiding this comment

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

No magic numbers. Let's make a variable for this.


#########################
# Channel gets/sets
#########################
Copy link
Owner

Choose a reason for hiding this comment

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

Should channel get/set be part of the QDacChannel class?

Choose a reason for hiding this comment

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

I think it makes sense for this particular instrument to keep it in the main instrument, as the channels are interlinked via the _get_status command.

stored inside a channel list are accessible in multiple
ways and should not be repeated in an instrument snapshot.

paramclass (unknown): The class of the object to be returned by
Copy link
Owner

Choose a reason for hiding this comment

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

unknown can be MultiChannelInstrumentParameter

Choose a reason for hiding this comment

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

Good point.

def __init__(self, parent, name, chan_type, chan_list=None, snapshotable=True):
def __init__(self, parent, name, chan_type, chan_list=None,
snapshotable=True,
paramclass=MultiChannelInstrumentParameter):
Copy link
Owner

Choose a reason for hiding this comment

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

paramclass is a slightly confusing variable name here. Perhaps something like multichan_paramclass. Given that this might be a slightly confusing concept for users I would be in favor of a more verbose variable name.

Choose a reason for hiding this comment

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

I fully agree with you on this one.

@jenshnielsen
Copy link
Author

@spauka Thanks, cant wait to get the channel support merged.

I have another branch at https://github.com/jenshnielsen/qcodes/tree/feat/channelization_refactor_classes which implements 1 based indexing into the channels along with some refactoring. We choose to split these things up as what is in this pr is hopefully fairly non controversial, but the changes in the other PR will require some more thought and should perhaps be changed and/or removed.

On top of that I did a version of microsoft#623 on top of the channels in https://github.com/jenshnielsen/qcodes/tree/znb_with_channels This looks very promising for the channels as it greatly simplifies the driver implementation (no more get_attr) and makes the the driver much easier to use (I expect, it's currently untested as I don't have access to a spare RS ZNB 20)

@jenshnielsen
Copy link
Author

@spauka I pushed some changes to address the issues per Williams suggestions

@spauka
Copy link
Owner

spauka commented Jun 16, 2017

Cool, I will pull this in.

@spauka spauka closed this Jun 16, 2017
@spauka spauka reopened this Jun 16, 2017
@spauka spauka merged commit 3145c52 into spauka:feat/channelization Jun 16, 2017
@jenshnielsen jenshnielsen deleted the feat/channelization_with_array branch June 16, 2017 05:02
spauka pushed a commit that referenced this pull request May 30, 2018
…ainer

Call get_DB_debug and make sure its cast to bool
spauka pushed a commit that referenced this pull request Aug 8, 2018
spauka pushed a commit that referenced this pull request Jan 21, 2019
* [DEM-525] Improve raw waveform upload speed
spauka pushed a commit that referenced this pull request Feb 10, 2020
spauka pushed a commit that referenced this pull request Mar 9, 2020
Update QDevil branch from master
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.

3 participants