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
47e33f91
Commit
47e33f91
authored
7 years ago
by
David Fairbrother
Browse files
Options
Downloads
Patches
Plain Diff
Re #19770 Fixed missing import in workflow scripts
parent
528deade
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
scripts/Vates/Inelastic_Workflow.py
+23
-21
23 additions, 21 deletions
scripts/Vates/Inelastic_Workflow.py
scripts/Vates/SXD_NaCl.py
+21
-18
21 additions, 18 deletions
scripts/Vates/SXD_NaCl.py
with
44 additions
and
39 deletions
scripts/Vates/Inelastic_Workflow.py
+
23
−
21
View file @
47e33f91
#pylint: disable=invalid-name
#Common names
# pylint: disable=invalid-name
# Common names
import
mantid.simpleapi
as
mantid
filename
=
'
fe_demo_30.sqw
'
ws_in
=
'
fe_demo_30
'
ws_in
=
'
fe_demo_30
'
#Load an SQW file and internally convert to a Multidimensional event workspace (MDEW)
if
not
mtd
.
doesExist
(
ws_in
):
LoadSQW
(
filename
,
OutputWorkspace
=
ws_in
)
#
Load an SQW file and internally convert to a Multidimensional event workspace (MDEW)
if
not
mantid
.
mtd
.
doesExist
(
ws_in
):
mantid
.
LoadSQW
(
filename
,
OutputWorkspace
=
ws_in
)
#Bin the workspace in an axis aligned manner. Creates a Histogrammed MD workspace.
BinMD
(
InputWorkspace
=
ws_in
,
OutputWorkspace
=
'
binned_axis_aligned
'
,
AxisAligned
=
True
,
AlignedDim0
=
'
Q_
\\
zeta,-1.5,5,100
'
,
AlignedDim1
=
'
Q_
\\
xi,-6,6,100
'
,
AlignedDim2
=
'
Q_
\\
eta,-6,6,100
'
,
AlignedDim3
=
'
E,0,150,30
'
)
#
Bin the workspace in an axis aligned manner. Creates a Histogrammed MD workspace.
mantid
.
BinMD
(
InputWorkspace
=
ws_in
,
OutputWorkspace
=
'
binned_axis_aligned
'
,
AxisAligned
=
True
,
AlignedDim0
=
'
Q_
\\
zeta,-1.5,5,100
'
,
AlignedDim1
=
'
Q_
\\
xi,-6,6,100
'
,
AlignedDim2
=
'
Q_
\\
eta,-6,6,100
'
,
AlignedDim3
=
'
E,0,150,30
'
)
#Bin the workpace using a coordinate transformation to rotate the output.. Creates a Histogrammed MD workspace.
BinMD
(
InputWorkspace
=
ws_in
,
OutputWorkspace
=
'
binned_rotated
'
,
AxisAligned
=
False
,
BasisVector0
=
'
Qx,Ang,1,0.5,0,0,1,100
'
,
BasisVector1
=
'
Qy,Ang,-0.5,1,0,0,1,100
'
,
BasisVector2
=
'
Qz,Ang,0,0,1.25,0,1,100
'
,
Origin
=
'
0,0,0,0
'
)
#
Bin the workpace using a coordinate transformation to rotate the output.. Creates a Histogrammed MD workspace.
mantid
.
BinMD
(
InputWorkspace
=
ws_in
,
OutputWorkspace
=
'
binned_rotated
'
,
AxisAligned
=
False
,
BasisVector0
=
'
Qx,Ang,1,0.5,0,0,1,100
'
,
BasisVector1
=
'
Qy,Ang,-0.5,1,0,0,1,100
'
,
BasisVector2
=
'
Qz,Ang,0,0,1.25,0,1,100
'
,
Origin
=
'
0,0,0,0
'
)
#Save the MDEW workspace in the MDEW nexus format.
SaveMD
(
ws_in
,
Filename
=
'
MDEW_fe_demo_30.nxs
'
)
#
Save the MDEW workspace in the MDEW nexus format.
mantid
.
SaveMD
(
ws_in
,
Filename
=
'
MDEW_fe_demo_30.nxs
'
)
#Could reload the MDEW at this point.
#
Could reload the MDEW at this point.
This diff is collapsed.
Click to expand it.
scripts/Vates/SXD_NaCl.py
+
21
−
18
View file @
47e33f91
from
__future__
import
(
absolute_import
,
division
,
print_function
)
import
mantid.simpleapi
as
mantid
def
reportUnitCell
(
peaks_ws
):
...
...
@@ -15,26 +16,27 @@ def reportUnitCell(peaks_ws):
#
# Exclude the monitors when loading the raw SXD file. This avoids
#
Load
(
Filename
=
'
SXD23767.raw
'
,
OutputWorkspace
=
'
SXD23767
'
,
LoadMonitors
=
'
Exclude
'
)
mantid
.
Load
(
Filename
=
'
SXD23767.raw
'
,
OutputWorkspace
=
'
SXD23767
'
,
LoadMonitors
=
'
Exclude
'
)
#
# A lower SplitThreshold, with a reasonable bound on the recursion depth, helps find weaker peaks at higher Q.
#
QLab
=
ConvertToDiffractionMDWorkspace
(
InputWorkspace
=
'
SXD23767
'
,
OutputDimensions
=
'
Q (lab frame)
'
,
SplitThreshold
=
50
,
LorentzCorrection
=
'
1
'
,
MaxRecursionDepth
=
'
13
'
,
Extents
=
'
-15,15,-15,15,-15,15
'
)
QLab
=
mantid
.
ConvertToDiffractionMDWorkspace
(
InputWorkspace
=
'
SXD23767
'
,
OutputDimensions
=
'
Q (lab frame)
'
,
SplitThreshold
=
50
,
LorentzCorrection
=
'
1
'
,
MaxRecursionDepth
=
'
13
'
,
Extents
=
'
-15,15,-15,15,-15,15
'
)
#
# NaCl has a relatively small unit cell, so the distance between peaks is relatively large. Setting the PeakDistanceThreshold
# higher avoids finding high count regions on the sides of strong peaks as separate peaks.
#
peaks_qLab
=
FindPeaksMD
(
InputWorkspace
=
'
QLab
'
,
MaxPeaks
=
300
,
DensityThresholdFactor
=
10
,
PeakDistanceThreshold
=
1.0
)
peaks_qLab
=
mantid
.
FindPeaksMD
(
InputWorkspace
=
'
QLab
'
,
MaxPeaks
=
300
,
DensityThresholdFactor
=
10
,
PeakDistanceThreshold
=
1.0
)
#
# Fewer peaks index if Centroiding is used. This indicates that there may be an error in the centroiding algorithm,
# since the peaks seem to be less accurate.
#
#peaks_qLab = CentroidPeaksMD(InputWorkspace='QLab',PeaksWorkspace=peaks_qLab)
#
peaks_qLab = CentroidPeaksMD(InputWorkspace='QLab',PeaksWorkspace=peaks_qLab)
use_fft
=
True
use_cubic_lat_par
=
False
...
...
@@ -44,32 +46,33 @@ use_Niggli_lat_par = False
# Note: Reduced tolerance on FindUBUsingFFT will omit peaks not near the lattice. This seems to help
# find the Niggli cell correctly, with all angle 60 degrees, and all sides 3.99
#
if
use_fft
:
FindUBUsingFFT
(
PeaksWorkspace
=
peaks_qLab
,
MinD
=
'
3
'
,
MaxD
=
'
5
'
,
Tolerance
=
0.08
)
if
use_fft
:
mantid
.
FindUBUsingFFT
(
PeaksWorkspace
=
peaks_qLab
,
MinD
=
'
3
'
,
MaxD
=
'
5
'
,
Tolerance
=
0.08
)
print
(
'
\n
Niggli cell found from FindUBUsingFFT:
'
)
if
use_cubic_lat_par
:
FindUBUsingLatticeParameters
(
PeaksWorkspace
=
peaks_qLab
,
a
=
5.6402
,
b
=
5.6402
,
c
=
5.6402
,
alpha
=
90
,
beta
=
90
,
gamma
=
90
,
NumInitial
=
25
,
Tolerance
=
0.12
)
mantid
.
FindUBUsingLatticeParameters
(
PeaksWorkspace
=
peaks_qLab
,
a
=
5.6402
,
b
=
5.6402
,
c
=
5.6402
,
alpha
=
90
,
beta
=
90
,
gamma
=
90
,
NumInitial
=
25
,
Tolerance
=
0.12
)
print
(
'
\n
Cubic cell found directly from FindUBUsingLatticeParameters
'
)
if
use_Niggli_lat_par
:
FindUBUsingLatticeParameters
(
PeaksWorkspace
=
peaks_qLab
,
a
=
3.9882
,
b
=
3.9882
,
c
=
3.9882
,
alpha
=
60
,
beta
=
60
,
gamma
=
60
,
NumInitial
=
25
,
Tolerance
=
0.12
)
mantid
.
FindUBUsingLatticeParameters
(
PeaksWorkspace
=
peaks_qLab
,
a
=
3.9882
,
b
=
3.9882
,
c
=
3.9882
,
alpha
=
60
,
beta
=
60
,
gamma
=
60
,
NumInitial
=
25
,
Tolerance
=
0.12
)
print
(
'
\n
Niggli cell found from FindUBUsingLatticeParameters:
'
)
reportUnitCell
(
peaks_qLab
)
IndexPeaks
(
PeaksWorkspace
=
peaks_qLab
,
Tolerance
=
0.12
,
RoundHKLs
=
1
)
mantid
.
IndexPeaks
(
PeaksWorkspace
=
peaks_qLab
,
Tolerance
=
0.12
,
RoundHKLs
=
1
)
if
use_fft
or
use_Niggli_lat_par
:
ShowPossibleCells
(
PeaksWorkspace
=
peaks_qLab
,
MaxScalarError
=
'
0.5
'
)
SelectCellOfType
(
PeaksWorkspace
=
peaks_qLab
,
CellType
=
'
Cubic
'
,
Centering
=
'
F
'
,
Apply
=
True
)
mantid
.
ShowPossibleCells
(
PeaksWorkspace
=
peaks_qLab
,
MaxScalarError
=
'
0.5
'
)
mantid
.
SelectCellOfType
(
PeaksWorkspace
=
peaks_qLab
,
CellType
=
'
Cubic
'
,
Centering
=
'
F
'
,
Apply
=
True
)
peaks_qLab_Integrated
=
IntegratePeaksMD
(
InputWorkspace
=
QLab
,
PeaksWorkspace
=
peaks_qLab
,
PeakRadius
=
0.2
,
BackgroundInnerRadius
=
0.3
,
BackgroundOuterRadius
=
0.4
)
peaks_qLab_Integrated
=
mantid
.
IntegratePeaksMD
(
InputWorkspace
=
QLab
,
PeaksWorkspace
=
peaks_qLab
,
PeakRadius
=
0.2
,
BackgroundInnerRadius
=
0.3
,
BackgroundOuterRadius
=
0.4
)
binned
=
BinMD
(
InputWorkspace
=
QLab
,
AlignedDim0
=
'
Q_lab_x,-15,15,200
'
,
AlignedDim1
=
'
Q_lab_y,-15,15,200
'
,
AlignedDim2
=
'
Q_lab_z,-15,15,200
'
)
binned
=
mantid
.
BinMD
(
InputWorkspace
=
QLab
,
AlignedDim0
=
'
Q_lab_x,-15,15,200
'
,
AlignedDim1
=
'
Q_lab_y,-15,15,200
'
,
AlignedDim2
=
'
Q_lab_z,-15,15,200
'
)
print
(
'
The final result is:
'
)
reportUnitCell
(
peaks_qLab
)
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