Newer
Older
.. algorithm::
.. summary::
.. alias::
.. properties::
Description
-----------
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.
- TODO get XML descriptions of Muon instruments. This data is not in
existing Muon Nexus files.
- TODO load the spectra detector mapping. This may be very simple for
Muon instruments.
Version Identification
######################
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.
.. _`Version 1 only`:
The following properties apply only to Version 1:
* AutoGroup
* MainFieldDirection
* DeadTimeTable
* DetectorGroupingTable
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.
Errors
The error for each histogram count is set as the square root of the
number of counts.
Details of data loaded
######################
Here are more details of data loaded from the Nexus file:
+----------------------------------+--------------------------------------------+----------------------------------------+
| Description of Data | Found in Nexus file | Placed in Workspace (Workspace2D) |
| | (within the main entry) | or output |
+==================================+============================================+========================================+
| Detector Data | First group of class NXData | Histogram Data of workspace |
| | (henceforth referred as [DET]) | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Instrument | group ``Instrument`` | Workspace instrument |
| | | as loaded by LoadInstrumentFromNexus |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Spectrum of each workspace index | [DET]``/spectrum_index`` | Spectra-Detector mapping of workspace |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Title (optional) | ``title`` | ``title`` in workspace |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Note orcomment (optional) | ``note`` | ``comment`` in workspace |
+----------------------------------+--------------------------------------------+----------------------------------------+
| Time Zero (optional) | ``instrument/detector_fb/time_zero`` | TimeZero property |
| | if found | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| First good time (optional) | ``instrument/detector_fb/first_good_time`` | FirstGoodData property |
| | if found | |
+----------------------------------+--------------------------------------------+----------------------------------------+
| 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 |
+----------------------------------+--------------------------------------------+----------------------------------------+
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.
Child Algorithms used
#####################
The ChildAlgorithms used by LoadMuonNexus are:
- :ref:`algm-LoadMuonNexus-v1` - this loads the muon nexus file if not identified as
version 2. It in turn uses the following child algorithm:
- :ref:`algm-LoadMuonLog` - this reads log information from the Nexus file and uses
it to create TimeSeriesProperty entries in the workspace.
- :ref:`algm-LoadInstrument` - this algorithm looks for an XML description of the
instrument and if found reads it.
- :ref:`algm-LoadInstrumentFromNexus` - this is called if the normal
LoadInstrument fails. As the Nexus file has limited instrument data,
this only populates a few fields.
Previous Versions
-----------------
Version 1
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 :ref:`algm-LoadMuonNexus-v1` for more details about version 1.
Some algorithm properties apply to `Version 1 only`_.
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
Usage
-----
.. include:: ../usagedata-note.txt
**Example - Load ISIS muon MUSR dataset:**
.. testcode:: LoadMuonNexusOnePeriod
# Load MUSR dataset
ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
print "Workspace has ", ws[0].getNumberHistograms(), " spectra"
Output:
.. testoutput:: LoadMuonNexusOnePeriod
Workspace has 64 spectra
**Example - Load event nexus file with time filtering:**
.. testcode:: ExLoadMuonNexusSomeSpectra
# Load some spectra
ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
print "Workspace has ", ws[0].getNumberHistograms(), " spectra"
Output:
.. testoutput:: ExLoadMuonNexusSomeSpectra
Workspace has 6 spectra
**Example - Load dead times into table:**
.. testcode:: ExLoadDeadTimeTable
# 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:
.. testoutput:: ExLoadDeadTimeTable
5 0.00161112251226
6 0.00215016817674
7 0.0102171599865
8 0.00431686220691
9 0.00743605662137
10 0.00421147653833
**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::
.. sourcelink::