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

LoadRaw v3

../_images/LoadRaw-v3_dlg.png

LoadRaw dialog.

Summary

Loads a data file in ISIS RAW format and stores it in a 2D workspace (Workspace2D class).

Properties

Name Direction Type Default Description
Filename Input string Mandatory The name of the RAW file to read, including its full or relative path. The file extension must be .raw or .RAW (N.B. case sensitive if running on Linux). Allowed extensions: [‘.raw’, ‘.s*’, ‘.add’]
OutputWorkspace Output Workspace Mandatory The name of the workspace that will be created, filled with the read-in data and stored in the Analysis Data Service. If the input RAW file contains multiple periods higher periods will be stored in separate workspaces called OutputWorkspace_PeriodNo.
Cache Input string If Slow An option allowing the algorithm to cache a remote file on the local drive before loading. When “If Slow” is set the download speed is estimated and if is deemed as slow the file is cached. “Always” means always cache a remote file and “Never” - never cache. Allowed values: [‘If Slow’, ‘Always’, ‘Never’]
LoadLogFiles Input boolean True Boolean option to load or skip log files. If this option is set all the log files associated with the selected raw file are loaded into workspace and can be displayed using right click menu item Sample Logs…on the selected workspace. Note: If the log files contain motor positions, etc. that would affect the instrument geometry this option must be set to true for these adjustments to be applied to the instrument geometry.
SpectrumMin Input number 1 The index number of the first spectrum to read. Only used if SpectrumMax is set.
SpectrumMax Input number Optional The number of the last spectrum to read. Only used if explicitly set.
SpectrumList Input int list   A comma-separated list of individual spectra to read. Only used if explicitly set.
PeriodList Input int list   A comma-separated list of individual periods to read. Only used if explicitly set.
LoadMonitors Input string Include Option to control the loading of monitors. Allowed options are Include,Exclude, Separate. Include:The default is Include option which loads the monitors into the output workspace. Exclude:The Exclude option excludes monitors from the output workspace. Separate:The Separate option loads monitors into a separate workspace called OutputWorkspace_monitor. Defined aliases: 1: Equivalent to Separate. 0: Equivalent to Exclude. Allowed values: [‘Include’, ‘Exclude’, ‘Separate’]

Description

The LoadRaw algorithm stores data from the RAW file in a Workspace2D, which will naturally contain histogram data with each spectrum going into a separate histogram. The time bin boundaries (X values) will be common to all histograms and will have their units set to time-of-flight. The Y values will contain the counts and will be unit-less (i.e. no division by bin width or normalisation of any kind). The errors, currently assumed Gaussian, will be set to be the square root of the number of counts in the bin.

Optional properties

If only a portion of the data in the RAW file is required, then the optional ‘spectrum’ properties can be set before execution of the algorithm. Prior to loading of the data the values provided are checked and the algorithm will fail if they are found to be outside the limits of the dataset.

Multiperiod data

If the RAW file contains multiple periods of data this will be detected and the different periods will be output as separate workspaces, which after the first one will have the period number appended (e.g. OutputWorkspace_period). Each workspace will share the same Instrument, SpectraToDetectorMap and sample objects. If the optional ‘spectrum’ properties are set for a multiperiod dataset, then they will ignored.

If PeriodList property isn’t empty then only periods listed there will be loaded.

Subalgorithms used

LoadRaw runs the following algorithms as child algorithms to populate aspects of the output Workspace:

  • LoadInstrument v1 - Looks for an instrument definition file named XXX_Definition.xml, where XXX is the 3 letter instrument prefix on the RAW filename, in the directory specified by the “instrumentDefinition.directory” property given in the config file (or, if not provided, in the relative path ../Instrument/). If the instrument definition file is not found then the LoadInstrumentFromRaw v1 algorithm will be run instead.
  • LoadMappingTable v1 - To build up the mapping between the spectrum numbers and the Detectors of the attached Instrument.
  • LoadLog v1 - Will look for any log files in the same directory as the RAW file and load their data into the workspace’s sample objects.

Alternate Data Stream

RAW data files from the ISIS archive contain a second stream of data associated with the same file object using the NTFS Alternate Data Stream feature. The alternate stream can be accessed by appending :checksum to the filename when opening the file. The stream stores MD5 checksums of all of the files associated with the RAW file including log files and the corresponding ISIS NeXus file that can be loaded with LoadISISNexus. The following shows an example of the content found in the :checksum stream:

