Table of Contents
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’] |
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.
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.
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.
LoadRaw runs the following algorithms as child algorithms to populate aspects of the output Workspace:
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.
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.
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
C++ source: LoadRaw3.cpp (last modified: 2019-07-17)
C++ header: LoadRaw3.h (last modified: 2018-10-05)