Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
897dbd23
Commit
897dbd23
authored
6 years ago
by
WHITFIELDRE email
Browse files
Options
Downloads
Patches
Plain Diff
Add Mask workspace option to WANDPowderReduction
parent
5da22c7f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/WANDPowderReduction.py
+16
-4
16 additions, 4 deletions
...gins/algorithms/WorkflowAlgorithms/WANDPowderReduction.py
docs/source/release/v3.14.0/diffraction.rst
+1
-0
1 addition, 0 deletions
docs/source/release/v3.14.0/diffraction.rst
with
17 additions
and
4 deletions
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/WANDPowderReduction.py
+
16
−
4
View file @
897dbd23
from
__future__
import
absolute_import
,
division
,
print_function
from
mantid.api
import
(
DataProcessorAlgorithm
,
AlgorithmFactory
,
MatrixWorkspaceProperty
,
PropertyMode
)
from
mantid.dataobjects
import
MaskWorkspaceProperty
from
mantid.simpleapi
import
(
ConvertSpectrumAxis
,
Transpose
,
ResampleX
,
CopyInstrumentParameters
,
Divide
,
DeleteWorkspace
,
Scale
,
MaskAngle
,
ExtractMask
,
Minus
,
RemoveMaskedSpectra
,
mtd
)
ExtractUnmaskedSpectra
,
mtd
,
BinaryOperateMasks
)
from
mantid.kernel
import
StringListValidator
,
Direction
,
Property
,
FloatBoundedValidator
...
...
@@ -48,6 +50,11 @@ class WANDPowderReduction(DataProcessorAlgorithm):
validator
=
FloatBoundedValidator
(
0.0
),
doc
=
"
The background will be scaled by this number before being subtracted.
"
)
self
.
declareProperty
(
MaskWorkspaceProperty
(
"
MaskWorkspace
"
,
''
,
optional
=
PropertyMode
.
Optional
,
direction
=
Direction
.
Input
),
doc
=
'
The mask from this workspace will be applied before reduction
'
)
self
.
copyProperties
(
'
ConvertSpectrumAxis
'
,
[
'
Target
'
,
'
EFixed
'
])
self
.
copyProperties
(
'
ResampleX
'
,
[
'
XMin
'
,
'
XMax
'
,
'
NumberBins
'
,
'
LogBinning
'
])
...
...
@@ -65,6 +72,7 @@ class WANDPowderReduction(DataProcessorAlgorithm):
data
=
self
.
getProperty
(
"
InputWorkspace
"
).
value
cal
=
self
.
getProperty
(
"
CalibrationWorkspace
"
).
value
bkg
=
self
.
getProperty
(
"
BackgroundWorkspace
"
).
value
mask
=
self
.
getProperty
(
"
MaskWorkspace
"
).
value
target
=
self
.
getProperty
(
"
Target
"
).
value
eFixed
=
self
.
getProperty
(
"
EFixed
"
).
value
xMin
=
self
.
getProperty
(
"
XMin
"
).
value
...
...
@@ -88,13 +96,17 @@ class WANDPowderReduction(DataProcessorAlgorithm):
if
maskAngle
!=
Property
.
EMPTY_DBL
:
MaskAngle
(
Workspace
=
'
__mask_tmp
'
,
MinAngle
=
maskAngle
,
Angle
=
'
Phi
'
,
EnableLogging
=
False
)
RemoveMaskedSpectra
(
InputWorkspace
=
data
,
MaskedWorkspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__data_tmp
'
,
EnableLogging
=
False
)
if
mask
is
not
None
:
BinaryOperateMasks
(
InputWorkspace1
=
'
__mask_tmp
'
,
InputWorkspace2
=
mask
,
OperationType
=
'
OR
'
,
OutputWorkspace
=
'
__mask_tmp
'
,
EnableLogging
=
False
)
ExtractUnmaskedSpectra
(
InputWorkspace
=
data
,
MaskWorkspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__data_tmp
'
,
EnableLogging
=
False
)
ConvertSpectrumAxis
(
InputWorkspace
=
'
__data_tmp
'
,
Target
=
target
,
EFixed
=
eFixed
,
OutputWorkspace
=
outWS
,
EnableLogging
=
False
)
Transpose
(
InputWorkspace
=
outWS
,
OutputWorkspace
=
outWS
,
EnableLogging
=
False
)
ResampleX
(
InputWorkspace
=
outWS
,
OutputWorkspace
=
outWS
,
XMin
=
xMin
,
XMax
=
xMax
,
NumberBins
=
numberBins
,
EnableLogging
=
False
)
if
cal
is
not
None
:
RemoveM
askedSpectra
(
InputWorkspace
=
cal
,
Mask
ed
Workspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__cal_tmp
'
,
EnableLogging
=
False
)
ExtractUnm
askedSpectra
(
InputWorkspace
=
cal
,
MaskWorkspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__cal_tmp
'
,
EnableLogging
=
False
)
CopyInstrumentParameters
(
data
,
'
__cal_tmp
'
,
EnableLogging
=
False
)
ConvertSpectrumAxis
(
InputWorkspace
=
'
__cal_tmp
'
,
Target
=
target
,
EFixed
=
eFixed
,
OutputWorkspace
=
'
__cal_tmp
'
,
EnableLogging
=
False
)
Transpose
(
InputWorkspace
=
'
__cal_tmp
'
,
OutputWorkspace
=
'
__cal_tmp
'
,
EnableLogging
=
False
)
...
...
@@ -109,7 +121,7 @@ class WANDPowderReduction(DataProcessorAlgorithm):
Scale
(
InputWorkspace
=
outWS
,
OutputWorkspace
=
outWS
,
Factor
=
cal_scale
/
data_scale
,
EnableLogging
=
False
)
if
bkg
is
not
None
:
RemoveM
askedSpectra
(
InputWorkspace
=
bkg
,
Mask
ed
Workspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__bkg_tmp
'
,
EnableLogging
=
False
)
ExtractUnm
askedSpectra
(
InputWorkspace
=
bkg
,
MaskWorkspace
=
'
__mask_tmp
'
,
OutputWorkspace
=
'
__bkg_tmp
'
,
EnableLogging
=
False
)
CopyInstrumentParameters
(
data
,
'
__bkg_tmp
'
,
EnableLogging
=
False
)
ConvertSpectrumAxis
(
InputWorkspace
=
'
__bkg_tmp
'
,
Target
=
target
,
EFixed
=
eFixed
,
OutputWorkspace
=
'
__bkg_tmp
'
,
EnableLogging
=
False
)
Transpose
(
InputWorkspace
=
'
__bkg_tmp
'
,
OutputWorkspace
=
'
__bkg_tmp
'
,
EnableLogging
=
False
)
...
...
This diff is collapsed.
Click to expand it.
docs/source/release/v3.14.0/diffraction.rst
+
1
−
0
View file @
897dbd23
...
...
@@ -13,6 +13,7 @@ Improvements
############
- :ref:`SNAPReduce <algm-SNAPReduce>` now has progress bar and all output workspaces have history
- Mask workspace option added to :ref:`WANDPowderReduction <algm-WANDPowderReduction>`
:ref:`Release 3.14.0 <v3.14.0>`
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment