Open giulioungaretti opened 8 years ago
I dont really get what you are asking ;) The parameter as is is not fully working, so it is strange to reduce complexity while there is still missing stuff. i.e. setting multiple values, it works kindof, but not with i.e. validators, but the same is true for get...
Often when I think about multi valued parameters, I think every value itself should be a parameter, that would reduce some of that 'name' 'names' 'label' 'labels' 'units' (only one version for both!?) stuff. And then have super simple combined parameters. param = [par1, par2, par3]
@MerlinSmiles yah, it's not clear what I am asking. I guess it boils down to: a) is parameter what people want? And I am too stupid to document what it does properly. (I seem to lose track quite quickly of the possible combinations of options that that constructor takes)
b) what parameter can do is possibly too much of too many things ?
@giulioungaretti In my mind a parameter is something very simple. It is something that is getable and/or setable and should support logging and use in data acquiring loops and measurements as it supplies the units and labels as well as standardisation. Additionally it should provide protection against stupid mistakes such as setting illegal (validator, hard coded) or dangerous values (soft-validator, #230 )
Now I do understand there is some confusion as to the different types of uses for a parameter. Let me go over them (I am sorting them by the shape of data they get/set) as that may be a cause of confusion.
T1
parameter, T1.get()
performs a measurement (involving loading a sequence on a waveform generator, getting back an array of measured qubit states for different times, storing it in a dataset and handing that dataset to an analysis that performs a fit and returns a tuple of fitted values). I hope this explains why we like the parameter, and why I think it is a good standard/paradigm to capture the essence of experiments. It can be that the implementation is a bit hard due to the multiprocessing constraints but I feel this captures everything the user should know (if this is in any way useful for the docs feel free to copy it).
The constructor of the base parameter class is not as simple as it could be. Would it be reasonable to split the Parameter class into several subclasses for each of the different usage types? (I know that this will break compatibility with a lot of drivers that are already written, but I do see some appeal to make the base of qcodes as simple as possible)
@damazter How about an abstract base class as some kind of template? It is not strictly speaking a python construct but in the end the only thing we are specifying is some standard that one needs to comply to in order to work with datasets and loops.
@AdriaanRol Yes. This would also create flexibility, because if you need something different, one can write a new class and inherit from the base class (something which is not possible atm)
@giulioungaretti
Hi Giulio, @damazter and me just went over the paramater and we would like to propose the following.
Parameter
, removing the different use casesParameter
's code. This is the part following if names is not None:
and if shape is not None or shapes is not None:
. Parameter
into the base parameter class, the functionality for names
and shape
can then be implemented in whatever subclass one cares to implement. This should be an easy solution, Parameter
is as simple as the concept parameter, with minimal backwards breaking problems.
Damaz & Adriaan
@AdriaanRol @damazter unfortunately that will also break more things that we want. So for first release, parameter stays like this. And "handcrafted" documentation will help the lost hacker.
Maybe I am not clever enough 😭, but the class Parameter is maybe too complex?
The fact that writing docs (I mean valid python documentation) for the constructor is nearly impossible, made me think that we may want to make Parameter to behave differently.
This is a part of the api that the users will want to use if they have anything complex.
Example:
How can one tell what is required for a parameter that returns an array (the hardware parameter that was discussed in Delft) ?
The question is then, do we want to: