forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Inelastic_Workflow.py
35 lines (29 loc) · 1.48 KB
/
Inelastic_Workflow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name
# Common names
import mantid.simpleapi as mantid
filename = 'fe_demo_30.sqw'
ws_in = 'fe_demo_30'
# 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.
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.
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.
mantid.SaveMD(ws_in, Filename='MDEW_fe_demo_30.nxs')
# Could reload the MDEW at this point.