Newer
Older
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
.. algorithm::
.. summary::
.. alias::
.. properties::
Description
-----------
This algorithm calibrates sets of Rectangular Detectors in one
instrument. The initial path, time offset,panel widths, panel heights,
panel locations and orientation are all adjusted so the error in q
positions from the theoretical q positions is minimized. Also, there are
optimize options that take into account sample position and the need for
rigid rotations.
Some features:
1) Panels can be grouped.
| `` All panels in a group will move the same way and rotate the same way. If rigid rotations are``
| `` used, each panel is rotated about the center of the instrument, along with panel pixels rotating``
| `` around the panel's center. The height and widths of the panels in a group will``
| `` all change by the same factor``
2) The user can select which quantities to keep fixed during the
optimization.
3) The results can be saved to an ISAW-like DetCal file or in an xml
file that can be used with the LoadParameter algorithm.
4) Results from a previous optimization can be applied before another
optimization is done.
| `` The Levenberg-Marquardt optimization algorithm is used. Later iterations may have too small of changes for the parameters to``
| `` get to another optimum value. Restarting allows for the consideration of parameter values further away and also can change``
| `` constraints for the parameter values. This is also useful when fine tuning parameters that do not influence the errors as``
| `` much as other parameters.``
5) There are several output tables indicating the results of the fit
| `` A) ResultWorkspace contains the results from fitting.``
| `` -t0 is in microseconds``
| `` -L0 is in meters``
| `` -*Xoffset,*Yoffset,and *Zoffset are in meters``
| `` -*Xrot,*Yrot, and *Zrot are in degrees. Note that Zrot is done first, then Yrot , the Xrot.``
`` B)QErrorWorkspace contains the Error in Q values for each peak, along with other associated information about the peak``
`` C)CovarianceInfo contains the "correlations"(*100) between each of the parameters``
``6) Maximum changes in the quantities that are altered during optimization are now settable.``
"A" Workflow
------------
Optimizing all variables at once may not be the best option. The errors
become too large, so optimization in several stages subsets of the
variables are optimized at each stage.
First: NOTE that the input PeaksWorkspace does NOT CHANGE. This means
you should be able to keep trying different sets of variables until
things look good.
To work on another set of variables with the optimized first round of
optimized values
#. Use Preprocessinstrument to apply the previous DetCal or xml file
before optimizing AND
#. Change the name of the target DetCal file, in case the choice of
variables is not good. Then you will not clobber the good
DetCal file. AND
#. Change the name of the ResultWorkspace in the properties list. This
means you will have a copy of the results from the
previous trial(s)( along with chiSq values) to compare results.
Do check the chiSquared values. If they do not decrease, you were close
to a minimum and the optimization could not get back to that minimum. It
makes a large jump at the beginning.
After Calibration
-----------------
After calibration, you can save the workspace to Nexus (or Nexus
processed) and get it back by loading in a later Mantid session. You can
copy the calibration to another workspace using the same instrument by
means of the :ref:`algm-CopyInstrumentParameters`
algorithm. To do so select the workspace, which you have calibrated as
the InputWorkspace and the workspace you want to copy the calibration
to, the OutputWorkspace.
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
-----
.. testcode:: SCDCalibratePanels
#Calibrate peaks file and load to workspace
LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks')
#TimeOffset is not stored in xml file, so use DetCal output if you need TimeOffset
SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60,usetimeOffset=False)
LoadEmptyInstrument(Filename='MANDI_Definition_2013_08_01.xml', OutputWorkspace='MANDI_801_event_DetCal')
CloneWorkspace(InputWorkspace='MANDI_801_event_DetCal', OutputWorkspace='MANDI_801_event_xml')
LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml')
LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal')
det1 = mtd['MANDI_801_event_DetCal'].getInstrument().getDetector(327680)
det2 = mtd['MANDI_801_event_xml'].getInstrument().getDetector(327680)
if det1.getPos() == det2.getPos():
print "matches"
.. testcleanup:: SCDCalibratePanels
DeleteWorkspace('peaks')
DeleteWorkspace('MANDI_801_event_xml')
DeleteWorkspace('MANDI_801_event_DetCal')
import os,mantid
filename=mantid.config.getString("defaultsave.directory")+"mandi_801.xml"
os.remove(filename)
filename=mantid.config.getString("defaultsave.directory")+"mandi_801.DetCal"
os.remove(filename)
Output:
.. testoutput:: SCDCalibratePanels
matches
.. categories::