Table of Contents
Panel parameters, sample position,L0 and T0 are optimized to minimize errors between theoretical and actual q values for the peaks
Name | Direction | Type | Default | Description |
---|---|---|---|---|
PeakWorkspace | Input | PeaksWorkspace | Mandatory | Workspace of Indexed Peaks |
PanelGroups | Input | string | OnePanelPerGroup | Select grouping of Panels. Allowed values: [‘OnePanelPerGroup’, ‘AllPanelsInOneGroup’, ‘SpecifyGroups’] |
PanelNamePrefix | Input | string | bank | Prefix for the names of panels(followed by a number) |
Grouping | Input | string | [ 1:20,22],[3,5,7] | A bracketed([]) list of groupings( comma or :(for range) separated list of bank numbers |
a | Input | number | Optional | Lattice Parameter a (Leave empty to use lattice constants in peaks workspace) |
b | Input | number | Optional | Lattice Parameter b (Leave empty to use lattice constants in peaks workspace) |
c | Input | number | Optional | Lattice Parameter c (Leave empty to use lattice constants in peaks workspace) |
alpha | Input | number | Optional | Lattice Parameter alpha in degrees (Leave empty to use lattice constants in peaks workspace) |
beta | Input | number | Optional | Lattice Parameter beta in degrees (Leave empty to use lattice constants in peaks workspace) |
gamma | Input | number | Optional | Lattice Parameter gamma in degrees (Leave empty to use lattice constants in peaks workspace) |
CellType | Input | string | Triclinic | Select the cell type. Allowed values: [‘Cubic’, ‘Tetragonal’, ‘Orthorhombic’, ‘Hexagonal’, ‘Rhombohedral’, ‘Monoclinic’, ‘Triclinic’] |
useL0 | Input | boolean | False | Fit the L0(source to sample) distance |
usetimeOffset | Input | boolean | False | Fit the time offset value |
usePanelWidth | Input | boolean | False | Fit the Panel Width value |
usePanelHeight | Input | boolean | False | Fit the Panel Height |
usePanelPosition | Input | boolean | True | Fit the PanelPosition |
usePanelOrientation | Input | boolean | False | Fit the PanelOrientation |
RotateCenters | Input | boolean | True | Rotate bank Centers with panel orientations |
AllowSampleShift | Input | boolean | False | Allow and fit for a sample that is off center |
SampleXoffset | Input | number | 0 | Specify Sample x offset |
SampleYoffset | Input | number | 0 | Specify Sample y offset |
SampleZoffset | Input | number | 0 | Specify Sample z offset |
PreProcessInstrument | Input | string | A)No PreProcessing | Select PreProcessing info. Allowed values: [‘A)No PreProcessing’, ‘B)Apply a ISAW.DetCal File’, ‘C)Apply a LoadParameter.xml type file’] |
PreProcFilename | Input | string | Path to file with preprocessing information. Allowed extensions: [‘.detcal’, ‘.xml’] | |
InitialTimeOffset | Input | number | 0 | Initial time offset when using xml files |
DetCalFilename | Input | string | SCDCalibrate.DetCal | Path to an ISAW-style .detcal file to save. Allowed extensions: [‘.detcal’, ‘.det_cal’] |
XmlFilename | Input | string | Path to an Mantid .xml description(for LoadParameterFile) file to save. Allowed extensions: [‘.xml’] | |
ResultWorkspace | Output | TableWorkspace | ResultWorkspace | Workspace of Results |
ColWorkspace | Output | MatrixWorkspace | ColWorkspace | Workspace comparing calculated and theoretical column of each peak. |
RowWorkspace | Output | MatrixWorkspace | RowWorkspace | Workspace comparing calculated and theoretical row of each peak. |
TofWorkspace | Output | MatrixWorkspace | TofWorkspace | Workspace comparing calculated and theoretical TOF of each peak. |
tolerance | Input | number | 0.12 | offset of hkl values from integer for GOOD Peaks |
MinimizerError | Input | number | 1e-12 | error for minimizer |
Minimizer | Input | string | Levenberg-Marquardt | If Levenberg-Marquardt does not find minimum, try Simplex which works better with a poor inital starting point. Allowed values: [‘Levenberg-Marquardt’, ‘Simplex’] |
NumIterations | Input | number | 60 | Number of iterations |
MaxRotationChangeDegrees | Input | number | 5 | Maximum Change in Rotations about x,y,or z in degrees(def=5) |
MaxPositionChange_meters | Input | number | 0.01 | Maximum Change in Panel positions in meters(def=.01) |
MaxSamplePositionChangeMeters | Input | number | 0.005 | Maximum Change in Sample position in meters(def=.005) |
ChiSqOverDOF | Output | number | ChiSqOverDOF | |
DOF | Output | number | Degrees of Freedom | |
EdgePixels | Input | number | 0 | Remove peaks that are at pixels this close to edge. |
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:
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.
The user can select which quantities to keep fixed during the optimization.
The results can be saved to an ISAW-like DetCal file or in an xml file that can be used with the LoadParameter algorithm.
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.
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.
6) Maximum changes in the quantities that are altered during optimization are now settable.
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
DetCal file. AND
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, 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 CopyInstrumentParameters v1 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.
#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=config.getInstrumentDirectory() + '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"
Output:
matches
Categories: Algorithms | Crystal\Corrections