P02.1 - Public : How to get calibration information from a DAWN NeXus file

At the end of your beamtime you should have a NeXus file containing the calibration information, which can be used in the DAWN processing pipelines. The file is produced using the Powder Calibration perspective in DAWN (video tutorial available on DAWN website) This file contains information including:

  • sample to detector distance
  • wavelength
  • detector tilts
  • beam centre

There are two ways to get directly to these values.

Using the Powder Calibration perspective

In DAWN, click on the Open Perspective button ( - top right of the main DAWN window) to open the perspectives menu:

Open the Powder Calibration perspective.

On the top left you can drag and drop an image to be calibrated. To open an existing calibration information NeXus file you need to load an image file into this box. Any image will do as we're not going to calibrate it. Having loaded an image, you can click on the "Import metadata from file" button (- top left, above the loaded diffraction image) and select the calibration information file you were given/made at P02.1. The table on the top right of the Powder Calibration perspective should now update with all the values from the calibration file. If you click on the values in the table, you can get to values with greater precision (more decimal places). We don't recommend using more than 5 decimal places (though this is an empirical suggestion rather than a proven result).

Using the DataVis NeXus Tree View

In DAWN, open the DataVis perspective ( - top right of the main DAWN window; should be open by default, if not follow similar steps to those described for opening the Powder Calibration perspective above, but open DataVis instead). Drag and drop your calibration information file into the left hand pane (Data Files). Right click on this file and select from the menu "View Tree...":

This opens the NeXus file tree view. You can navigate through the tree by clicking on the arrows on the left of the text labels. The wavelength of is located under entry1 > calibration_sample > beam > incident_wavelength whilst the sample to detector distance can be found under entry1 > instrument > detector > distance:

Advanced

NeXus files are actually just hdf files and can also be accessed using the h5py python library. An example of how to extract the wavelength from a calibration file is given below:

In[1]: import h5py
In[2]: calib_file = h5py.File('myfilename.nxs', 'r')
In[3]: wl_dset = calib_file['/entry1/calibration_sample/beam/incident_wavelength']
In[4]: wl_val = wl_dset[()]
In[5]: print(wl_val)
Out[5]: 0.2067642375