Newer
Older
.. algorithm::
.. summary::
.. alias::
.. properties::
Description
-----------
.. warning::
This algorithm does not perform any consistency check of the input data. It is the users responsibility to choose a physically reasonable dataset.
This algorithm loads a list of DNS `.d_dat` data files into a `MDEventWorkspace <http://www.mantidproject.org/MDEventWorkspace>`_. If the algorithm fails to process a file, this file will be ignored. In this case the algorithm produces a warning and continues to process further files. Only if no valid files are provided, the algorithm terminates with an error message.
This algorithm is meant to replace the :ref:`algm-LoadDNSLegacy` for single crystal diffraction data.
**Output**
As a result, two workspaces are created:
- `OutputWorkspace` contains the raw neutron counts.
- `NormalizationWorkspace` contains the choosen normalization data (either monitor counts or experiment duration time).
Both workspaces have :math:`(H,K,L)` dimensions. The metadata are loaded into time series sample logs.
.. note::
For the further data reduction :ref:`algm-BinMD` should be used to bin the data.
Restrictions
------------
- This algorithm only supports the *DNS* instrument in its configuration with one detector bank (polarisation analysis).
- This algorithm does not support DNS TOF mode data. It is meant only for single crystal diffraction experiments with 1 TOF channel.
Data replication
________________
For standard data (vanadium, NiCr, background) the sample rotation angle is assumed to be not important. These data are typically measured only for one sample rotation angle. The algorithm can replicate these data for the same sample rotation angles as a single crystal sample has been measured. For this purpose optional input fields *SaveHuberTo* and *LoadHuberFrom* can be used.
- *SaveHuberTo* should contain a name of the `TableWorkspace <http://www.mantidproject.org/TableWorkspace>`_ where sample rotation angles (Huber) read from the data files will be saved. If the specified workspace exists, it will be overwritten.
- *LoadHuberFrom* should contain a name of the `TableWorkspace <http://www.mantidproject.org/TableWorkspace>`_. The workspace must exist and contain one column with the name *Huber(degrees)*, where the sample rotation angles are specified.
.. note::
If *LoadHuberFrom* option is applied, sample rotation angles in the data files will be ignored. Only sample rotation angles from the table will be considered.
Usage
-----
**Example 1 - Load a DNS .d_dat file to MDEventWorkspace:**
.. testcode:: LoadDNSSCDEx1
# data file.
filename = "dn134011vana.d_dat"
# lattice parameters
a = 5.0855
b = 5.0855
c = 14.0191
omega_offset = 225.0
hkl1="1,0,0"
hkl2="0,0,1"
alpha=90.0
beta=90.0
gamma=120.0
# load data to MDEventWorkspace
ws, ws_norm, huber_ws = LoadDNSSCD(FileNames=filename, NormalizationWorkspace='ws_norm',
Normalization='monitor', a=a, b=b, c=c, alpha=alpha, beta=beta, gamma=gamma,
OmegaOffset=omega_offset, HKL1=hkl1, HKL2=hkl2, SaveHuberTo='huber_ws')
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# print output workspace information
print("Output Workspace Type is: {}".format(ws.id()))
print("It has {0} events and {1} dimensions:".format(ws.getNEvents(), ws.getNumDims()))
for i in range(ws.getNumDims()):
dimension = ws.getDimension(i)
print("Dimension {0} has name: {1}, id: {2}, Range: {3:.2f} to {4:.2f} {5}".format(i,
dimension.getDimensionId(),
dimension.name,
dimension.getMinimum(),
dimension.getMaximum(),
dimension.getUnits()))
# print information about the table workspace
print ("TableWorkspace '{0}' has {1} row in the column '{2}'.".format(huber_ws.getName(),
huber_ws.rowCount(),
huber_ws.getColumnNames()[0]))
print("It contains sample rotation angle {} degrees".format(huber_ws.cell(0, 0)))
**Output:**
.. testoutput:: LoadDNSSCDEx1
Output Workspace Type is: MDEventWorkspace<MDEvent,3>
It has 24 events and 3 dimensions:
Dimension 0 has name: H, id: H, Range: -15.22 to 15.22 r.l.u
Dimension 1 has name: K, id: K, Range: -15.22 to 15.22 r.l.u
Dimension 2 has name: L, id: L, Range: -41.95 to 41.95 r.l.u
TableWorkspace 'huber_ws' has 1 row in the column 'Huber(degrees)'.
It contains sample rotation angle 79.0 degrees
**Example 2 - Specify scattering angle limits:**
.. testcode:: LoadDNSSCDEx2
# data file.
filename = "dn134011vana.d_dat"
# lattice parameters
a = 5.0855
b = 5.0855
c = 14.0191
omega_offset = 225.0
hkl1="1,0,0"
hkl2="0,0,1"
alpha=90.0
beta=90.0
gamma=120.0
# scattering angle limits, degrees
tth_limits = "20,70"
# load data to MDEventWorkspace
ws, ws_norm, huber_ws = LoadDNSSCD(FileNames=filename, NormalizationWorkspace='ws_norm',
Normalization='monitor', a=a, b=b, c=c, alpha=alpha, beta=beta, gamma=gamma,
OmegaOffset=omega_offset, HKL1=hkl1, HKL2=hkl2, TwoThetaLimits=tth_limits)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# print output workspace information
print("Output Workspace Type is: {}".format(ws.id()))
print("It has {0} events and {1} dimensions.".format(ws.getNEvents(), ws.getNumDims()))
# print normalization workspace information
print("Normalization Workspace Type is: {}".format(ws_norm.id()))
print("It has {0} events and {1} dimensions.".format(ws_norm.getNEvents(), ws_norm.getNumDims()))
**Output:**
.. testoutput:: LoadDNSSCDEx2
Output Workspace Type is: MDEventWorkspace<MDEvent,3>
It has 10 events and 3 dimensions.
Normalization Workspace Type is: MDEventWorkspace<MDEvent,3>
It has 10 events and 3 dimensions.
**Example 3 - Load sample rotation angles from the table**
.. testcode:: LoadDNSSCDEx3
# data file.
filename = "dn134011vana.d_dat"
# construct table workspace with 10 raw sample rotation angles from 70 to 170 degrees
table = CreateEmptyTableWorkspace()
table.addColumn( "double", "Huber(degrees)")
for huber in range(70, 170, 10):
table.addRow([huber])
# lattice parameters
a = 5.0855
b = 5.0855
c = 14.0191
omega_offset = 225.0
hkl1="1,0,0"
hkl2="0,0,1"
alpha=90.0
beta=90.0
gamma=120.0
# load data to MDEventWorkspace
ws, ws_norm, huber_ws = LoadDNSSCD(FileNames=filename, NormalizationWorkspace='ws_norm',
Normalization='monitor', a=a, b=b, c=c, alpha=alpha, beta=beta, gamma=gamma,
OmegaOffset=omega_offset, HKL1=hkl1, HKL2=hkl2, LoadHuberFrom=table)
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# print output workspace information
print("Output Workspace Type is: {}".format(ws.id()))
print("It has {0} events and {1} dimensions.".format(ws.getNEvents(), ws.getNumDims()))
# setting for the BinMD algorithm
bvec0 = '[100],unit,1,0,0'
bvec1 = '[001],unit,0,0,1'
bvec2 = '[010],unit,0,1,0'
extents = '-2,1.5,-0.2,6.1,-10,10'
bins = '10,10,1'
# bin the data
data_raw = BinMD(ws, AxisAligned='0', BasisVector0=bvec0, BasisVector1=bvec1,
BasisVector2=bvec2, OutputExtents=extents, OutputBins=bins, NormalizeBasisVectors='0')
# bin normalization
data_norm = BinMD(ws_norm, AxisAligned='0', BasisVector0=bvec0, BasisVector1=bvec1,
BasisVector2=bvec2, OutputExtents=extents, OutputBins=bins, NormalizeBasisVectors='0')
# normalize data
data = data_raw/data_norm
# print reduced workspace information
print("Reduced Workspace Type is: {}".format(data.id()))
print("It has {} dimensions.".format(data.getNumDims()))
s = data.getSignalArray()
print("Signal at some points: {0:.4f}, {1:.4f}, {2:.4f}".format(s[7,1][0], s[7,2][0], s[7,3][0]))
**Output:**
.. testoutput:: LoadDNSSCDEx3
Output Workspace Type is: MDEventWorkspace<MDEvent,3>
It has 240 events and 3 dimensions.
Reduced Workspace Type is: MDHistoWorkspace
It has 3 dimensions.
Signal at some points: 0.0035, 0.0033, 0.0035
.. categories::
.. sourcelink::