Skip to content

Converting research data to NeXus

Who is this tutorial for?

The document is for people who want to standardize their research data by converting their research data into a NeXus standardized format. We cover the basic principles and common principles of NeXus, here. For a more detailed description on the general principles of NeXus we recommend reading our learning page for NeXus or the official NeXus user manual.

What should you should know before this tutorial?

What you will know at the end of this tutorial?

You will have

  • a basic understanding how to use the NeXus data converter from the pynxtools package

Setup

We use a Python tool to make converting our research data easier. This has a number of readers that support multiple file formats. You can browse the separate folders to find the reader that might work for you. A generic reader is the JSON Map Reader. In addition, we provide multiple reader plugins for different experimental techniques.

We will use the XPS reader plugin with a SpecsLabProdigy file (file extension: .sle) as an example.

Steps

  1. Download the example files from here: Example files
  2. Extract the zip and copy the files in your current working directory. You can find the working directory by typing the following in your terminal:
    pwd
    
  3. Install pynxtools with the XPS reader plugin:
    pip install pynxtools[xps]
    
  4. Verify you can run the dataconverter in a terminal window. Open a terminal with the Python environment where you installed pynxtools. Then type the following:
    dataconverter --help
    

Converting the example files

Once you have your files copied into the working directory, your directory structure should look like this:

├── README.md
├── EX439_S718_Au.sle
├── eln_data_sle.yaml
└── params.yaml

The eln_data_sle.yaml YAML file is another data file containing additional information (e.g., information about the experimentator) that is not provided in the main data file.

Next, you will run the conversion routine from your Python environment:

dataconverter --params-file params.yaml

Here we use a params.yaml parameter file to configure the converter. This will create a file called Au_25_mbar_O2_no_align.nxs in your current directory.

Congrats! You now have a FAIR NeXus file!

You can try out other examples from pynxtools.