Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
0afb8979
Unverified
Commit
0afb8979
authored
Oct 03, 2018
by
Gagik Vardanyan
Committed by
GitHub
Oct 03, 2018
Browse files
Merge pull request #23618 from mantidproject/23597_DirectILLDiagnostics_logging
Quiet down DirectILLDiagnostics
parents
3712c0a5
507349d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLDiagnostics.py
View file @
0afb8979
...
...
@@ -9,8 +9,8 @@ from mantid.api import (AlgorithmFactory, DataProcessorAlgorithm, InstrumentVali
WorkspaceProperty
,
WorkspaceUnitValidator
)
from
mantid.kernel
import
(
CompositeValidator
,
Direction
,
FloatBoundedValidator
,
IntArrayBoundedValidator
,
IntArrayProperty
,
Property
,
StringArrayProperty
,
StringListValidator
)
from
mantid.simpleapi
import
(
ClearMaskFlag
,
CloneWorkspace
,
CreateEmptyTableWorkspace
,
Divide
,
ExtractMask
,
Integration
,
LoadMask
,
MaskDetectors
,
MedianDetectorTest
,
Plus
,
SolidAngle
)
from
mantid.simpleapi
import
(
ClearMaskFlag
,
CloneWorkspace
,
CreateEmptyTableWorkspace
,
CreateSingleValuedWorkspace
,
Divide
,
ExtractMask
,
Integration
,
LoadMask
,
MaskDetectors
,
MedianDetectorTest
,
Multiply
,
Plus
,
SolidAngle
)
import
numpy
import
os.path
...
...
@@ -83,10 +83,17 @@ def _createDiagnosticsReportTable(reportWSName, numberHistograms, algorithmLoggi
def
_createMaskWS
(
ws
,
name
,
algorithmLogging
):
"""Return a single bin workspace with same number of histograms as ws."""
maskWS
,
detList
=
ExtractMask
(
InputWorkspace
=
ws
,
OutputWorkspace
=
name
,
EnableLogging
=
algorithmLogging
)
maskWS
*=
0.0
extractResult
=
ExtractMask
(
InputWorkspace
=
ws
,
OutputWorkspace
=
name
,
EnableLogging
=
algorithmLogging
)
zeroWS
=
CreateSingleValuedWorkspace
(
DataValue
=
0.
,
ErrorValue
=
0.
,
EnableLogging
=
algorithmLogging
,
StoreInADS
=
False
)
maskWS
=
Multiply
(
LHSWorkspace
=
extractResult
.
OutputWorkspace
,
RHSWorkspace
=
zeroWS
,
OutputWorkspace
=
name
,
EnableLogging
=
algorithmLogging
)
return
maskWS
...
...
@@ -793,10 +800,10 @@ class DirectILLDiagnostics(DataProcessorAlgorithm):
DetectorList
=
userMask
,
ComponentList
=
maskComponents
,
EnableLogging
=
algorithmLogging
)
maskWS
,
detectorLis
t
=
ExtractMask
(
InputWorkspace
=
maskWS
,
OutputWorkspace
=
maskWSName
,
EnableLogging
=
algorithmLogging
)
return
maskWS
extractResul
t
=
ExtractMask
(
InputWorkspace
=
maskWS
,
OutputWorkspace
=
maskWSName
,
EnableLogging
=
algorithmLogging
)
return
extractResult
.
OutputWorkspace
def
_value
(
self
,
ws
,
propertyName
,
instrumentParameterName
,
defaultValue
):
"""Return a suitable value either from a property, the IPF or the supplied defaultValue."""
...
...
Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/DirectILLDiagnosticsTest.py
View file @
0afb8979
...
...
@@ -181,6 +181,34 @@ class DirectILLDiagnosticsTest(unittest.TestCase):
else
:
self
.
assertEquals
(
ys
[
0
],
0
)
def
testMaskedComponents
(
self
):
inWS
=
mtd
[
self
.
_RAW_WS_NAME
]
spectraCount
=
inWS
.
getNumberHistograms
()
outWSName
=
'diagnosticsWS'
kwargs
=
{
'InputWorkspace'
:
self
.
_RAW_WS_NAME
,
'OutputWorkspace'
:
outWSName
,
'ElasticPeakDiagnostics'
:
'Peak Diagnostics OFF'
,
'BkgDiagnostics'
:
'Bkg Diagnostics OFF'
,
'BeamStopDiagnostics'
:
'Beam Stop Diagnostics OFF'
,
'DefaultMask'
:
'Default Mask OFF'
,
'MaskedComponents'
:
'tube_1'
,
'rethrow'
:
True
}
run_algorithm
(
'DirectILLDiagnostics'
,
**
kwargs
)
self
.
assertTrue
(
mtd
.
doesExist
(
outWSName
))
outWS
=
mtd
[
outWSName
]
self
.
assertEquals
(
outWS
.
getNumberHistograms
(),
spectraCount
)
self
.
assertEquals
(
outWS
.
blocksize
(),
1
)
for
i
in
range
(
spectraCount
):
Ys
=
outWS
.
readY
(
i
)
detector
=
outWS
.
getDetector
(
i
)
componentName
=
detector
.
getFullName
()
if
'tube_1'
in
componentName
:
self
.
assertEquals
(
Ys
[
0
],
1
)
else
:
self
.
assertEquals
(
Ys
[
0
],
0
)
def
testOutputIsUsable
(
self
):
inWS
=
mtd
[
self
.
_RAW_WS_NAME
]
spectraCount
=
inWS
.
getNumberHistograms
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment