[NeXus-committee] Discussion of the nexusformat Python API

Osborn, Raymond rosborn at anl.gov
Thu Oct 15 15:48:37 BST 2020


Hi everyone,
I wanted to thank everyone for the constructive discussion at NIAC-2020. I thought it was a helpful exchange of views. In case you didn’t copy it from the chat window, here is a link to the Jupyter notebook that you can run online in a Googe colab if you want to find out more about how it works.

https://colab.research.google.com/github/nexpy/nexusformat/blob/master/src/nexusformat/notebooks/nexusformat.ipynb

Expanded documentation is available in the section on “Python Interface to NeXus” in the NeXpy documentation at  https://nexpy.github.io/nexpy/.

If you don’t mind, I would like to reiterate one argument that only occurred to me during the discussion. It concerns the maintainability of code accessing NeXus files. If you use h5py directly, then if there is a change to the NeXus standard, such as the signal/axes change a few years ago, you will have to update all the h5py code manually to ensure continued compatibility. If backward compatibility is important, you will have to ensure that both the obsolete and new standards are handled correctly. For those of you who keep track of the standard, this might not be too big an issue, but for large projects, managed by groups that are not so committed to maintaining compatibility (e.g., Mantid), this could lead to a host of issues down the line.

Of course, the same is true for the nexusformat package, but its raison d’etre is to maintain compatibility with an evolving standard, and it is the reason why I am keen to get more developers involved in maintaining it. Backward-compatible fixes within ’nexusformat’ would work for everyone using the  API without any extra coding, potentially saving a lot of time.

If you try out the Jupyter notebook and have any feedback, I will try to attend as much of the code camp as I can.

Ray
P.S. I should warn anyone using h5py that the upcoming v3.0.0 will now always return byte strings, rather than unicode, so if you have assumed that h5py[’text’][()] returns a string, you are in for a surprise. For backward compatibility, you will have to check for the h5py version. There is example code in https://gist.github.com/takluyver/32512eb5367d11d013029af5fbf1d3e1. This is already handled in the nexusformat package.
--
Ray Osborn, Senior Scientist
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: ROsborn at anl.gov<mailto:ROsborn at anl.gov>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nexusformat.org/pipermail/nexus-committee/attachments/20201015/23bc58a9/attachment.htm>


More information about the NeXus-committee mailing list