\(\renewcommand\AA{\unicode{x212B}}\)
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 Load 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’, ‘.nxs_v2’] |
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 | 0 | |
SpectrumMax | Input | number | Optional | |
SpectrumList | Input | int list | ||
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 (default longitudinal). 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) | |
TimeZeroList | Output | dbl list | A vector of time zero values | |
TimeZeroTable | Output | Workspace | TableWorkspace containing time zero values per spectra. | |
CorrectTime | Input | boolean | True | Boolean flag controlling whether time should be corrected by timezero. |
DeadTimeTable | Output | Workspace | Table or a group of tables containing detector dead times. | |
DetectorGroupingTable | Output | Workspace | Table or a group of tables with information about the detector grouping. |
The algorithm LoadMuonNexusV2 will read a Muon Nexus data file 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 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.
Note: Currently only single period loading is supported
To be identified as a Muon nexus V2 file, the nexus file must have the top level entry /raw_data_1
so it can be loaded using the LoadISISNexus child algorithm, see LoadISISNexus v2.
As well as the raw_data_1 entry, the file should also have an
IDF_version
group with value 2
and a definition
group, with string value "muonTD"
or "pulsedTD"
.
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.
In the table below details of the information loaded is shown, for more information see LoadISISNexus v2.
Description of Data | Found in Nexus file (within the raw_data_1 entry) | Placed in Workspace (Workspace2D) or output |
---|---|---|
Detector Data | /detector_1 |
Histogram Data of workspace |
Instrument | /instrument |
Workspace instrument as loaded by LoadInstrumentFromNexus |
Spectrum of each workspace index | /detector_1/spectrum_index |
Spectra-Detector mapping of workspace (assume 1-1 mapping) |
Time Zero | instrument/detector_1/time_zero
if found |
TimeZero property |
Time Zero Vector | instrument/detector_1/time_zero can be
a single value or an array. This contains
either the the values from the array or the
single value expanded into a vector |
TimeZeroList property |
First good time | instrument/detector_1/first_good_bin
and instrument/detector_1/resolution |
FirstGoodData property |
Nexus logs | /runlog entry |
Sample logs, loaded using LoadNexusLogs |
Mainfield direction | instrument/detector_1/orientation entry
if found, else assumed Longitudinal |
MainFieldDirection Property |
Deadtime table | instrument/detector_1/dead_time entry |
Deadtime table |
LoadMuonNexusV2 uses LoadNexusLogs LoadNexusLogs v1.to load the run logs. Information is loaded from the /raw_data_1/runlog entry. Additionally, LoadMuonNexusV2 loads the sample log entries from /raw_data_1/sample entry, which contains the following:
Nexus | Workspace run object |
---|---|
magnetic_field | sample_magn_field |
temperature | sample_temp |
The spectrum numbers are in run/detector_1/spectrum_index
and a one-one correspondence between
spectrum number and detector ID is assumed.
Example - Load ISIS muon MUSR dataset:
# Load MUSR dataset
ws = LoadMuonNexusV2(Filename="EMU00102347.nxs_v2")
print("Workspace has {} spectra".format(ws[0].getNumberHistograms()))
Output:
Workspace has 96 spectra
Example - Load event nexus file with time filtering:
# Load some spectra
ws = LoadMuonNexusV2(Filename="EMU00102347.nxs_v2",SpectrumMin=5,SpectrumMax=10)
print("Workspace has {} spectra".format(ws[0].getNumberHistograms()))
Output:
Workspace has 6 spectra
Example - Load dead times into table:
# Load some spectra
ws = LoadMuonNexusV2(Filename="EMU00102347.nxs_v2",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
tab = mtd['deadTimeTable']
for i in range(0,tab.rowCount()):
print("{} {:.12f}".format(tab.cell(i,0), tab.cell(i,1)))
Output:
5 0.007265590131
6 0.006881169975
7 -0.003046069993
8 0.006345409900
9 0.007483229972
10 -0.010110599920
Example -Time zero loading:
# Load some spectra
ws, main_field_direction, time_zero, first_good_data, time_zero_list, time_zero_table, dead_time_table, detector_grouping_table = \
LoadMuonNexusV2(Filename="EMU00102347.nxs_v2",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable",TimeZeroTable="timeZeroTable")
print('Single time zero value is {:.2g}'.format(time_zero))
print("TimeZeroList values are:")
for timeZero in time_zero_list:
print(round(timeZero, 2))
Output:
Single time zero value is 0.16
TimeZeroList values are:
0.16
0.16
0.16
0.16
0.16
0.16
Example - Test loading a multi period file:
# Load a multi period file
load_muon_alg = LoadMuonNexusV2(Filename="EMU00103767.nxs_v2")
# The workspace is the first return value from the Loader.
wsGroup = load_muon_alg[0]
print("Workspace Group has {} workspaces".format(wsGroup.getNumberOfEntries()))
for i in range(wsGroup.getNumberOfEntries()):
print("Workspace has {} spectra".format(wsGroup.getItem(i).getNumberHistograms()))
Output:
Workspace Group has 4 workspaces
Workspace has 96 spectra
Workspace has 96 spectra
Workspace has 96 spectra
Workspace has 96 spectra
Categories: AlgorithmIndex | DataHandling\Nexus
C++ header: LoadMuonNexusV2.h (last modified: 2020-08-12)
C++ source: LoadMuonNexusV2.cpp (last modified: 2021-03-31)