https://github.com/nsls2/bluesky-nexus
WIP for writing NeXus metadata into Bluesky documents.
https://github.com/nsls2/bluesky-nexus
Last synced: 5 months ago
JSON representation
WIP for writing NeXus metadata into Bluesky documents.
- Host: GitHub
- URL: https://github.com/nsls2/bluesky-nexus
- Owner: NSLS2
- License: bsd-3-clause
- Created: 2025-03-03T16:42:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-21T21:13:58.000Z (about 1 year ago)
- Last Synced: 2025-07-08T06:55:03.143Z (12 months ago)
- Language: Python
- Size: 46.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bluesky-nexus
WIP for writing NeXus metadata into Bluesky documents.
### Istallation
This repo uses [pixi](https://pixi.sh/dev/) to manage the Python dependencies and run basic commands. Runing the following commands will install all necessary dependencies in the local pixi environment, clone the oficial NeXus definitions into a subfolder, and synchronize `.ipynb` and `.py` versions of Jupyter notebooks with [Jupytext](https://jupytext.readthedocs.io/en/latest/).
```bash
pixi install
pixi run clone
pixi sync
```
### Converting NeXus .nxdl.xml definitions to .yml
The code in `/src/conversion` allows one to convert any official NeXus definition or application file from its original `.nxdl.xml` format into a `.yml` file formatted to be compatible with `nexus_writer` -- a convenient package for saving NeXus data files. The conversion is a two-step process: first, the `.nxdl.xml` files are converted into an equivalent `.nxdl.yml` representation using a third party tool [nyaml](https://pypi.org/project/nyaml/0.0.8/). The resulting definitions are parsed and normalized with classes and data types becoming values at corresponding keys; this also allows one to declare additional key-value pairs, such as `value`, `reference`, etc. if desired. This process is illustrated in the notebook `/notebooks/xml-conversion.ipynb` and can be run for all files in batch or each file individually.
The intermediate `.nxdl.yml` and the resulting `nexus_writer`-compatible `.yml` definitions allow one to reference external files and so build a nested representation for a complex NeXus schema form its simpler components (details TBD).