Table of Contents
The LoadMuonNexus algorithm will read the given NeXus Muon data file Version 2 and use the results to populate the named workspace. LoadMuonNexus may be invoked by LoadNexus if it is given a NeXus file of this type.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Filename | Input | string | Mandatory | The name of the Nexus file to load. Allowed extensions: [‘.nxs’] |
OutputWorkspace | Output | Workspace | Mandatory | The name of the workspace to be created as the output of the algorithm. For multiperiod files, one workspace will be generated for each period |
SpectrumMin | Input | number | Optional | Index number of the first spectrum to read (default 1) |
SpectrumMax | Input | number | Optional | Index of last spectrum to read (default the last spectrum) |
SpectrumList | Input | int list | Array, or comma separated list, of indexes of spectra to load. If a range and a list of spectra are both supplied, all the specified spectra will be loaded. | |
AutoGroup | Input | boolean | False | Determines whether the spectra are automatically grouped together based on the groupings in the NeXus file, only for single period data (default no). Version 1 only. |
EntryNumber | Input | number | 0 | 0 indicates that every entry is loaded, into a separate workspace within a group. A positive number identifies one entry to be loaded, into one workspace |
MainFieldDirection | Output | string | Output the main field direction if specified in Nexus file (run/instrument/detector/orientation, default longitudinal). Version 1 only. Allowed values: [‘Transverse’, ‘Longitudinal’] | |
TimeZero | Output | number | Time zero in units of micro-seconds (default to 0.0) | |
FirstGoodData | Output | number | First good data in units of micro-seconds (default to 0.0) | |
DeadTimeTable | Output | Workspace | Table or a group of tables containing detector dead times. Version 1 only. | |
DetectorGroupingTable | Output | Workspace | Table or a group of tables with information about the detector grouping stored in the file (if any). Version 1 only. |
The algorithm LoadMuonNexus will read a Muon Nexus data file (original format) and place the data into the named workspace. The file name can be an absolute or relative path and should have the extension .nxs or .NXS. If the file contains data for more than one period, a separate workspace will be generated for each. After the first period the workspace names will have “_2”, “_3”, and so on, appended to the given workspace name. For single period data, the optional parameters can be used to control which spectra are loaded into the workspace. If spectrum_min and spectrum_max are given, then only that range to data will be loaded. If a spectrum_list is given than those values will be loaded.
To be identified as a version 2 muon nexus file, the nexus file must have a IDF_version or idf_version item in its main group with an integer value of 2 and also a definition item with string value "muonTD" or "pulsedTD", else it will be identified as version 1.
The following properties apply only to Version 1:
The log data in the Nexus file (NX_LOG sections) will be loaded as TimeSeriesProperty data within the workspace. Time is stored as seconds from the Unix epoch.
Here are more details of data loaded from the Nexus file:
Description of Data | Found in Nexus file (within the main entry) | Placed in Workspace (Workspace2D) or output |
---|---|---|
Detector Data | First group of class NXData (henceforth referred as [DET]) | Histogram Data of workspace |
Instrument | group Instrument | Workspace instrument as loaded by LoadInstrumentFromNexus |
Spectrum of each workspace index | [DET]``/spectrum_index`` | Spectra-Detector mapping of workspace (see below) |
Title (optional) | title | title in workspace |
Note orcomment (optional) | note | comment in workspace |
Time Zero (optional) | instrument/detector_fb/time_zero if found | TimeZero property |
First good time (optional) | instrument/detector_fb/first_good_time if found | FirstGoodData property |
Run | various places as shown later on | Run object of workspace |
Sample name | sample/name | name in Sample Object of workspace |
Time series | sample/ groups of class NXLog | time series log in run object |
LoadMuonNexus does not run LoadNexusLogs to load run logs. Information is loaded as follows:
Nexus | Workspace run object |
---|---|
title | run_title |
(data) | nspectra |
start_time | run_start |
end_time | run_end |
run/good_total_frames | goodfrm |
run/number_periods | nperiods |
(start & end times) | dur_secs |
(data) indicates that the number is got from the histogram data in an appropiate manner.
Unlike muon v1 NeXus files, v2 files have the possibility that one spectrum maps to multiple detectors. This mapping is handled as follows:
The spectrum numbers are in run/detector_fb/spectrum_index.
The spectrum spectrum_index[j] maps to detector_count[j] detectors. Their detector IDs are contained in detector_list, starting at the index detector_index[j].
If the above optional entries detector_count, detector_list and detector_index are not present in the file, it is assumed that the mapping is one-to-one (spectrum number = detector ID). This is the case for most ISIS data at the moment.
The ChildAlgorithms used by LoadMuonNexus are:
Version 1 supports the loading version 1.0 of the muon nexus format. This is still in active use, if the current version of LoadMuonNexus detects that it has been asked to load a previous version muon nexus file it will call the previous version of the algorithm to perform the task.
See LoadMuonNexus v1 for more details about version 1.
Some algorithm properties apply to Version 1 only.
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 - Load ISIS muon MUSR dataset:
# Load MUSR dataset
ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
print "Workspace has ", ws[0].getNumberHistograms(), " spectra"
Output:
Workspace has 64 spectra
Example - Load event nexus file with time filtering:
# Load some spectra
ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
print "Workspace has ", ws[0].getNumberHistograms(), " spectra"
Output:
Workspace has 6 spectra
Example - Load dead times into table:
# Load some spectra
ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
tab = mtd['deadTimeTable']
for i in range(0,tab.rowCount()):
print tab.cell(i,0), tab.cell(i,1)
Output:
5 0.00161112251226
6 0.00215016817674
7 0.0102171599865
8 0.00431686220691
9 0.00743605662137
10 0.00421147653833
Example - Load detector grouping into table:
# Load some spectra
ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable")
tab = mtd['detectorTable']
for i in range(0,tab.rowCount()):
print tab.cell(i,0)
Output:
[ 1 16]
[17 32]
Categories: Algorithms | DataHandling\Nexus | Muon\DataHandling