\(\renewcommand\AA{\unicode{x212B}}\)

LoadInstrumentFromNexus v1

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.

See Also

LoadInstrument, Load

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 Mantid 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 position is at:  {}.".format(source.getPos()))

Output:

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

Categories: AlgorithmIndex | DataHandling\Instrument

Source

C++ header: LoadInstrumentFromNexus.h

C++ source: LoadInstrumentFromNexus.cpp