SCDCalibratePanels v1

../_images/SCDCalibratePanels-v1_dlg.png

SCDCalibratePanels dialog.

Summary

Panel parameters, sample position,L0 and T0 are optimized to minimize errors between theoretical and actual q values for the peaks

Properties

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)
useL0 Input boolean True Fit the L0(source to sample) distance
usetimeOffset Input boolean True Fit the time offset value
usePanelWidth Input boolean True Fit the Panel Width value
usePanelHeight Input boolean True Fit the Panel Height
usePanelPosition Input boolean True Fit the PanelPosition
usePanelOrientation Input boolean True Fit the PanelOrientation
RotateCenters Input boolean False 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   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
QErrorWorkspace Output TableWorkspace QErrorWorkspace Workspace of Errors in Q
tolerance Input number 0.12 offset of hkl values from integer for GOOD Peaks
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

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.
  1. 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

  1. Use Preprocessinstrument to apply the previous DetCal or xml file before optimizing AND
  2. 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

  1. 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 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.

Usage

#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"

Output:

matches

Categories: Algorithms | Crystal