ad0bc56c4c556fa368565000f01e77f7 *IRIS00055132.log
d5ace6dc7ac6c4365d48ee1f2906c6f4 *IRIS00055132.nxs
9c70ad392023515f775af3d3984882f3 *IRIS00055132.raw
66f74b6c0cc3eb497b92d4956ed8d6b5 *IRIS00055132_ICPdebug.txt
e200aa65186b61e487175d5263b315aa *IRIS00055132_ICPevent.txt
91be40aa4f54d050a9eb4abea394720e *IRIS00055132_ICPstatus.txt
50aa2872110a9b862b01c6c83f8ce9a8 *IRIS00055132_Status.txt

The MD5 checksum of the RAW file itself is not affected by the presence of the alternate stream. If the RAW file is copied to a filesystem that does not support the alternate stream then the stream is dropped.

Previous Versions

LoadRaw version 1 and 2 are no longer available in Mantid. Version 3 has been validated and in active use for several years, if you really need a previous version of this algorithm you will need to use an earlier version of Mantid.

Usage

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.

Example 1: using defaults

# Load a RAW file using all defaults
ws = Load('HRP39180.RAW')
print('Workspace has {} spectra'.format(ws.getNumberHistograms()))
# Get a detector in histogram 1024 of the workspace
detid = ws.getSpectrum(1024).getDetectorIDs()[0]
print('Is detector {} a monitor? {}'.format(detid, ws.getInstrument().getDetector(detid).isMonitor()))

# Get the Run object
run = ws.run()
print('Workspace contains {} logs'.format(len(run.keys())))
print('Workspace has property INT1: {}'.format(run.hasProperty('INT1')))

Output:

Workspace has 2890 spectra
Is detector 1001 a monitor? True
Workspace contains 35 logs
Workspace has property INT1: True

Example 2: load without the logs

# Load a RAW file without the logs
ws = Load('HRP39180.RAW',LoadLogFiles=False)
print('Workspace has {} spectra'.format(ws.getNumberHistograms()))
# Get a detector in histogram 1024 of the workspace
detid = ws.getSpectrum(1024).getDetectorIDs()[0]
print('Is detector {} a monitor? {}'.format(detid, ws.getInstrument().getDetector(detid).isMonitor()))

# Get the Run object
run = ws.run()
print('Workspace contains {} logs'.format(len(run.keys())))
print('Workspace has property INT1: {}'.format(run.hasProperty('INT1')))

Output:

Workspace has 2890 spectra
Is detector 1001 a monitor? True
Workspace contains 29 logs
Workspace has property INT1: False

Example 3: exclude monitors

# Load a RAW file without the monitors
ws = Load('HRP39180.RAW',LoadMonitors='Exclude')
print('Workspace has {} spectra'.format(ws.getNumberHistograms()))
# Get a detector in histogram 1024 of the workspace
detid = ws.getSpectrum(1024).getDetectorIDs()[0]
print('Is detector {} a monitor? {}'.format(detid, ws.getInstrument().getDetector(detid).isMonitor()))

# Get the Run object
run = ws.run()
print('Workspace contains {} logs'.format(len(run.keys())))
print('Workspace has property INT1: {}'.format(run.hasProperty('INT1')))

Output:

Workspace has 2888 spectra
Is detector 901000 a monitor? False
Workspace contains 35 logs
Workspace has property INT1: True

Example 4: load monitors separately

# Load a RAW file, load the monitors into a separate workspace
dataws,monitorws = Load('HRP39180.RAW',LoadMonitors='Separate')
print('Data workspace has {} spectra'.format(dataws.getNumberHistograms()))

print('Monitor workspace has {} spectra'.format(monitorws.getNumberHistograms()))
# Check that the detector in the first histogram of the monitor workspace is a monitor
detid = monitorws.getSpectrum(0).getDetectorIDs()[0]
print('Is detector {} a monitor? {}'.format(detid, monitorws.getInstrument().getDetector(detid).isMonitor()))

# Check that the detector in the second histogram of the monitor workspace is a monitor
detid = monitorws.getSpectrum(1).getDetectorIDs()[0]
print('Is detector {} a monitor? {}'.format(detid, monitorws.getInstrument().getDetector(detid).isMonitor()))

Output:

Data workspace has 2888 spectra
Monitor workspace has 2 spectra
Is detector 1001 a monitor? True
Is detector 1002 a monitor? True

Categories: AlgorithmIndex | DataHandling\Raw

Source

C++ header: LoadRaw3.h

C++ source: LoadRaw3.cpp