ImageD11.blobcorrector module#
- ImageD11.blobcorrector.apply_lut_parallel(sr, fr, sc, fc, dx, dy)#
- ImageD11.blobcorrector.correct_cf_with_dxdyfiles(cf, dxfile, dyfile)#
Corrects the columnfile with the dx/dy file Returns the corrected columnfile
- ImageD11.blobcorrector.correct_cf_with_h5files(cf, detectorh5file, detector)#
Corrects the columnfile with the dx/dy file Returns the corrected columnfile
- ImageD11.blobcorrector.correct_cf_with_spline(cf, spline_file)#
Creates a correctorclass from the spline file Corrects the columnfile with the spline file Returns the corrected columnfile
- class ImageD11.blobcorrector.correctorclass(argsplinefile, orientation='edf')#
Bases:
objectApplies a spatial distortion to a peak position using a fit2d splinefile
- correct(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
- correct_px_lut(pks)#
Transform x,y in raw image coordinates into x,y of an idealised image using a LUT. Faster than standard correct method for large peakfiles. pks : ImageD11 columnfile with raw coordinates s_raw, f_raw add new colulmns sc, fc with corrected coordinates
- distort(xin, yin)#
Distort a pair of points xnew, ynew to find where they would be in a raw image
Iterative algorithm…
- make_pixel_lut(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(dims)#
Generate a look up table of pixel positions in microns # Cache the value in case of multiple calls returns …
- readfit2dspline(name)#
Reads a fit2d spline file into a scipy/fitpack tuple, tck A fairly long and dull routine…
- test(xin, yin)#
Checks that the correct and distort functions are indeed inversely related to each other
- class ImageD11.blobcorrector.detector_spatial(dxfile='/data/id11/nanoscope/Eiger/spatial_20210415_JW/e2dx.edf', dyfile='/data/id11/nanoscope/Eiger/spatial_20210415_JW/e2dy.edf', h5file=None, detector='eiger')#
Bases:
object- pixel_lut()#
returns (slow, fast) pixel postions of an image
- ImageD11.blobcorrector.eiger_spatial#
alias of
detector_spatial
- ImageD11.blobcorrector.get_corrector(spline_file=None, dxfile=None, dyfile=None, h5file=None, detector='eiger')#
Return a callable that corrects a columnfile, adding the ‘sc’/’fc’ columns from the raw ‘s_raw’/’f_raw’ coordinates.
- Distortion sources, in priority order if more than one is given:
h5file (+ detector) : a pyFAI detector h5 file
dxfile and dyfile : e2dx / e2dy distortion maps (edf files)
spline_file : a fit2d spline file
Returns None if no source is supplied, so the caller can decide how to handle the uncorrected case.
- Usage:
corrector = get_corrector(spline_file=”frelon.spline”) if corrector is not None:
cf = corrector(cf)
- ImageD11.blobcorrector.get_e2dx_from_h5(h5file, detector='eiger')#
- class ImageD11.blobcorrector.perfect#
Bases:
correctorclassTo use on previously corrected when there is no splinefile Allows pixel size etc to be set
- correct(xin, yin)#
Do nothing - just return the same values
- make_pixel_lut(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
- splinefile = 'NO_CORRECTION_APPLIED'#
- xsize = 'UNKNOWN'#
- ysize = 'UNKNOWN'#
- ImageD11.blobcorrector.readfit2dfloats(filep, nfl)#
Interprets a 5E14.7 formatted fortran line filep = file object (has readline method) nfl = the number of floats to read