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
Proposal: Possibility to not save all parameters. #1014
Comments
@msmttchr , @CasperSchippers , what do you think, as it touches what you mostly use? |
I think this is a good idea. I do see a conflict between your two usecases with a single |
If you look in the example I've made you can see that I assign the ID parameter value to metadata (gui_no_save_param.py row 74) for use case 2. Of course, it would be possible to add a metadata boolean to the Parameter class, but I saw this proposal as simpler and still make it possible to solve two use cases. |
Ahh yes, missed that line; thanks for the explanation! Due to the fact that I missed that, I actually started thinking that maybe explicit is better than implicit/obfuscated. |
Well, how to define "best"? :) In that case I think we first should which structure we think is best:
Structure B
|
I understand (and also quite like) the thought of reusing the the parameters as you mention. In that sense I think there is also an option C we should not immediately discard: Structure C:
For structure A, if we want to have the different types of input field (float, list, etc), we might want to make separate classes from which both the Parameters and Metadata inherrit; downside is that I have feeling that this might end up in a lot of boilerplate code. The user-input should be optional For structure B the same thought holds; I'm also a bit reluctant to add a seperate input values thing, as I think that the parameters and metadata should be able to catch the usecases. So generally, for me options A and C would be the nicest, where A requires the most changes to the code (unless we just want a general text input field, instead of the int, float.. etc), and C the easiest to implement. What do you think? |
If I get you right, my initial propsal is close to structure C? My initial thought was to have a flag that disables both save of a parameter and not touches the parameter at load (as the standard behaviour of a missing parameter is to be set to its default value). Your propsal is to have a flag that only disable the loading of a parameter? Both solutions will solve the use cases , but I think I prefer a flag that disable both save & load as I feel it more consistent: If a parameter is in the result file, it will be loaded. What do you think? |
My initial proposal was indeed close to structure C. However, I gave it a bit more thought and realized a few things, and would slightly change my proposal at the moment to something that is actually closer to your structure B. My current proposal is as follows (let's call it structure D for the sake of discussability): The classes you'd have then would be (with the inheritance)
A few type-specifications of the input class
And the specified parameters and metadata (in number, only these are new, but the implementation will, I think, only require inheriting and nothing more):
I'm not yet entirely sure regarding whether the Parameter and Metadata base classes should already inherit of the InputField, or if we need an additional BaseMetadata and BaseParameter class. In my proposal, the specified parameters and metadata inherit from InputField twice; I'm not sure if this can cause issues, but it seems logical, and useful to me that they have a common ancestor. Also, I think it is closer to the current structure, as I'd like to keep the backwards compatibility such that people do not need to change things in their Procedures. Additionally, we don't need a 'user-input' toggle for any of the classes, since we already have the 'inputs' keyword argument for the ManagedWindow. What do you think of this architecture. |
That seems elegant. It seems very clean. But as I have limited experience of Python and all structures of pymeasure, I don't see how complex it will be to implement. I guess that the basic handling of the input types that already is in todays Parameter can be reused, but it will of course require to be restructured. See any major risk in breaking some of todays behaviour? |
Yeah, that sounds about right. I can understand this seems a bit more difficult than the first implementation. I will indeed require a bit of restructuring, but I don't expect too many issues (though it will always be more than you think upfront). If you're uncomfortable with something like this, that is fine of course (not saying that is it necessary, but I could understand the reluctance), and I could give it a go (although, as you might've seen from my slow responding it might take a bit before it is finished). |
I opened a draft PR (#1036) in which I started working on an implementationo of the above idea. |
Interesting, I'm looking forward to this. I'll take a look on it and see if I can learn some more. |
The idea is to have input parameters that are not saved as Parameters in the result files. I see at least two uses for this:
I've made a proposal in PR #1013 to add a Boolean 'save' parameter to the Parameter class and an example.
Maybe this is not the right way to go, I welcome better ideas!
The text was updated successfully, but these errors were encountered: