LoadInstrumentFromNexus v1

../_images/LoadInstrumentFromNexus-v1_dlg.png

LoadInstrumentFromNexus dialog.

Summary

Attempts to load some information about the instrument from a Nexus file. It adds dummy source and samplepos components to instrument. If the L1 source - sample distance is not available in the file then it may be read from the mantid properties file using the key instrument.L1, as a final fallback a default distance of 10m will be used.

Properties

Name Direction Type Default Description
Workspace InOut MatrixWorkspace Mandatory The name of the workspace in which to attach the imported instrument
Filename Input string Mandatory The name (including its full or relative path) of the Nexus file to attempt to load the instrument from. The file extension must either be .nxs or .NXS. Allowed extensions: [‘.nxs’]

Description

Attempts to load information about the instrument from a ISIS NeXus file. In particular, it attempts to read the reference frame axis. Also adds dummy source and samplepos components to instrument.

LoadInstrumentFromNexus is intended to be used as a child algorithm of other Load algorithms, rather than being used directly.

Usage

Example - Loading Instrument from Nexus

Note

To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.

# Create a dummy ws containing arbitrary data, into which we will load the instrument.
ws = CreateSampleWorkspace("Histogram","Flat background")
LoadInstrumentFromNexus(ws, "MUSR00015189.nxs")
inst = ws.getInstrument()
source = inst.getSource()

print("The name of the instrument is '{}'.".format(inst.getName().strip()))
print("The source postion is at:  {}.".format(source.getPos()))

Output:

The name of the instrument is 'MUSR'.
The source postion is at:  [0,-10,0].

Categories: Algorithms | DataHandling\Instrument

Source

C++ source: LoadInstrumentFromNexus.cpp (last modified: 2017-07-04)

C++ header: LoadInstrumentFromNexus.h (last modified: 2016-06-07)