-
Notifications
You must be signed in to change notification settings - Fork 56
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
complex units, like eV/mm #1435
Comments
Is it appropriate to define a new type of units for this purpose? Here is where they are defined. |
Proposal: For complex types that are not currently in the list NeXus unit categories, allow the attribute,
This means the user needs to include the attribute The vector is: This is the same order as in UDunits (link) The HTML rendering won't show the numbers, but instead will use the SI defaults and the exponents to be more human readable. For example, This is a supplement to the list of allowed NeXus unit categories, and can be considered for complex types not in the list. (the NIAC will return to this tomorrow) |
|
A sequence of seven numbers (in the NXDL file) is hard to embrace as a person who is coaching people to write new application definitions. This is a code that must be remembered. I foresee continual challenges about the proper order of the numbers, for example. Perhaps there is another, more natural, way to implement this idea? The problem to be solved here is that a pre-defined a list of units categories might not be bounded. To allow the NeXus standard to be flexible to our community, we need a more robust system to describe expected units as our community's needs expand. We could add a |
The second example above ( |
n [24]: {**dict.fromkeys(('s', 'm', 'kg', 'A', 'K', 'mol', 'cd'), 0), **{k:int(v) for k, v in (g.split('^') for g in 's^1 A^3 K^-1'.split())}}
Out[24]: {'s': 1, 'm': 0, 'kg': 0, 'A': 3, 'K': -1, 'mol': 0, 'cd': 0} is also pretty straight forward (modulo details like supporting Maybe instead of trying to write a "nice" string we have to parse, we instead make it a json object as: <field name="mega_unit" type="NX_FLOAT" units="{'s': 1, 'm': 0, 'kg': 0, 'A': 3, 'K': -1, 'mol': 0, 'cd': 0}"> It is a bit verbose, but it is unambiguous to both humans and computers. Dropping the keys who's value is 0 is likely reasonable. |
Of these I prefer the vector representation, but only because the user would never see it. The HTML for the documentation would be rendered as The |
Note this is literally #1325, with the addition of extra HTML rendering code to smooth out the non-human readable unit vector. |
Alternate proposal:
Example:
It is recommended that users and application developers check if their units and their unit examples adhere to the UDUNITS standard. This proposal is accepted by NIAC vote as part of NIAC2024 |
The PR should close these related issues: |
Probably needs a modification to the NXDL Schema. |
The text was updated successfully, but these errors were encountered: