-
Notifications
You must be signed in to change notification settings - Fork 319
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
Docs/params #403
Docs/params #403
Conversation
I still think it should be |
Could you clarify what 'multi-valued paramaters' are? Does this include both the hardware controlled arraylike parameters (which you don't set but could be described as having a multi-valued return) and for example b field parameter with x, y and z values? |
Yes. Anything whose values are more complicated than a single number (or string). We may decide that's an oversimplification - which is part of why I posted this now rather than waiting until I finish the example notebooks. Basically, what we had before was this horrible So far the only real limitation I see that this imposes is that if you want to return a single array ( |
@alexcjohnson , I don't really understand the motivation for introducing a new type of parameter. I think that the current parameter is very capable of providing exactly this interface, and furthermore is already used in this way. As far as I understand the problem, the only real problem at this point is the way it interacts with the Loop (which if I understand correctly has been solved recently).
I have this question as well. Looking at the code suggests this is the multi-valued parameter and not the array parameter.
@MerlinSmiles I disagree, having a single attribute |
@AdriaanRol Its the first time i hear that argument, but that does/did not hold for |
it should also hold for labels, name and names is debatable as name refers to the name of the parameter but is used as a short for the labels whenever labels is not specified. Shape should still be a single one as it describes the shape, wether it is a tuple based (multi-valued) and/or array based. |
@AdriaanRol you're right that the current parameter is fully capable - this doesn't add any functionality, it just reorganizes in an attempt to make it easier to understand and document. All kinds of parameter have been and continue to be supported as measurements in loops, and it's on my/our TODO to support multivalued
This is actually exactly Merlin's argument... one which he and I have gone round on a few times before 💫 - in the simple case, units is a string, and in the multi case units is a sequence of strings. I suppose you've pointed at one way to resolve it, which would be to always make units be a sequence, though that seems like it would be confusing in the simple case. No, my argument initially is that you pretty much always speak of units in the plural even for a single measurement. |
re: name(s), label(s), shape(s): For the purpose of this discussion "multi-valued" means a parameter that provides values to go in multiple
So from a consistency standpoint, |
When I look at the wikipedia use of unit: https://en.wikipedia.org/wiki/Units_of_measurement it is like how I would do it. A single value has a unit of measurement, a list of values may have different units of measurement. Another question I have, is the multi valued parameter in principle not just a list of parameters? and combined each name goes into a list of names. |
Interesting... not how I use the word, but who can argue with wikipedia 🙉 If others feel it would be less confusing to use
That's what |
Update after a chat with @giulioungaretti and @alan-geller - I'm planning to make two changes:
More thoughts? |
By analogy the Multi Array will be a very common parameter type (think I and Q quadratures of or transmission coefficients (S11, S12 etc) of a spectrum analyzer). Will you solve this by adding yet another type of parameter? I'm still puzzled by the motivation for these types if beside the naming there is no different functionality. I think unit/units is a good improvement as long as single valued parameters support units as an attribute which is than a length 1 list containing unit. (and analogously for name(s) and label(s)) . |
This is covered by
It's really just for clarity and robustness - the existing
I suppose I could make these Anyway any interface that's trying to handle every parameter type will still need some way to know whether |
@alexcjohnson , I think the difference between an In any case I think I understand the arguments a bit better. 👍 on fixing these issues. On a sidenote, we now have a pretty clear example ( I think) of all the different loop modes that we implemented in PycQED. If you ever want to take a look at it check out this example notebook. In the end we are solving the exact same problems there. I also still intend to replace our sweep/detector functions completely with the parameters (I've now only partially done this). |
I am pro factoring the parameter into several more well defined versions which can then each be more understandably documented rather than trying to explain everything in a really general way as it is done now. I think that will also add some clarity between 'multi valued' and 'arraylike' as they are likely to be used and needed in different scenarios (or at least the 'multi' vs 'array' properties will be even if you want a parameter with both) so its good to define the differences and what functionality each has. |
Since the PR is far from complete, with docs being highest priority I won't comment much. |
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.
Not sure how ABC or duck-typing requirements would make it nicer? What is your idea here, it's really intriguing 👍 I guess to enforce behavior on subclasses and then just take the behavior for granted everywhere-else in the loop ooor?
Yes exactly - it's crucial if anyone wanted to make their own parameter classes that do not inherit from one of these - not sure why but who knows what will come up that we haven't thought of yet. But even if everyone only uses the classes we've defined to construct their parameters, subclassing |
interesting! But first, documentation ! 👾 |
de1cf04
to
4885ffa
Compare
@giulioungaretti I can add the extra units behavior, but it's a new feature, not a regression, so because this PR is already quite large I'd rather get this merged and then tackle that separately. I already had to overwrite some work @jenshnielsen did cleaning up the docs that I've completely rewritten, don't want to waste any more of your guys' time that way. |
@alexcjohnson cool, yes. Good idea, so we can just focus on fixing this and the data_set and you can go on with the documentation! We just need to check if we are breaking any instrument. |
I pushed a fix to the ZNB20 driver, as far as I can see this is currently the only one using a Multiparameter like parameter |
@jenshnielsen also most of the alazar acq controller parameters are Multiparameter but I guess that since that isn't merged it's still my problem :/ |
@nataliejpg I'm happy to change it but I should probably do that on the other branch |
@jenshnielsen tbh it's quite hacky at the moment so I was going to tidy up a bit anyway in the next few days but it would be great to get some input on the nicest way to do that. I'll bother you on slack... ;) |
It would be really nice with some real life examples of when one would use which parameter. |
@MerlinSmiles I cannot express enough enthusiasm for that idea (note that I have tried though). |
@MerlinSmiles Agreed, trying to bootstrap that by using it on the drivers that we are currently doing |
I think this is ok to merge. Once we revisit data_set and loop we should make it possible to change a setpoint array. I.e when you call get on a scope trace you will get a preamble from which you can calculate the time axis and number of points -> shape and setpoints. This is the easiest and most logical place to calculate the setpoints but is currently not possible because the setpoints have already been copied to the data_array by containers. Other todos
|
The documentation is far from helpful for beginners (waaaay to abstract) I think ,but we'll make a better one. |
Merge: f3324a5 9deaec1 Author: Jens Hedegaard Nielsen <[email protected]> Merge pull request #403 from alexcjohnson/docs/params
@giulioungaretti I still need to write the example notebooks (and there are a couple of TODOs scattered about here) but for discussion purposes, here's the
Parameter
refactor I've been working on.Parameter
is now only for single-valued parametersthe new
MultiParameter
has only one constructor form, and is for all multi-valued parameterscombine
? I haven't looked at this though.StandardParameter
andManualParameter
are unchanged.