pynrc.maths.image_manip.align_leastsq
- pynrc.maths.image_manip.align_leastsq(image, psf_over, osamp=1, bpmask=None, weights=None, params0=[0.0, 0.0, 1.0, 0.0], kipc=None, func_shift=<function fourier_imshift>, interp='cubic', pad=True, **kwargs)[source]
Find best shift value
LSQ optimization with option of shift alignment algorithm. In practice, the ‘reference’ image gets shifted to match the ‘target’ image.
- Parameters:
image (ndarray) – Observed science image
psf_over (ndarray) – Input oversampled PSF to fit and align
- Keyword Arguments:
osamp (int) – Oversampling factor of PSF
bpmask (ndarray, None) – Bad pixel mask indicating what pixels in input image to ignore.
weights (ndarray, None) – Array of weights to use during the fitting process.
params0 (list) – Initial guess for (x, y, offset) values. Optimal scaling factor is calculated automatically in subtract_psf.
func_shift (func) – Which function to use for sub-pixel shifting. Options are fourier_imshift, fshift, or cv_shift.
interp (str) – Interpolation for fshift or cv_shift functions. Options are ‘linear’, ‘cubic’, or ‘quintic’. Default is ‘cubic’.
pad (bool) – Should we pad the array before shifting, then truncate? Otherwise, the image is wrapped.
- Returns:
list – (x, y, scale, offset) values from LSQ optimization, where (x, y) are the misalignment of target from reference and scale is the fraction by which the target intensity must be reduced to match the intensity of the reference. Offset gives the difference in the mean intensity of the two images.