\(\renewcommand\AA{\unicode{x212B}}\)
ApplyMuonDetectorGroupPairing v1¶
Summary¶
Perform an asymmetry analysis on two groupings of muon detectors.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspaceGroup |
InOut |
WorkspaceGroup |
Mandatory |
The workspace group to which the output will be added. |
PairName |
Input |
string |
The name of the pair. Must contain at least one alphanumeric character. |
|
Alpha |
Input |
number |
1 |
Alpha parameter used in the asymmetry calculation. |
SpecifyGroupsManually |
Input |
boolean |
False |
Specify the pair of groups manually using the raw data and various optional parameters. |
InputWorkspace1 |
Input |
Input workspace containing data from grouped detectors. |
||
InputWorkspace2 |
Input |
Input workspace containing data from grouped detectors. |
||
InputWorkspace |
Input |
Input workspace containing data from detectors which are to be grouped. |
||
Group1 |
Input |
string |
1 |
The grouping of detectors, comma separated list of detector IDs or hyphenated ranges of IDs. |
Group2 |
Input |
string |
1 |
The grouping of detectors, comma separated list of detector IDs or hyphenated ranges of IDs. |
TimeMin |
Input |
number |
0.1 |
Start time for the data in micro seconds. Only used with the asymmetry analysis. |
TimeMax |
Input |
number |
32 |
End time for the data in micro seconds. Only used with the asymmetry analysis. |
RebinArgs |
Input |
string |
Rebin arguments. No rebinning if left empty. |
|
TimeOffset |
Input |
number |
0 |
Shift the times of all data by a fixed amount. The value given corresponds to the bin that will become time 0.0. |
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. |
|
ApplyDeadTimeCorrection |
Input |
boolean |
False |
Whether dead time correction should be applied to input workspace |
DeadTimeTable |
Input |
Table with dead time information. Must be specified if ApplyDeadTimeCorrection is set true. |
Description¶
The algorithm is essentially a wrapper around the MuonProcess v1 algorithm, performing an asymmetry calculation on a pair of groups of detectors. These groups may be specified manually, allowing various processing options such as rebinning and dead time correction, or alternatively the algorithm accepts two workspaces which are assumed to contain the processed groups as a single spectra.
The result of the calculation are stored in the provided WorkspaceGroup using a unique name.
Analysis¶
This algorithm performs the PairAsymmetry option of the MuonProcess v1 algorithm, requiring two items of data; spectra corresponding to the groups of detector IDs. This can be given directly to the algorithm via the InputWorkspace1 and InputWorkspace2 properties, which accept MatrixWorkspaces with single spectra and identical binning. The pair asymmetry is calculated between the times TimeMin and TimeMax, and using the Alpha parameter (see CalculateMuonAsymmetry v1 for details).
Alternatively by checking setting SpecifyGroupsManually to true the groupings can be performed as part of the algorithm (requiring the full, ungrouped, data in InputWorkspace).
In this case Group1 and Group2 are separator or range based lists (e.g. “1,2,3-6,7”) of detector IDs.
Rebbing is optional and can be achieved through the Rebin property (using syntax as in Rebin v1).
The way in which multi period data is combined before the analysis is determined by SummedPeriods and SubtractedPeriods. 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)\).
Note that the action of SummedPeriods and SubtractedPeriods is performed before the asymmetry analysis.
The workspaces which hold the analysed data are stored in the WorkspaceGroup, using a unique name. As an example, from the following variables :
The InputWorkspaceGroup name is “inputGroup”
PairName is “test”
SummedPeriods is “1,2”
SubtractedPeriods is “3,4”
then the name would be “inputGroup; Pair; test; Asym; 1+2-3+4; #1”. A second workspace is also created with the same name, but ending in “#1_Raw”, the only difference being that the RebinArgs are not applied to the latter workspace. For single period data the name would instead be “inputGroup; Pair; test; Asym; #1”.
An option exists to apply dead time correction to the counts if ApplyDeadTimeCorrection is true, requiring a DeadTimeTable with the format as in ApplyDeadTimeCorr v1.
The TimeOffset parameter shifts the time axis to start at the given time (all bins are offset by the value). In MuonProcess v1 this is equivalent to LoadedTimeZero - TimeZero. Note that the TimeMin and TimeMax refer to the values before the offset is applied.
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:
# 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='MUSR00015193',
OverwriteExisting=True)
# Load the data
LoadMuonNexus( Filename='MUSR00015193.nxs',
OutputWorkspace='MuonAnalysis')
# Create two detector groupings
ApplyMuonDetectorGrouping(
InputWorkspace='MuonAnalysis',
InputWorkspaceGroup='MUSR00015193',
GroupName='fwd',
Grouping='1-32'
)
ApplyMuonDetectorGrouping(
InputWorkspace='MuonAnalysis',
InputWorkspaceGroup='MUSR00015193',
GroupName='bwd',
Grouping='33-64'
)
# Add the groupings to the group workspace
wsGroup.add('MUSR00015193; Group; fwd; Counts; #1_Raw')
wsGroup.add('MUSR00015193; Group; bwd; Counts; #1_Raw')
# Apply the pairing algorithm to the two groups
ApplyMuonDetectorGroupPairing(
InputWorkspaceGroup='MUSR00015193',
PairName='pairTest',
Alpha=1.0,
SpecifyGroupsManually=False,
InputWorkspace1='MUSR00015193; Group; fwd; Counts; #1_Raw',
InputWorkspace2='MUSR00015193; Group; bwd; Counts; #1_Raw'
)
output = mtd['MUSR00015193; Pair; pairTest; Asym; #1_Raw']
print('{:.8f}'.format(output.readY(0).mean()))
Output:
-0.01419801
Categories: AlgorithmIndex | Muon\DataHandling
Source¶
C++ header: ApplyMuonDetectorGroupPairing.h
C++ source: ApplyMuonDetectorGroupPairing.cpp