\(\renewcommand\AA{\unicode{x212B}}\)
LoadAndApplyMuonDetectorGrouping v1¶
Summary¶
Load a file containing grouping/pairing infromation (XML format) and apply the grouping and pairing analysis to the input workspace.
See Also¶
MuonProcess, ApplyMuonDetectorGrouping, ApplyMuonDetectorGroupPairing
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
Filename |
Input |
string |
Mandatory |
The XML file containing the grouping and pairing information. Allowed extensions: [‘.xml’] |
InputWorkspace |
Input |
Mandatory |
Input workspace containing data from detectors that the grouping/pairing will be applied to. |
|
WorkspaceGroup |
InOut |
WorkspaceGroup |
The workspaces created by the algorithm will be placed inside this group. If not specified will save to “MuonAnalysisGroup” |
|
AddGroupingTable |
Input |
boolean |
False |
Whether to add a TableWorkspace of the groupings to the ADS. |
CropWorkspaces |
Input |
boolean |
False |
Whether to crop the x-axis of the output workspaces. |
TimeMin |
Input |
number |
0 |
Start time for the data in mus. |
TimeMax |
Input |
number |
32 |
End time for the data in mus. |
ApplyAsymmetryToGroups |
Input |
boolean |
False |
Whether to calculate group asymmetry and store the workspaces. |
AsymmetryTimeMin |
Input |
number |
Optional |
Start time for the group asymmetry calculation (micro seconds). |
AsymmetryTimeMax |
Input |
number |
Optional |
End time for the group asymmetry calculation (micro seconds). |
RebinArgs |
Input |
string |
Rebin arguments. No rebinning if left empty. |
|
TimeOffset |
Input |
number |
0 |
Shift the times of all data by a fixed amount (in micro seconds). The value given corresponds to the bin that will become 0.0 seconds. |
SummedPeriods |
Input |
string |
1 |
A list of periods to sum in multiperiod data. |
SubtractedPeriods |
Input |
string |
A list of periods to subtract in multiperiod data. |
|
DeadTimeTable |
Input |
Table with dead time information, used to apply dead time correction. |
Description¶
When interacting with the Muon Analysis GUI, the contents of the grouping and pairing table can be saved to an XML format ‘grouping file’. This algorithms loads the grouping file and applies all the grouping/asymmetry analysis stored in the file, saving the resulting workspaces with the same naming format as the Muon Analysis GUI.
The analysis is performed via the ApplyMuonDetectorGrouping v1 and ApplyMuonDetectorGroupPairing v1 algorithms, which handle the grouping (counts or group-asymmetry, see EstimateMuonAsymmetryFromCounts v1) and pairing (pair-asymmetry, see CalculateMuonAsymmetry v1) respectively.
Analysis¶
All the grouping information (the groupings of detector IDs, and the pairs of groups) is loaded from the XML file specified by the Filename property. This information specifies how to perform grouping/pairing analysis on the contents of InputWorkspace, which are saved to WorkspaceGroup.
If WorkspaceGroup is not specified then the default format is “<INSTRUMENT><RUN NUMBER>” where for example if the data is from the “EMU” instrument for run number “12345” the name would be “EMU00012345”, with the run numbers padded by zero up to 8 digits. If the instrument is not recognized (e.g. “LHC”) run numbers below 100 are padded to three digits with zeros, so for run number 10 this would be “LHC010”.
Rebinning is optional and can be achieved through the RebinArgs property (using syntax as in Rebin v1). Each time a group or pair is analysed, two workspaces are added to WorkspaceGroup; the one ending in “_Raw” has no rebinning applied. If the RebinArgs property is not set then these workspaces will simply be duplicates of each other.
The entire time axis can be shifted by a given amount using the TimeOffset parameter.
An option exists to apply dead time correction to the y-values of some or all of the spectra in the InputWorkspace, before carrying out the asymmetry analysis. This requires a DeadTimeTable with the format as in ApplyDeadTimeCorr v1.
Multiple period data is supported, allowing both +/- operations to be applied to periods through the SummedPeriods and SubtractedPeriods properties, which are comma-separated lists of periods to combine (numbering starts from 1). Note that summation is applied before asymmetry operations and subtraction is applied after asymmetry operations.
For example, setting SummedPeriods to “1,2” and SubtractedPeriods to “3,4” would result in the period spectra being combined in the form \((1+2)-(3+4)\). To see how this would be done, we will assume two groups “group1” groups detectors “6-10” and “group2” groups detectors “11-15”, then “pair1” is the asymmetry between these two groups. For the pair asymmetry calculation this would involve the following steps :
The group counts are produced according to the grouping information, so the count spectra for IDs 6-10 (11-15) are summed and become “group1” (“group2”). Each period has its own summation applied.
For both groups the period sum “1+2” and “3+4” is done.
The asymmetry between group1/group2 is calculated twice (one for the “1+2”/”3+4” period combinations)
These asymmetries are subtracted to give the final result.
The workspaces which hold the analysed data are stored in the WorkspaceGroup, using a unique name (see ApplyMuonDetectorGrouping v1 and ApplyMuonDetectorGroupPairing v1 for details).
The algorithm will work with XML files as output by the Save Grouping button in the Grouping Options tab of the current Muon Analysis GUI.
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.
Note
For examples of applying custom dead times, please refer to ApplyDeadTimeCorr v1 documentation.
For examples of applying custom grouping, please refer to MuonGroupDetectors v1 documentation.
For examples of applying custom rebinning, please refer to Rebin v1 documentation.
Example - Pair asymmetry for MUSR run:
Output:
# Clear the ADS before starting
AnalysisDataService.clear()
# Create the workspace group in which the analysed workspaces will be placed
ws = CreateSampleWorkspace()
wsGroup = GroupWorkspaces("ws")
RenameWorkspace(
InputWorkspace="wsGroup",
OutputWorkspace='MUSR00015189',
OverwriteExisting=True)
# Load the data
LoadMuonNexus( Filename='MUSR00015189.nxs',
OutputWorkspace='MuonAnalysis')
LoadAndApplyMuonDetectorGrouping(
Filename='MUSRGrouping.xml',
InputWorkspace='MuonAnalysis',
WorkspaceGroup='MUSR00015189',
ApplyAsymmetryToGroups=False)
MUSR_asym = mtd["MUSR00015189; Pair; long; Asym; #1"]
print(map('{0:.2f}'.format, MUSR_asym.readY(0)[1:10]))
Output:
['0.00', '-1.00', '0.00', '0.33', '0.31', '0.27', '0.37', '0.32', '0.21']
Categories: AlgorithmIndex | Muon\DataHandling
Source¶
C++ header: LoadAndApplyMuonDetectorGrouping.h
C++ source: LoadAndApplyMuonDetectorGrouping.cpp