https://github.com/kit-data-manager/nexus2json_mapper
https://github.com/kit-data-manager/nexus2json_mapper
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/kit-data-manager/nexus2json_mapper
- Owner: kit-data-manager
- Created: 2024-11-19T12:56:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-05T16:31:54.000Z (over 1 year ago)
- Last Synced: 2025-02-05T16:41:26.620Z (over 1 year ago)
- Language: Python
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**APE-HE NeXus File to JSON Document Converter**
**Description:**
This script is designed to automate the tasks of **extracting** metadata from NeXus (`.nxs`) files generated by the Advanced Photoelectric Effect - High Energy (APE-HE) experiment, and the **mapping** of extracted metadata to a predifined JSON schema to generate a structured JSON document. The NeXus file is parsed using the Python library `H5py`, which allows to efficiently navigate and manipulate HDF5-based files like NeXus.
The current script processes individual NeXus files and zipped NeXus files from APE-HE experiments, transforming the extracted metadata into a structured `JSON` format or zipped `JSON` files suitable for storage.
**Inputs:**
- Path to the Schema file (`.json`):
A JSON schema that defines the desired structure of the output document.
- Path to the NeXus file (`.nxs`) or zipped NeXus files (`.zip`):
A NeXus file containing experimental metadata and data.
- Name of the output file (`.json`) for a single NeXus file input or (`.zip`) for zipped NeXus files input:
The desired name of the output file where the metadata document will be saved.
**Output:**
A structured JSON file containing the extracted metadata aligned with the schema.
**How to execute the script:**
- For single NeXus file:
`python NexusMapping_cmdline.py `
- For zipped NeXus files:
`python NexusMapping_cmdline.py `