Commit 6b0f7d17 authored by Stephen's avatar Stephen
Browse files

Add documentation for algorithm.

parent 44b0f664
......@@ -27,11 +27,6 @@ data
(a multiperiod file will store higher periods in workspaces called
OutputWorkspace_PeriodNo)
[ not yet implemented for Muon Nexus V2 ]</LI>
</UL>
Optional Properties: (note that these options are not available if reading a
multiperiod file)
<UL>
<LI> spectrum_min - The spectrum to start loading from</LI>
<LI> spectrum_max - The spectrum to load to</LI>
<LI> spectrum_list - An ArrayProperty of spectra to load</LI>
......@@ -47,8 +42,10 @@ public:
const std::string name() const override { return "LoadMuonNexusV2"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Loads a Muon Nexus V2 data file and stores it in a 2D "
"workspace (Workspace2D class).";
return "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.";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusHDF5Descriptor &descriptor) const override;
......@@ -79,7 +76,7 @@ private:
bool m_multiPeriodsLoaded;
// The loading strategy used
std::unique_ptr<LoadMuonStrategy> m_loadMuonStrategy;
};
}; // namespace DataHandling
} // namespace DataHandling
} // namespace Mantid
......@@ -63,8 +63,10 @@ int LoadMuonNexusV2::confidence(NexusHDF5Descriptor &descriptor) const {
}
/// Initialization method.
void LoadMuonNexusV2::init() {
declareProperty(std::make_unique<FileProperty>("Filename", "",
FileProperty::Load, ".nxs"),
std::vector<std::string> extensions{".nxs", ".nxs_v2"};
declareProperty(std::make_unique<FileProperty>(
"Filename", "", FileProperty::Load, extensions),
"The name of the Nexus file to load");
declareProperty(
......@@ -90,8 +92,7 @@ void LoadMuonNexusV2::init() {
declareProperty("MainFieldDirection", "Transverse",
std::make_shared<StringListValidator>(FieldOptions),
"Output the main field direction if specified in Nexus file "
"(run/instrument/detector/orientation, default "
"longitudinal).",
"(default longitudinal).",
Direction::Output);
declareProperty("TimeZero", 0.0,
......@@ -110,7 +111,7 @@ void LoadMuonNexusV2::init() {
"DetectorGroupingTable", "", Direction::Output,
PropertyMode::Optional),
"Table or a group of tables with information about the "
"detector grouping stored in the file (if any).");
"detector grouping.");
}
void LoadMuonNexusV2::execLoader() {
this->setRethrows(true);
......
......@@ -70,8 +70,7 @@ loadDetectorGroupingFromNexus(const NXEntry &entry,
std::string loadMainFieldDirectionFromNexus(const NeXus::NXEntry &entry) {
std::string mainFieldDirection = "Longitudinal"; // default
try {
NXChar orientation =
entry.openNXChar("run/instrument/detector/orientation");
NXChar orientation = entry.openNXChar("instrument/detector_1/orientation");
// some files have no data there
orientation.load();
if (orientation[0] == 't') {
......
7a1a43edf3e0172536c9995449e41ba5
......@@ -216,22 +216,6 @@ Output:
9 0.007436056621
10 0.004211476538
**Example - Load detector grouping into table:**
.. testcode:: ExLoadDetectorGrouping
# 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:
.. testoutput:: ExLoadDetectorGrouping
[ 1 16]
[17 32]
.. categories::
......
.. algorithm::
.. summary::
.. relatedalgorithms::
.. properties::
Description
-----------
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**
File Identification
######################
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 :ref:`algm-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"``.
Time series data
################
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.
Details of data loaded
######################
In the table below details of the information loaded is shown, for more information see :ref:`algm-LoadISISNexus-v2`.
+----------------------------------+--------------------------------------------+----------------------------------------+
| Description of Data | Found in Nexus file | Placed in Workspace (Workspace2D) |
| | (within the raw_data_1 entry) | 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`` | TimeZero property |
| | if found | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| First good time | ``instrument/detector_1/first_good_bin`` | FirstGoodData property |
| | and ``instrument/detector_1/resolution`` | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Nexus logs | ``/runlog`` entry | Sample logs, loaded using LoadNexusLogs|
+----------------------------------+--------------------------------------------+----------------------------------------+
| Mainfield direction | ``instrument/detector_1/orientation`` entry| MainFieldDirection Property |
| | if found, else assumed Longitudinal | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Deadtime table | ``instrument/detector_1/dead_time`` entry | Deadtime table |
+----------------------------------+--------------------------------------------+----------------------------------------+
Run Object
''''''''''
LoadMuonNexusV2 uses LoadNexusLogs :ref:`algm-LoadNexusLogs`.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`` |
+---------------------------+----------------------------------+
Spectra-detector mapping
''''''''''''''''''''''''
The spectrum numbers are in ``run/detector_1/spectrum_index`` and a one-one correspondence between
spectrum number and detector ID is assumed.
Usage
-----
**Example - Load ISIS muon MUSR dataset:**
.. testcode:: LoadMuonNexusV2OnePeriod
# Load MUSR dataset
ws = LoadMuonNexusV2(Filename="EMU00103638.nxs_v2")
print("Workspace has {} spectra".format(ws[0].getNumberHistograms()))
Output:
.. testoutput:: LoadMuonNexusV2OnePeriod
Workspace has 96 spectra
**Example - Load event nexus file with time filtering:**
.. testcode:: ExLoadMuonNexusV2SomeSpectra
# Load some spectra
ws = LoadMuonNexusV2(Filename="EMU00103638.nxs_v2",SpectrumMin=5,SpectrumMax=10)
print("Workspace has {} spectra".format(ws[0].getNumberHistograms()))
Output:
.. testoutput:: ExLoadMuonNexusV2SomeSpectra
Workspace has 6 spectra
**Example - Load dead times into table:**
.. testcode:: ExLoadDeadTimeTable
# Load some spectra
ws = LoadMuonNexusV2(Filename="EMU00103638.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:
.. testoutput:: ExLoadDeadTimeTable
5 0.007265590131
6 0.006881169975
7 -0.003046069993
8 0.006345409900
9 0.007483229972
10 -0.010110599920
.. categories::
.. sourcelink::
:h: Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexusV2.h
:cpp: Framework/DataHandling/src/LoadMuonNexusV2.cpp
\ No newline at end of file
......@@ -29,6 +29,7 @@ New Features
- On the fitting tab, only one fit object (fit output and input workspaces) will be shown at a time.
- Addition of background correction algorithm (PSIBackgroundCorrection) to remove the background present in
PSI bin data loaded using LoadPSIMuonBin.
- Addition of a LoadMuonNexusV2 algorithm to load the new Muon V2 files, see :ref:`LoadMuonNexusV2 <algm-LoadMuonNexusV2>`.
Improvements
-------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment