fit_diffraction_spike

psfsubtraction.prepare.fit_diffraction_spike(image, fac=1, r_inner=50, r_outer=250, width=25, initial_guess=<function center_of_mass>)[source] [edit on github]

fit a diffraction spike with a line

Regions with low signal, i.e. regions where the maximum is not well determined (standard deviation < 40% percentile indicates that all pixels in that strip are very similar, meaning that these pixels contain mostly sky and not signal).

Parameters:
image : np.array

2 dimensional image

fac : float

Initial guess for the parameter m in the equation y = m*x+b.

r_inner, r_outer : float

The fit is done on the left side of the image from -r_outer to -r_inner and on the right side from +r_inner to +r_outer (all coordinates in pixels, measured from the center of the image). Use these parameters to contrain the fit to a region with a strong, but not saturated signal.

width : float

For each column in the image, a width strip of pixels centered on the initial guess is extracted and the position of the maximum is recorded.

initial guess : tuple or callable

This can either be a numeric value for an initial guess such as (54, 67.7) for a function that accepts and 2 d array (the image) and returns an tuple.

Returns:
m, b : float

coefficients for a line of the form y = m x + b