Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Whitfield, Ross
wand
Commits
c79de86e
Commit
c79de86e
authored
Aug 07, 2018
by
Whitfield, Ross
Browse files
Update filtering/.#FilterTime.py filtering/FilterTemperature.py filtering/FilterTime.py
parent
f20d0762
Changes
3
Hide whitespace changes
Inline
Side-by-side
filtering/.#FilterTime.py
deleted
120000 → 0
View file @
f20d0762
rwp
@
diffuse
.
12279
:
1532959676
\ No newline at end of file
filtering/FilterTemperature.py
0 → 100644
View file @
c79de86e
from
mantid.simpleapi
import
*
name
=
'output'
IPTS
=
20325
run
=
26563
background
=
None
BackgroundScale
=
1
vanadium
=
7553
# Run number or `None`
vanadium_IPTS
=
7776
normaliseBy
=
'Monitor'
# One on (None, Monitor, Time)
units
=
'Theta'
# One of (Theta, ElasticQ, ElasticDSpacing)
Binning
=
'3,123,1200'
# Min,Max,Number_of_bins
# Temperature filter options
LogName
=
'HB2C:SE:SampleTemp'
LogValueInterval
=
100
MinimumLogValue
=
None
MaximumLogValue
=
None
###############################################################################
# Load vandium if not already loaded.
vanadium_ws
=
'HB2C_{}'
.
format
(
vanadium
)
if
vanadium_ws
not
in
mtd
:
LoadWAND
(
IPTS
=
vanadium_IPTS
,
RunNumbers
=
vanadium
,
OutputWorkspace
=
vanadium_ws
)
# Load background if needed and if not already loaded.
if
background
is
not
None
:
background_ws
=
'HB2C_{}'
.
format
(
vanadium
)
if
background_ws
not
in
mtd
:
LoadWAND
(
IPTS
=
IPTS
,
RunNumbers
=
background
,
OutputWorkspace
=
background_ws
)
else
:
background_ws
=
None
# Load data if not already loaded
ws
=
'HB2C_{}'
.
format
(
run
)
if
ws
not
in
mtd
:
LoadEventNexus
(
Filename
=
'/HFIR/HB2C/IPTS-{}/nexus/HB2C_{}.nxs.h5'
.
format
(
IPTS
,
run
),
OutputWorkspace
=
ws
,
LoadMonitors
=
True
)
# Mask detectors to be the same as vanadium
MaskDetectors
(
ws
,
MaskedWorkspace
=
vanadium_ws
)
# Filter events
GenerateEventsFilter
(
InputWorkspace
=
ws
,
OutputWorkspace
=
'filter'
,
InformationWorkspace
=
'info'
,
LogName
=
LogName
,
LogValueInterval
=
LogValueInterval
,
MinimumLogValue
=
MinimumLogValue
,
MaximumLogValue
=
MaximumLogValue
)
FilterEvents
(
InputWorkspace
=
ws
,
SplitterWorkspace
=
'filter'
,
OutputWorkspaceBaseName
=
ws
+
'_filtered'
,
InformationWorkspace
=
'info'
,
GroupWorkspaces
=
True
,
FilterByPulseTime
=
True
,
OutputWorkspaceIndexedFrom1
=
True
)
FilterEvents
(
InputWorkspace
=
ws
+
'_monitors'
,
SplitterWorkspace
=
'filter'
,
OutputWorkspaceBaseName
=
ws
+
'_filtered_mon'
,
InformationWorkspace
=
'info'
,
GroupWorkspaces
=
True
,
FilterByPulseTime
=
True
,
SpectrumWithoutDetector
=
'Skip only if TOF correction'
,
OutputWorkspaceIndexedFrom1
=
True
)
# Set the monitor count on filtered WS
for
n
in
range
(
mtd
[
ws
+
'_filtered'
].
getNumberOfEntries
()):
AddSampleLog
(
mtd
[
ws
+
'_filtered'
].
getItem
(
n
),
LogName
=
"gd_prtn_chrg"
,
LogType
=
'Number'
,
NumberType
=
'Double'
,
LogText
=
str
(
mtd
[
ws
+
'_filtered_mon'
].
getItem
(
n
).
getNumberEvents
()))
# Run powder diffraction reduction
xmin
,
xmax
,
bins
=
Binning
.
split
(
','
)
WANDPowderReduction
(
ws
+
'_filtered'
,
CalibrationWorkspace
=
vanadium_ws
,
BackgroundWorkspace
=
background_ws
,
BackgroundScale
=
BackgroundScale
,
XMin
=
xmin
,
XMax
=
xmax
,
NumberBins
=
bins
,
NormaliseBy
=
normaliseBy
,
OutputWorkspace
=
name
)
filtering/FilterTime.py
View file @
c79de86e
...
...
@@ -3,6 +3,8 @@ from mantid.simpleapi import *
name
=
'output'
IPTS
=
19834
run
=
122687
background
=
None
BackgroundScale
=
1
vanadium
=
101567
# Run number or `None`
vanadium_IPTS
=
7776
normaliseBy
=
'Monitor'
# One on (None, Monitor, Time)
...
...
@@ -10,9 +12,9 @@ units = 'Theta' # One of (Theta, ElasticQ, ElasticDSpacing)
Binning
=
'3,123,1200'
# Min,Max,Number_of_bins
# Time filter options
TimeInterval
=
3600
StartTime
=
None
StopTime
=
None
TimeInterval
=
3600
StartTime
=
None
StopTime
=
None
###############################################################################
...
...
@@ -20,33 +22,45 @@ StopTime=None
vanadium_ws
=
'HB2C_{}'
.
format
(
vanadium
)
if
vanadium_ws
not
in
mtd
:
cal
=
LoadWAND
(
Filename
=
van_iptsdir
+
'nexus/HB2C_{}.nxs.h5'
.
format
(
vanadium
))
LoadWAND
(
IPTS
=
vanadium_IPTS
,
RunNumbers
=
vanadium
,
OutputWorkspace
=
vanadium_ws
)
# Load background if needed and if not already loaded.
if
background
is
not
None
:
background_ws
=
'HB2C_{}'
.
format
(
vanadium
)
if
background_ws
not
in
mtd
:
LoadWAND
(
IPTS
=
IPTS
,
RunNumbers
=
background
,
OutputWorkspace
=
background_ws
)
else
:
background_ws
=
None
# Load data if not already loaded
ws
=
'HB2C_{}'
.
format
(
vanadium
)
ws
=
'HB2C_{}'
.
format
(
run
)
if
ws
not
in
mtd
:
LoadEventNexus
(
Filename
=
'/HFIR/HB2C/IPTS-{}/nexus/HB2C_{}.nxs.h5'
.
format
(
IPTS
,
run
),
OutputWorkspace
=
ws
,
LoadMonitors
=
True
)
# Mask detectors to be the same as vanadium
MaskDetectors
(
ws
,
MaskedWorkspace
=
vanadium_ws
)
# Filter events
GenerateEventsFilter
(
InputWorkspace
=
ws
,
OutputWorkspace
=
'filter'
,
InformationWorkspace
=
'info'
,
TimeInterval
=
'3600'
,
StartTime
=
'0'
,
StopTime
=
'84000'
)
GenerateEventsFilter
(
InputWorkspace
=
ws
,
OutputWorkspace
=
'filter'
,
InformationWorkspace
=
'info'
,
TimeInterval
=
TimeInterval
,
StartTime
=
StartTime
,
StopTime
=
StopTime
)
FilterEvents
(
InputWorkspace
=
ws
,
SplitterWorkspace
=
'filter'
,
OutputWorkspaceBaseName
=
ws
+
'_filtered'
,
InformationWorkspace
=
'info'
,
GroupWorkspaces
=
True
,
FilterByPulseTime
=
True
,
OutputWorkspaceIndexedFrom1
=
True
)
FilterEvents
(
InputWorkspace
=
ws
+
'_monitors'
,
SplitterWorkspace
=
'filter'
,
OutputWorkspaceBaseName
=
ws
+
'_filtered_mon'
,
InformationWorkspace
=
'info'
,
GroupWorkspaces
=
True
,
FilterByPulseTime
=
True
,
SpectrumWithoutDetector
=
'Skip only if TOF correction'
,
OutputWorkspaceIndexedFrom1
=
True
)
for
n
in
range
(
mtd
[
'out'
].
getNumberOfEntries
()):
AddSampleLog
(
mtd
[
'out'
].
getItem
(
n
),
LogName
=
"gd_prtn_chrg"
,
LogType
=
'Number'
,
NumberType
=
'Double'
,
LogText
=
str
(
mtd
[
'mon'
].
getItem
(
n
).
getNumberEvents
()))
MaskBTP
(
'out'
,
Bank
=
'8'
,
Tube
=
'475-480'
)
MaskBTP
(
'out'
,
Pixel
=
'1,2,511,512'
)
# Set the monitor count on filtered WS
for
n
in
range
(
mtd
[
ws
+
'_filtered'
].
getNumberOfEntries
()):
AddSampleLog
(
mtd
[
ws
+
'_filtered'
].
getItem
(
n
),
LogName
=
"gd_prtn_chrg"
,
LogType
=
'Number'
,
NumberType
=
'Double'
,
LogText
=
str
(
mtd
[
ws
+
'_filtered_mon'
].
getItem
(
n
).
getNumberEvents
()))
# Run powder diffraction reduction
xmin
,
xmax
,
bins
=
Binning
.
split
(
','
)
group_list
=
[]
for
n
in
range
(
mtd
[
'out'
].
getNumberOfEntries
()):
nameT
=
name
+
'_'
+
mtd
[
'out'
][
n
].
name
()
group_list
.
append
(
nameT
)
WANDPowderReduction
(
mtd
[
'out'
][
n
],
OutputWorkspace
=
nameT
,
cal
=
cal
,
target
=
units
,
XMin
=
xmin
,
XMax
=
xmax
,
NumberBins
=
bins
,
normaliseBy
=
normaliseBy
)
GroupWorkspaces
(
group_list
,
OutputWorkspace
=
name
)
WANDPowderReduction
(
ws
+
'_filtered'
,
CalibrationWorkspace
=
vanadium_ws
,
BackgroundWorkspace
=
background_ws
,
BackgroundScale
=
BackgroundScale
,
XMin
=
xmin
,
XMax
=
xmax
,
NumberBins
=
bins
,
NormaliseBy
=
normaliseBy
,
OutputWorkspace
=
name
)
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