-
Notifications
You must be signed in to change notification settings - Fork 65
Update NXparameter documentation #1560
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
base: main
Are you sure you want to change the base?
Update NXparameter documentation #1560
Conversation
|
It's worth taking into consideration the MPES proposal where there's |
Also removes the minOccurs and maxOccurs values, which are redundant for an object with nameType="any"
I think the various attributes that are added here like |
|
Indeed there are similarities between NXfit and suggestions made here. Personally, I think though that NXparameters should intentionally not restrict itself to fitting only but rather be a base class for where people can store parameters of algorithms irrespective of which type of algorithms these are. NXfit is maybe a specialization of NXparameters as an idea? I see your point Ray in that you I think want to name lmfit just as an example to make the docstring less abstract for users. Maybe adding one more example for parameters other than for fitting purposes would be good to make the higher generality of NXparameters clearer. |
|
@rayosborn to consider if the new NXfit class serves the same function so it's not worth updating NXparameters. Also update doc here so it's clear that fitting is just an example use case. |
This is meant to correct the impression that this base class is predominantly meant for fitting.
mkuehbach
left a comment
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.
A reasonable set of changes
base_classes/NXparameters.nxdl.xml
Outdated
| NeXus. | ||
| </doc> | ||
| </attribute> | ||
| <attribute name="initial_value" type="NX_NUMBER"> |
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.
These attributes are very helpful and I support adding them to the PARAMETER field in the base class. As discussed, I would just suggest that we align the attributes used in NXfit_function that basically do the same: https://github.com/nexusformat/definitions/blob/main/base_classes/NXfit_function.nxdl.xml#L58
Would be happy to adjust NXfit_function accordingly if we agree on the names of these attributes.
We should probably end up with attributes like these:
- description (as in
NXfit_function) - initial value
- min_value / min (we just choose one name)
- max_value / max (we just choose one name)
- vary / fixed (one of these)
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.
@lukaspie will make a PR that points to this PR to fix NXfit_function to use vary instead of fixed
@rayosborn will change min/max to min_value/max_value and fix the conflicts
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.
see #1594
mkuehbach
left a comment
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.
A reasonable set of changes
|
Awaiting the conflicts being fixed |
|
Personal opinion: we use NXparameters for a wide range of storing a bag of parameters, often not related to fitting. This seems to be more for NXfit. |
|
just in written what was mentioned in the meeting: I like the examples and the use for the refinable parameters in the fitting applications but my concerns are that the documentation looks too much oriented to the fitting now. However just a simple comment that it can be used in the original sense as a container for any parameters (including static program parameters) would resolve my concerns. |
|
From Telco: add a comment that NXparameters is very general, and that the fitting parameters are here for convenience. NXparameters is often used to hold parameters used in program execution that are not refined, for example. |
|
I amended the documentation to add: "Although this base class can be used to store any kind of parameter, one possible use case is to store parameters that are refined by a fitting function or model. A number of attributes have been defined to store metadata associated with such a refinement." I hope this satisfies those who are concerned that viewers might think the group is exclusively for fitting parameters. |
|
As discussed on the Telco, this PR is ready for a vote, with the note that we are waiting on a change from @lukaspie to change NXfit_function to use vary instead of fixed. Update: this vote includes #1594 from @lukaspie Please vote using emojis, 👍 for yes, 👎 for no, and anything else e.g. 👀 for abstain. Voting will close in 2 weeks. Thanks! |
|
This vote includes #1594, as noted in the original vote post |
|
I thought during the telco Markus objected to the |
Indeed, I asked for "_value" be dropped. "min", "max" and other suggestive names for number quantities which are essentially summary statistics could be made a common for quantities. My suggestion is --- solely to support not having the release date for NXDL2025 blocked --- accept the PR as is and make edits a future issue for e.g. NXDL2026. |
|
@mkuehbach the problem is that there will be files written using these names - do you deprecated the names straight away? It's worth getting this in a reasonable shape for the release. |
|
I appreciate your concern, @PeterC-DLS, but the two people, who might be affected with any backward-compatibility issues, i.e., @mkuehbach and me, both support this PR. I'm not sure either of us would be helped by delaying this any further. Some NeXus issues hang around for years and never get resolved by the NIAC; I would prefer this is not one of them. |
2w passed but less than 14 votes...
I agree with @rayosborn Question for me is though --- given insufficient votes --- what will happen now??? NIAC please decide |
|
The PR did not get enough votes. Interested parties should confer and get the pull requests aligned with all edits merged in before we try again. |
For the following reasons: i) model is also a parameter, cuz it can be used to instruct programs to follow specific execution branches ii) currently the NeXus documentation building as issues with dealing with groups where an attribute and field with the same concept name appear, see conversation of the nexusformat#1560 for more details about this, what I think is a bug.
|
@phyy-nx @rayosborn @PeterC-DLS me and Lukas had a chat about this PR and #1594. We concluded the following changes: I suspect that the documentation generation code does not properly distinguish between an attribute and field in a group when these have the same name --- something which is possible and distinguishable though. That example here shows two concepts in such a group setting that are different and also with HDF5 no problem there is to distinguish them. The issue is general, concept names here only an example showing the problem. For the reason to avoid this rabbithole of digging up the documentation code and also for the reason that I am convinced With this the CI runs fine, #1560 and #1594 are ready for a new voting. The key question remains is this a voting to take place still for NXDL2025 ? Please see attached a manifestation of the above-mentioned bug in the documentation building process: |
base_classes/NXparameters.nxdl.xml
Outdated
| <field name="model"> | ||
| <doc> | ||
| The name of the model used in optimizing the parameter | ||
| values. Fitting packages such as LMFIT | ||
| (https://lmfit.github.io/lmfit-py/) provide models, which | ||
| instantiate functions to be fitted to the data. If this | ||
| attribute is provided, it is assumed that all the parameters | ||
| in this group are associated with this model. | ||
| </doc> |
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.
From Telco, drop this field. Let application definitions define model as a PARAMETER if they want to.
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.
Unless @rayosborn you want model for your own work? If so, let's move it back to an attribute and fix the underlying sphinx issue. @mkuehbach will write an separate issue for the sphinx bug.
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.
We are using NXparameters in recently accepted in NXazint1d with a comment: "Parameters should exactly match those required by the algorithm used in the processing. For example, azint requires error_model, mask, n_splitting, poni, etc. There is not an explicit conflict but if any application has a parameter model, with different meaning, we have a conflict.
But I have no objections, if it is an attribute.
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.
I have reverted to defining "model" as an attribute. If I understood the above comments, that is the preferred option and it conforms to how we currently use it in NeXpy.
|
@rayosborn to make the next vote easier, maybe add the commit from #1594 into this branch on your fork so that we only need one vote? Then we can close #1594. When that is resolved, the sphinx bug is fixed, and the |
@rayosborn would you be able to bring these changes from #1594 into this branch? I would do it myself, but I can't because this branch right here is located in your forked repo where I don't have access. |
|
I have uploaded a revised version of the NXfit_function base class with attributes duplicated in the NXparameter base class removed. |

The name of this base class suggests that it would be the ideal repository to store the results of any parameter optimization, such as least-squares fitting. To facilitate its use in this context, it is helpful to standardize a number of attributes for each parameter, which are common to most, if not all, optimization procedures. For a number of years, NeXpy has been using NXparameter groups to define the parameters for a specific function, such as a Gaussian, in conjunction with the LMFIT package (https://lmfit.github.io/lmfit-py/), which calls them "models." If multiple functions are fitted simulaneously to a data set, multiple NXparameter groups are stored in a NXprocess group, which also defines the program used to produce the optimization.
An example of a NXparameter group is given here:
The purpose of this PR is not to confine NXparameter groups to this particular use case, but to standardize the attributes when it applies. Others are welcome to suggest other uses of this group.
Until now, the NXparameter group has been an empty container, so I don't think this PR changes the standard in any substantive way - it just expands the documentation - so I don't believe a NIAC vote is required. However, it is probably still worth discussion at a Telco to get feedback.