Skip to content
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

Re-usable enumerations #1379

Open
woutdenolf opened this issue Apr 15, 2024 · 1 comment
Open

Re-usable enumerations #1379

woutdenolf opened this issue Apr 15, 2024 · 1 comment

Comments

@woutdenolf
Copy link
Contributor

woutdenolf commented Apr 15, 2024

At NIAC telco https://github.com/nexusformat/wiki/blob/master/content/Telco_20240415.md it was requested to create this issue to gather all use-cases where a way of defining re-usable enumerations would be useful as opposed to creating base classes.

@woutdenolf
Copy link
Contributor Author

woutdenolf commented Apr 15, 2024

The NXxas working group on improving NXxas has a use-case where re-usable enumerations are useful.

#1352

In XAS you use multi-electron states which are labelled K, L1, L2, L3, M1, M2, ... (these are atom states with one missing electron after a core-hole excitation) for several things:

  1. It is used to specify which absorption edge the experiment was targeting (e.g. Fe-K).
  2. It is used the specify one or more emission a.k.a. fluorescence lines (K-L2, K-L3, ...)

The first idea was to define a class NXxray_level with one field called name which has the enumeration K, L2, L3, ... as value. Then define a class NXemission_line which has two groups of class NXxray_level with the names initial and final. Then define a class NXemission_lines which can have many NXemission_line groups.

For example tp define the fact that you are measuring the Fe-K emission lines (which includes K-L2, K-L3, etc.) you would have the following HDF5 tree structure

element (NXchemical_element)
   name = Fe

edge (NXxray_level)

   name = K

emission (NXemission_lines)

  line1 (NXemission_line)
    initial (NXxray_level)
      name = K
    final (NXxray_level)
      name = L2

  line2 (NXemission_line)
    initial (NXxray_level)
      name = K
    final (NXxray_level)
      name = L3

...

This might be fine if you just have a few but when you have 10 or 20 this is no longer human readable. In the end a spectroscopist wants to see the list K-L2, K-L3, ...

Note that the enumeration of chemical elements is also something that should be re-usable across multiple application definitions. You could create a class NXchemical_element but this is again not practical when you have many elements (you would have 1 HDF5 group per elements with a single dataset that holds a single string with one or two characters).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant