pynxtools and NeXus: Automated FAIR Data Preparation for Experimental Research
27.11.2026
On 7 October 2026, the Journal of Open Source Software published a paper on pynxtools [1], a FAIRmat software package for automated preparation and validation of experimental data according to NeXus. FAIRmat announced the publication on 15 October [2].
The package is developed within Germany’s National Research Data Infrastructure (NFDI). The approach embeds standardisation, metadata preparation and completeness checks into the preparation of experimental results. This review continues the series on FAIRmat II, NOMAD 2.0 and the NOMAD–Galaxy demonstrator.
1. The interoperability challenge in experimental research
Modern instruments generate substantial volumes of digital data. File formats, metadata structures and the recording of experimental conditions vary by manufacturer, technique and software. Even measurements using the same technique may differ in quantity names, units and parameter representation.
Instrument files often lack context required for interpretation: sample provenance and preparation, research objectives, previous operations and measurement details. This information may reside in laboratory notebooks, text files, spreadsheets or laboratory information systems.
Preparing data for reuse therefore involves extracting information from source files, supplementing it with researchers’ documentation, and representing the combined information according to an agreed domain model. FAIRmat uses NeXus and pynxtools to automate these operations.
2. NeXus as a standard for experimental data representation
NeXus originated in neutron, X-ray and muon research. Its development is coordinated by the NeXus International Advisory Committee (NIAC). It combines a physical storage format with models of scientific meaning [3, 4].
The most widely used format is HDF5 (Hierarchical Data Format version 5), which supports groups, arrays, attributes and links between objects. A file may contain spectra, images, multidimensional arrays, parameters and textual information. NeXus defines how such information is organised and what standardised concepts mean.
Base classes describe common scientific objects. Application definitions specify method-specific requirements: mandatory, recommended and optional elements, data types and unit categories. Definitions are expressed in NXDL (NeXus Definition Language), an XML-based language that enables automated checks.
| Class | Purpose |
|---|---|
NXentry | Experimental record |
NXsample | Sample |
NXinstrument | Instrument |
NXdetector | Detector |
NXsource | Radiation source |
NXuser | Research participants |
NXdata | Data for analysis and visualisation |
NXprocess | Data processing operations |
Figure 1. Three components of NeXus data representation: HDF5, base classes and application definitions. Author’s diagram.
3. Extending NeXus for materials science
The FAIRmat-NeXus Proposal extends NeXus to electron microscopy, photoemission and optical spectroscopy, atom probe tomography and scanning probe microscopy. Decisions on incorporating the developed definitions into the international standard were made public in releases v2025.11 and v2026.01 [4].
FAIRmat maintains a branch of the definitions repository aligned with the official NIAC version. It may include additional concepts awaiting standardisation. Data publications should therefore specify the application definition, schema version and its origin. The status of individual definitions should be checked against the documentation for the relevant release.
4. pynxtools as an automated data preparation tool
pynxtools is an open-source Python package that can run locally, within an automated workflow or in an integrated NOMAD environment [5, 6, 8].
Specialised readers ingest supported instrument files. Additional metadata may come from an electronic laboratory notebook (ELN). Source information is mapped to the concepts and fields of the selected NeXus application definition. After checking the prepared structure, the information is written to an HDF5 file.
Its modular architecture separates general conversion, validation and writing functions from reader plugins for specific techniques and formats. For unsupported formats, developers may implement a reader or use generic mapping tools. Validation identifies problems; its messages should be reviewed even when an output file has been created.
Figure 2. Functional model of automated data conversion with pynxtools. Author’s diagram.
5. Supported experimental techniques
FAIRmat maintains domain plugins for the nine techniques listed below [7]. A separate generic plugin, pynxtools-igor, reads supported Igor Pro files.
A plugin for a technique does not imply compatibility with every instrument, file format or software version. For XRD, for example, the documentation describes specific XRDML formats. Before implementation, the relevant reader should be checked against a real instrument file to determine which metadata can be extracted and which must be supplied separately.
| Technique | Plugin / source code |
|---|---|
| X-ray photoelectron spectroscopy (XPS) | pynxtools-xps |
| Multidimensional photoelectron spectroscopy (MPES) | pynxtools-mpes |
| Electron microscopy (EM) | pynxtools-em |
| Atom probe microscopy/tomography (APM/APT) | pynxtools-apm |
| Ellipsometry | pynxtools-ellips |
| Raman spectroscopy | pynxtools-raman |
| X-ray absorption spectroscopy (XAS) | pynxtools-xas |
| Scanning probe microscopy (SPM) | pynxtools-spm |
| X-ray diffraction (XRD) | pynxtools-xrd |
6. The role of the electronic laboratory notebook
Instrument files may contain results, measurement dates, detector settings, resolution, units and other technical parameters. Researchers often record sample preparation, relationships to other investigations, experimental procedures and additional measurement conditions separately.
A structured ELN form, for example a YAML file, can supply missing metadata. Its contents can be designed around the selected NeXus application definition. This enables researchers to identify required parameters during experiment planning and move part of FAIR data preparation to the research stage itself.
7. Validation and data quality control
pynxtools checks the prepared information during conversion and can also validate existing files [10]. Depending on the schema and implementation, checks cover required groups and fields, data types, permitted values, dimensions, units and structural relationships. The pynx validate command checks conformity, while pynx read assists with inspection and debugging.
Three levels of quality control should be distinguished: technical readability of HDF5, formal conformity with a NeXus application definition, and scientific reliability and fitness for a research task. The first two can largely be automated. The third requires domain expertise and consideration of calibration, experimental conditions, uncertainties and data processing. Formal validation does not replace scientific assessment.
8. Practical example: XPS data conversion
The FAIRmat tutorial [9] uses X-ray photoelectron spectroscopy (XPS) data in the SLE format produced by SpecsLab Prodigy. Download the example archive from the documentation and extract it into a working directory. EX439_S718_Au.sle contains instrument data, eln_data_sle.yaml provides additional metadata, and params.yaml specifies conversion settings.
Install the package with the XPS plugin in a local Python environment and execute the commands below. The documented output is Au_25_mbar_O2_no_align.nxs. After conversion, review validation messages and inspect the internal file structure. This tutorial does not require a NOMAD installation. The commands are taken from the documentation and have not been locally executed for this review.
python -m pip install "pynxtools[xps]"
pynx convert --help
pynx convert --params-file params.yaml
pynx validate Au_25_mbar_O2_no_align.nxs
pynx read Au_25_mbar_O2_no_align.nxs
Figure 3. XPS conversion example based on the FAIRmat tutorial. Author’s diagram.
9. Integration with NOMAD
pynxtools is a component of the NOMAD ecosystem for handling experimental data [11]. In an appropriately configured deployment, software components process the NeXus file and use its contents to create a structured record. Scientific search is possible for fields available for indexing.
Supported techniques may benefit from specialised ELN forms, visualisation and analysis. A standardised file can be exchanged between the laboratory, NOMAD Oasis and independent services. The NOMAD–Galaxy demonstrator illustrates this approach by using NeXus files during conversion and analysis.
10. From standardisation to the FAIR principles
NeXus and pynxtools primarily support the technical prerequisites for interoperability and reuse. Shared models, terminology and machine-readable metadata allow independent tools to process results. Full implementation of FAIR involves a wider range of tasks [12].
A standardised file is one digital object within a FAIR-prepared dataset. Publication requires identification, repository metadata, access conditions, licensing, provenance and long-term preservation. FAIR also permits restricted access under defined conditions.
| FAIR principle | Contribution | Additional requirements |
|---|---|---|
| F | Structured metadata | PIDs, registration and indexing |
| A | Documented format | Retrieval protocols, access conditions, metadata availability |
| I | Shared models, formats and units | External vocabularies, ontologies and links |
| R | Experimental and processing descriptions | Licence, provenance, software versions, scientific review |
Figure 4. Division of responsibilities between conversion, standardised files and FAIR data publication. Author’s diagram.
11. Designing an experimental FAIR workflow
During planning, the data model and documentation requirements are identified. During the experiment, instruments generate source files while researchers record additional context. Software then extracts metadata, maps it to the model and creates a NeXus file.
Validation and curation may identify the need to revise documentation, mapping rules or other information sources. Publication preparation includes repository metadata, licences, access conditions and links to publications and other digital objects. Data can support comparative analysis, distributed workflows and machine learning once their suitability has been assessed.
Original instrument files and conversion settings should be retained alongside software and schema versions. This enables repeat conversion and traceability between primary and derived objects.
Figure 5. An illustrative experimental FAIR workflow with feedback from validation and curation. Author’s diagram.
Conclusions
pynxtools and NeXus illustrate an approach to automated FAIR data preparation combining domain models, specialised readers, electronic laboratory notebooks and validation. A shared model can guide multiple stages, from experiment planning to publication preparation.
Standardised representation enables integration of independent services and distributed workflows in the EOSC context. Further development involves broader instrument support, improved models, provenance documentation and assessment of fitness for specific scientific tasks.
Sources and further reading
- Shabih et al. (2026). pynxtools: A Python framework for generating and validating NeXus files in experimental data workflows. JOSS 11(126), 10691.
- FAIRmat — New Publication Presents the pynxtools Framework
- NeXus User Manual
- FAIRmat-NeXus Proposal
- pynxtools documentation
- Source code
- FAIRmat-supported plugins
- Data conversion
- XPS conversion tutorial
- Validation
- Integration with NOMAD
- Wilkinson et al. (2016). The FAIR Guiding Principles. Scientific Data 3, 160018.
Practical resources
Keywords: pynxtools, NeXus, HDF5, NXDL, FAIRmat, NOMAD, FAIR data, experimental data, metadata, validation, interoperability, EOSC