PyCon UK 2019

NeXus Constructor: Visualising the Configurations of Neutron Experiments with Qt for Python
09-14, 13:30–13:45 (Europe/London), Marble Hall

The NeXus data format provides a way of describing neutron, muon and x-ray experiments. In this poster we illustrate how our NeXus Constructor tool utilises Python and Qt in order to allow programming-unsavvy researchers to visualise and modify the contents of these files with minimal assistance.

NeXus is a data format that aims to define a common standard for storing data from neutron, muon and x-ray experiments in HDF5 files. It is being used by scientific facilities worldwide including our pulsed neutron and muon facility at the Rutherford Appleton Laboratory in Oxfordshire.

Neutron facilities are typically comprised of separate beamlines which run experiments in parallel. The NeXus file for an experiment contains a description of the relevant beamline and its constituent components. Another important characteristic of the NeXus format is that it describes the position, orientation and shape of the components that are used in a particular experiment. This information is essential if we are to carry out meaningful analysis on experiment data.

Historically, neutron beamline instrument layouts had to be configured by manually editing a file. This approach was sufficient as the layout of the components seldom changed, however, in modern instruments, there are various moving components that can be configured differently for each experiment.

To tackle this problem, we have begun development of the NeXus Constructor, a GUI tool which creates component geometry and outputs to JSON. The JSON file is in turn used to configure the software which writes a NeXus file using data acquired during the experiment. The NeXus Constructor’s main purpose is to make editing the description of the geometry of an instrument straightforward for the scientists that use and maintain them.

To create the NeXus Constructor, we have used h5py and Qt for Python. Our tool is making use of a 3D view in the recently added Qt3D module to display the instrument components with their geometry information. Using Qt's high level tools we are able to transform components in the 3D view and update them in real-time.

Is your proposal suitable for beginners? – no

Software developer for the ISIS department of Science and Technology Facilities Council