Skip to content

Install the NeXus data format

Erik B Knudsen edited this page Jan 6, 2022 · 1 revision

This page describes the procedures for installing the necessary libraries to enabel McStas/McXtrace to output neutron/X-ray data in the NeXus data format.

Installation instructions for NeXus-libraries

As many large scale facilities move towards storing data natively in the NeXus data format so do various data-analysis ppipelines. For the particular use-case of using synthetic simulated data in such pipelines it is convenient to have your simulation data output in the format expected by the analysis.

McStas and McXtrace natively support data-output in the NeXus-format provided that the necessary libraries and header files are installed on your simulation system.

Ubuntu/Debian class systems.

Ubuntu 18.04 LTS

NeXus can be installed from the command line. (NeXus for other Linux distributions are installed in a similar manner.)

Search for NeXus

$ apt-cache search libnexus

Install NeXus

$ sudo apt-get install libnexus0v5 libnexus0-dev

Ubuntu 20.04 LTS

NeXus can be installed from the command line. (NeXus for other Linux distributions are installed in a similar manner.)

Search for NeXus

$ apt-cache search libnexus

Install NeXus

$ apt-get install libnexus1 libnexus-dev

To generate Mantid-oriented output, use mcrun/mxrun --format=NeXus and compile with CFLAGS="-g -O2 -lm -DUSE_NEXUS -l NeXus -I/usr/include/nexus"

macOS

NeXus can be obtained from the Homebrew page. Installation is done from the command line.

Open a browser and go to the webpage https://brew.sh. If brew is installed, then jump to item 3.
Follow the install instructions. Type in a terminal:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Ensure homebrew is fully updated

$ brew update && brew update

Install hdf5

$ brew install hdf5

Build and install nexusformat via the Legacy “science” tap

$ brew install brewsci/science/nexusformat --build-from-source

Windows

The latest binary NeXus installer for Windows can be found at the McStas web site. Download the NeXus file and follow the install instructions.

Others

Optionally you may download the NeXus source code (https://github.com/nexusformat/code) and compile the library locally.

Clone this wiki locally