Bruker AXS index previous next

Previous: calbias: Optimize bias setting of a RAG
Next: makefries: make an undistortion calibration file


makedistor: fit distortion correction polynomial

The "makedistor" program is used to fit a 2D-polynome through the grid image delivered with the detector to be able to perform accurate distortion correction.

Usage

The program is invoked by the command line:
  makedistor [options] <imagefilename> [polynome grade]
Different image file types are recognized from their names. The image specified should be the grid file delivered with the system (if you do not have a file grid####.kcd on your system, it can be created using the imagebin program from the file flm-4-1.spe that comes on the disk with calibration data).

The optional argument "polynome grade" should be an integer number. The default is 6, which normally leads to very good results.

Please note: Whenever you decide to run makedistor (e.g. if you want to take advantage of improved performance in a new version) it is REQUIRED that you also run a new detector alignment (see makedetalign).

Options

kill=n
This tells the program to look only for peaks that are higher than "n" sigma above the background level of the image. The default is 8. Normally this should not be changed, only lower this if the default finds too few peaks (e.g. less than 6000 for a 65mm KappaCCD).
vlines
Removes vertical line artifacts from the image before performing the peak search. This can improve the sensitivity.
rotation=f
This tells the program that the grid is not straight on the detector. If the rotation is not too bad, the program will be able to cope with this, but if the rotation is more than 5 degrees, "makedistor" may fail. The rotation is given clockwise, in degrees.
denzo
If this argument is given, a Chebychev polynomial fit is performed, and the result is written to a file compatible with the HKL software.

The output file is written as "ndef.cal" to make the difference with the official calibration file of the machine, which is "def.cal". Before using "ndef.cal", please note that if you are using the August 1998 version of the HKL software, the location of the sensitivity file needs to be added, and that the Chi-squared values are "guesstimates".

pixcorr=f
Since the holes used in the grid are very small, the center of mass of the spot does not accurately describe the center of the hole. The "pixcorr" is a correction factor that compensates for this effect. Normally it should be -0.025 for a 65mm KappaCCD, or 0 for a 95mm KappaCCD2000 (these are the default values). Small changes in this variable might lead to marginally better polynomes. Do not use this option unless you have strong indications that you should.
pixelsize=f
This allows a user to use the program on a detector type unknown to the program. The approximate pixel size should be specified in mm.
maxround=n
Standard, the program performs a maximum of 2 rounds of outlier rejections. This number can be changed using this option.
pickle
If the "pickle" option is given, the intermediate "peak search" results can be stored to and retrieved from a scratch file. Useful for debugging.
gridscale=f
This allows for correction of the grid scaling, if the grid has been measured incorrectly. Do not use this option!

Procedure

The analysis will start by locating all spots (about 6400 for a 65mm KappaCCD, about 13500 for a 95mm KappaCCD2000), and then repeat a loop to fit a polynomial and throw out any outliers. The final results will be written to a file "distorpol.vic" in the current directory. To be used by other programs, this file needs to be copied to the calibration directory on your system (normally /usr/local/hklint/>detid< or the directory pointed to by the CCD_DATAHOME environment variable).

Further diagnostics can be gotten by analyzing the file "scatter.dat" that is produced as well. This file contains 7 values for each peak that was located:

The program scatter can be used for this analysis.

Example output

The process should be monitored a little. Most times it runs fine, but the calibration process might give very strange results in your case. The example output given here is a typical case, where about 6500 spots are found in the image, all 4 value ranges for rmmx, rmmy, rpixx, rpixy are approximately -1.0 to 1.0, a (few) dozen peaks are rejected as outliers, and the final R.M.S. error is around 0.08 pixel.
devel[852]9602%% makedistor grid9602.kcd  
Detector ID:  9602
Assuming Mo radiation
Detector type: 65mm, 625x576, binned
Assuming Mo radiation
Removing slope in background...
Median of the four quadrants 121231.58 134819.52 121205.40 134773.89:
Background Slope in X=-71.81 and Y=27156.44
grid9602.kcd; 
Number of peaks so far: 500
Number of peaks so far: 1000
Number of peaks so far: 1500
Number of peaks so far: 2000
Number of peaks so far: 2500
Number of peaks so far: 3000
Number of peaks so far: 3500
Number of peaks so far: 4000
Number of peaks so far: 4500
Number of peaks so far: 5000
Number of peaks so far: 5500
Number of peaks so far: 6000
Number of peaks so far: 6500
6503 peaks found, 6641 trials, 44.73 seconds
Correcting peak positions...
Assigning grid coordinates...
Number of peaks assigned to grid: 6503
-34.54 <= mmx  <= 34.54      -1.005 <= rmmx  <= 1.005
-31.70 <= mmy  <= 31.70      -0.922 <= rmmy  <= 0.922
   0.8 <= pixx <= 572.7      -0.997 <= rpixx <= 0.989
   1.0 <= pixy <= 618.2      -0.997 <= rpixy <= 0.978
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0851
Rejected peak    88 at   25.2,  61.7 I=148k (err=0.34 pixel)
Rejected peak   584 at   38.6, 618.1 I=752k (err=0.39 pixel)
Rejected peak  1191 at   90.6, 617.9 I=1306k (err=0.42 pixel)
Rejected peak  1200 at   98.5, 617.9 I=1300k (err=0.41 pixel)
Rejected peak  1201 at   76.4, 617.9 I=1311k (err=0.39 pixel)
Rejected peak  1212 at  105.5, 617.9 I=1307k (err=0.37 pixel)
Rejected peak  1778 at  134.6, 617.9 I=1307k (err=0.53 pixel)
Rejected peak  1779 at  120.4, 617.9 I=1305k (err=0.42 pixel)
Rejected peak  1781 at  112.6, 617.9 I=1293k (err=0.54 pixel)
Rejected peak  1782 at  142.4, 617.9 I=1304k (err=0.43 pixel)
Rejected peak  1794 at  127.5, 617.9 I=1299k (err=0.40 pixel)
Rejected peak  1796 at  156.5, 617.9 I=1274k (err=0.47 pixel)
Rejected peak  1798 at  149.5, 617.9 I=1293k (err=0.37 pixel)
Rejected peak  2380 at  164.4, 617.9 I=1309k (err=0.42 pixel)
Rejected peak  2382 at  186.4, 617.9 I=1305k (err=0.46 pixel)
Rejected peak  2969 at  215.4, 617.8 I=1005k (err=0.37 pixel)
Rejected peak  2983 at  244.4, 618.1 I=762k (err=0.35 pixel)
Rejected peak  2989 at  258.5, 618.2 I=763k (err=0.44 pixel)
Rejected peak  2992 at  251.5, 618.1 I=764k (err=0.35 pixel)
Rejected peak  3592 at  273.4, 618.2 I=739k (err=0.63 pixel)
Rejected peak  3597 at  265.6, 618.2 I=751k (err=0.60 pixel)
Rejected peak  4706 at  399.3, 438.7 I= 64k (err=0.39 pixel)
Rejected peak  4804 at  383.3, 547.4 I=125k (err=0.35 pixel)
Number of deleted gridpoints: 23
-34.54 <= mmx  <= 34.54      -1.005 <= rmmx  <= 1.005
-31.70 <= mmy  <= 31.70      -0.922 <= rmmy  <= 0.922
   0.8 <= pixx <= 572.7      -0.997 <= rpixx <= 0.989
   1.0 <= pixy <= 618.1      -0.997 <= rpixy <= 0.978
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0801
Rejected peak  1213 at   83.5, 617.9 I=1308k (err=0.42 pixel)
Rejected peak  2075 at  169.0, 283.3 I=245k (err=0.32 pixel)
Rejected peak  2390 at  178.6, 617.9 I=1306k (err=0.37 pixel)
Rejected peak  2396 at  171.5, 617.9 I=1301k (err=0.42 pixel)
Rejected peak  2966 at  236.6, 618.1 I=766k (err=0.35 pixel)
Rejected peak  6219 at  535.5, 257.5 I=230k (err=0.33 pixel)
Number of deleted gridpoints: 6
Remaining rotation: 0.22 degrees
Fitting P2MMX polynomial...
Fitting P2MMY polynomial...
Results are stored in the file 'distorpol.vic' in the current directory.

If you have the 'scatter' program, you can now do
  scatter nr 7 radmax .5 axdiv 100
to get an impression of the error distribution
makedistor grid9602.kcd  145.83s user 1.99s system 90% cpu 2:43.73 total
In the grid was badly rotated and the background of the image is problematic, calibration can be a bit more tedious:
devel[854]9605%% makedistor grid9605.kcd
Detector ID:  9605
WARNING: unrecognized ADC speed 0
Detector type: 65mm, 625x576, binned
WARNING: unrecognized ADC speed 0
Removing slope in background...
Median of the four quadrants 18959.10 20435.44 18919.19 20399.25:
Background Slope in X=-76.11 and Y=2956.40
grid9605.kcd; 
Number of peaks so far: 500
Number of peaks so far: 1000
Number of peaks so far: 1500
Number of peaks so far: 2000
Number of peaks so far: 2500
Number of peaks so far: 3000
Number of peaks so far: 3500
Number of peaks so far: 4000
Number of peaks so far: 4500
Number of peaks so far: 5000
Number of peaks so far: 5500
Number of peaks so far: 6000
6251 peaks found, 6619 trials, 44.57 seconds
Correcting peak positions...
Assigning grid coordinates...
Number of peaks assigned to grid: 1
No grid found.... Is it rotated?
Calculation aborted.
makedistor grid9605.kcd  51.79s user 0.58s system 76% cpu 1:08.06 total

devel[855]9605%% makedistor grid9605.kcd rotation=10
Detector ID:  9605
WARNING: unrecognized ADC speed 0
Detector type: 65mm, 625x576, binned
WARNING: unrecognized ADC speed 0
Removing slope in background...
Median of the four quadrants 18959.10 20435.44 18919.19 20399.25:
Background Slope in X=-76.11 and Y=2956.40
grid9605.kcd; 
Number of peaks so far: 500
Number of peaks so far: 1000
Number of peaks so far: 1500
Number of peaks so far: 2000
Number of peaks so far: 2500
Number of peaks so far: 3000
Number of peaks so far: 3500
Number of peaks so far: 4000
Number of peaks so far: 4500
Number of peaks so far: 5000
Number of peaks so far: 5500
Number of peaks so far: 6000
6251 peaks found, 6619 trials, 44.53 seconds
Correcting peak positions...
Assigning grid coordinates...
Number of peaks assigned to grid: 6235
-35.53 <= mmx  <= 35.53      -1.034 <= rmmx  <= 1.034
-34.42 <= mmy  <= 34.42      -1.001 <= rmmy  <= 1.001
   0.8 <= pixx <= 572.8      -0.997 <= rpixx <= 0.989
   1.1 <= pixy <= 613.5      -0.997 <= rpixy <= 0.963
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0739
Rejected peak   613 at   85.6,   1.2 I=181k (err=0.64 pixel)
Rejected peak  1775 at  170.5,   1.5 I=227k (err=0.36 pixel)
Rejected peak  2360 at  223.6,   1.2 I=185k (err=0.55 pixel)
Rejected peak  2953 at  277.4,   1.1 I=187k (err=0.34 pixel)
Rejected peak  4110 at  413.7,   1.2 I=186k (err=0.50 pixel)
Rejected peak  5959 at  531.3, 256.1 I= 49k (err=0.34 pixel)
Number of deleted gridpoints: 6
-35.53 <= mmx  <= 35.53      -1.034 <= rmmx  <= 1.034
-34.42 <= mmy  <= 34.42      -1.001 <= rmmy  <= 1.001
   0.8 <= pixx <= 572.8      -0.997 <= rpixx <= 0.989
   1.1 <= pixy <= 613.5      -0.997 <= rpixy <= 0.963
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0725
Remaining rotation: 5.85 degrees
Please re-run this program with the argument 'rotation=15.85'
Calculation aborted
makedistor grid9605.kcd rotation=10  111.76s user 1.01s system 89% cpu 2:05.52 total

devel[856]9605%% makedistor grid9605.kcd rotation=15.85 kill=5
Detector ID:  9605
WARNING: unrecognized ADC speed 0
Detector type: 65mm, 625x576, binned
WARNING: unrecognized ADC speed 0
Removing slope in background...
Median of the four quadrants 18959.10 20435.44 18919.19 20399.25:
Background Slope in X=-76.11 and Y=2956.40
grid9605.kcd; 
Number of peaks so far: 500
Number of peaks so far: 1000
Number of peaks so far: 1500
Number of peaks so far: 2000
Number of peaks so far: 2500
Number of peaks so far: 3000
Number of peaks so far: 3500
Number of peaks so far: 4000
Number of peaks so far: 4500
Number of peaks so far: 5000
Number of peaks so far: 5500
Number of peaks so far: 6000
6384 peaks found, 6630 trials, 44.64 seconds
Correcting peak positions...
Assigning grid coordinates...
Number of peaks assigned to grid: 6362
-34.42 <= mmx  <= 34.42      -1.001 <= rmmx  <= 1.001
-31.73 <= mmy  <= 31.73      -0.923 <= rmmy  <= 0.923
   0.8 <= pixx <= 572.7      -0.997 <= rpixx <= 0.989
   1.0 <= pixy <= 615.6      -0.997 <= rpixy <= 0.970
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0745
Rejected peak   581 at   55.4,   1.1 I=186k (err=0.30 pixel)
Rejected peak   615 at   85.6,   1.2 I=181k (err=0.63 pixel)
Rejected peak  1806 at  170.5,   1.5 I=227k (err=0.35 pixel)
Rejected peak  2407 at  223.6,   1.2 I=185k (err=0.57 pixel)
Rejected peak  3014 at  277.4,   1.1 I=187k (err=0.32 pixel)
Rejected peak  4196 at  413.7,   1.2 I=186k (err=0.49 pixel)
Rejected peak  6090 at  531.3, 256.1 I= 49k (err=0.35 pixel)
Number of deleted gridpoints: 7
-34.37 <= mmx  <= 34.37      -1.000 <= rmmx  <= 1.000
-31.73 <= mmy  <= 31.73      -0.923 <= rmmy  <= 0.923
   0.8 <= pixx <= 572.7      -0.997 <= rpixx <= 0.989
   1.0 <= pixy <= 615.6      -0.997 <= rpixy <= 0.970
Fitting MM2PX polynomial...
Fitting MM2PY polynomial...
R.M.S. error in pixels : 0.0730
Remaining rotation: -0.04 degrees
Fitting P2MMX polynomial...
Fitting P2MMY polynomial...
Results are stored in the file 'distorpol.vic' in the current directory.

If you have the 'scatter' program, you can now do
  scatter nr 7 radmax .5 axdiv 100
to get an impression of the error distribution
makedistor grid9605.kcd rotation=15.85 kill=5  142.77s user 1.45s system 90% cpu 2:40.10 total

index previous next

Previous: calbias: Optimize bias setting of a RAG
Next: makefries: make an undistortion calibration file


(C) 1997-2009, Bruker AXS BV, R.W.W. Hooft