ImageD11.blobcorrector
index
/sware/exp/fable/standalone/redhate4-a64/lib/python2.5/site-packages/ImageD11/blobcorrector.py

Defines a class for correcting peak positions for spatial distortion
via a fit2d spline file
 
To think about doing - valid regions? What if someone uses a 1K spline
file for a 2K image etc?

 
Modules
       
ImageD11.bisplev
logging
math
numpy.oldnumeric

 
Classes
       
correctorclass
perfect

 
class correctorclass
    Applies a spatial distortion to a peak position using a fit2d splinefile
 
  Methods defined here:
__init__(self, argsplinefile, orientation='edf')
Argument is the name of a fit2d spline file
correct(self, xin, yin)
Transform x,y in raw image coordinates into x,y of an
idealised image. Returns a tuple (x,y), expects a
pair of floats as arguments
distort(self, xin, yin)
Distort a pair of points xnew, ynew to find where they
would be in a raw image
 
Iterative algorithm...
make_pixel_lut(self, dims)
Generate an x and y image which maps the array indices into
floating point array indices (to be corrected for pixel size later)
 
returns 
FIXME - check they are the right way around
        add some sort of known splinefile testcase
make_pos_lut(self, dims)
Generate a look up table of pixel positions in microns
# Cache the value in case of multiple calls
returns ...
readfit2dspline(self, name)
Reads a fit2d spline file into a scipy/fitpack tuple, tck
A fairly long and dull routine...
test(self, xin, yin)
Checks that the correct and distort functions are indeed
inversely related to each other

 
class perfect(correctorclass)
    To use on previously corrected when there is no splinefile
Allows pixel size etc to be set
 
  Methods defined here:
__init__(self)
correct(self, xin, yin)
Do nothing - just return the same values

Data and other attributes defined here:
splinefile = 'NO_CORRECTION_APPLIED'
xsize = 'UNKNOWN'
ysize = 'UNKNOWN'

Methods inherited from correctorclass:
distort(self, xin, yin)
Distort a pair of points xnew, ynew to find where they
would be in a raw image
 
Iterative algorithm...
make_pixel_lut(self, dims)
Generate an x and y image which maps the array indices into
floating point array indices (to be corrected for pixel size later)
 
returns 
FIXME - check they are the right way around
        add some sort of known splinefile testcase
make_pos_lut(self, dims)
Generate a look up table of pixel positions in microns
# Cache the value in case of multiple calls
returns ...
readfit2dspline(self, name)
Reads a fit2d spline file into a scipy/fitpack tuple, tck
A fairly long and dull routine...
test(self, xin, yin)
Checks that the correct and distort functions are indeed
inversely related to each other

 
Functions
       
readfit2dfloats(fp, nfl)
Interprets a 5E14.7 formatted fortran line