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

Load v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Attempts to load a given file by finding an appropriate Load algorithm.

See Also

LoadNexus, LoadRaw, LoadBBY

This algorithm is also known as: load

Properties

Name

Direction

Type

Default

Description

Filename

Input

list of str lists

Mandatory

The name of the file(s) to read, including the full or relative path. (N.B. case sensitive if running on Linux). Multiple runs can be loaded and added together, e.g. INST10,11+12,13.ext. Allowed extensions: [‘.nxs’, ‘.raw’, ‘.sav’, ‘.n*’, ‘.s*’, ‘.add’, ‘.nxspe’, ‘.xml’, ‘.dat’, ‘.txt’, ‘.csv’, ‘.spe’, ‘.grp’, ‘.h5’, ‘.hd5’, ‘.sqw’, ‘.fits’, ‘.bin’, ‘.edb’]

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. Some algorithms can created additional OutputWorkspace properties on the fly, e.g. multi-period data.

LoaderName

Output

string

When an algorithm has been found that will load the given file, its name is set here.

LoaderVersion

Output

number

When an algorithm has been found that will load the given file, its version is set here.

Description

The Load algorithm is a more intelligent algorithm than most other load algorithms. When passed a filename it attempts to search the existing load algorithms and find the most appropriate to load the given file. The specific load algorithm is then run as a child algorithm with the exception that it logs messages to the Mantid logger.

Filename Property

The Load algorithm changes the default Filename property to a MultipleFileProperty and follows its syntax.

Specific Load Algorithm Properties

Each specific loader will have its own properties that are appropriate to it: SpectrumMin and SpectrumMax for ISIS RAW/NeXuS, FilterByTof_Min and FilterByTof_Max for Event data. The Load algorithm cannot know about these properties until it has been told the filename and found the correct loader. Once this has happened the properties of the specific Load algorithm are redeclared on to that copy of Load.

Loading Nexus files

When the file to be loaded is a Nexus file, the type nexus file loaded is determined by its group structure.

If the nexus file has a group of type NXevent_data, then LoadEventNexus v1 will be run. Else if the nexus file has a /raw_data_1 path, then LoadISISNexus v2 will be run and it will only load data within the group with this pathname. Also a nexus file with certain groups present will be loaded by LoadMuonNexus v2. A nexus file with a group of path /mantid_workspace_1 is loaded by LoadNexusProcessed v2. See the specific load algorithms for more details.

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 - Load ISIS histogram Nexus file: (see LoadISISNexus v2 for more options)

# Load ISIS LOQ histogram dataset
ws = Load('LOQ49886.nxs')

print("The 1st x-value of the first spectrum is: {}".format(ws.readX(0)[0]))

Output:

The 1st x-value of the first spectrum is: 5.0

Example - Load SNS/ISIS event Nexus file: (see LoadEventNexus v1 for more options)

# Load SNS HYS event dataset
ws = Load('HYS_11092_event.nxs')

print("The number of histograms (spectra) is: {}".format(ws.getNumberHistograms()))

Output:

The number of histograms (spectra) is: 20480

Example - Load ISIS Muon file: (see LoadMuonNexus v2 for more options)

# Load ISIS multiperiod muon MUSR dataset
ws = Load('MUSR00015189.nxs')

print("The number of periods (entries) is: {}".format(ws[0].getNumberOfEntries()))

Output:

The number of periods (entries) is: 2

Example - Load Mantid processed Nexus file ISIS: (see LoadNexusProcessed v2 for more options)

# Load Mantid processed GEM data file
ws = Load('focussed.nxs')

print("The number of histograms (spectra) is: {}".format(ws.getNumberHistograms()))

Output:

The number of histograms (spectra) is: 6

Categories: AlgorithmIndex | DataHandling

Source

C++ header: Load.h

C++ source: Load.cpp