LoadInstrument v1

../_images/LoadInstrument-v1_dlg.png

LoadInstrument dialog.

Summary

Loads an Instrument Definition File (IDF) into a workspace. After the IDF has been read this algorithm will attempt to run the Child Algorithm LoadParameterFile; where if IDF filename is of the form IDENTIFIER_Definition.xml then the instrument parameters in the file named IDENTIFIER_Parameters.xml would be loaded.

Properties

Name Direction Type Default Description
Workspace InOut MatrixWorkspace Mandatory The name of the workspace to load the instrument definition into. Any existing instrument will be replaced.
Filename Input string   The filename (including its full or relative path) of an instrument definition file. The file extension must either be .xml or .XML when specifying an instrument definition file. Note Filename or InstrumentName must be specified but not both. Allowed extensions: [‘.xml’]
MonitorList Output int list   Will be filled with a list of the detector ids of any monitors loaded in to the workspace.
InstrumentName Input string   Name of instrument. Can be used instead of Filename to specify an IDF
InstrumentXML Input string   The full XML instrument definition as a string.
RewriteSpectraMap Input boolean True If true then a 1:1 map between the spectrum numbers and detector/monitor IDs is set up as follows: the detector/monitor IDs in the IDF are ordered from smallest to largest number and then assigned in that order to the spectra in the workspace. For example if the IDF has defined detectors/monitors with ID = 1, 5 and 10 and the workspace contains 3 spectra with numbers 1,2,3 (and workspace indices 0,1, and 2) then spectrum number 1 is associated with det ID=1, spectrum number 2 with det ID=5 and spectrum number 3 with det ID=10

Description

Loads an instrument definition file (IDF) into a workspace, which contains information about detector positions, their geometric shape, slit properties, links between values stored in ISIS log-files and components of the instrument and so on. For more on IDFs see: InstrumentDefinitionFile.

By default the algorithm will write a 1:1 map between the spectrum number and detector ID. Any custom loading algorithm that calls this as a Child Algorithm will therefore get this 1:1 map be default. If the custom loader is to write its own map then it is advised to set RewriteSpectraMap to false to avoid extra work.

The instrument to load can be specified by either the InstrumentXML, Filename and InstrumentName properties (given here in order of precedence if more than one is set). At present, if the InstrumentXML is used the InstrumentName property should also be set.

Usage

Example - Load instrument to a workspace:

# create sample workspace
ws=CreateSampleWorkspace();
inst0=ws.getInstrument();

print "Default workspace has instrument: {0} with {1} parameters".format(inst0.getName(),len(inst0.getParameterNames()));

# load MARI
det=LoadInstrument(ws,InstrumentName='MARI')
inst1=ws.getInstrument();

print "Modified workspace has instrument: {0} with {1} parameters".format(inst1.getName(),len(inst1.getParameterNames()));
print "Instrument {0} has the following detectors: ".format(inst1.getName()),det

Output:

Default workspace has instrument: basic_rect with 0 parameters
Modified workspace has instrument: MARI with 73 parameters
Instrument MARI has the following detectors:  [1 2 3]

Categories: Algorithms | DataHandling | Instrument

Source

C++ source: LoadInstrument.cpp

C++ header: LoadInstrument.h