BasePSFFitter¶
-
class
psfsubtraction.fitpsf.BasePSFFitter(psfbase, image=None)[source] [edit on github]¶ Bases:
objectBase object for PSF fitting.
Parameters: - psfbase : np.ndarray of shape (n, m, k)
array of psfbases. (n, m) are the dimensions of each image and there are k potential elements of the PSF base.
- image : np.array of shape (n,m) or None
N, M array. If
None, the image has to be set later.
Attributes Summary
imageImage. image1dImage flatted to a 1 d vector. image_dimDimenension of the image that this fitter works on. min_pixels_in_regionCan this fitter deal with masked data? psfFitted Point-Spread-Function (PSF) psfbase1dPSF base flattened to an 2d array (stack of 1d images) Methods Summary
anyreg_to_mask(reg)Convert any type of a region definition to a 1d boolean mask. baseind_to_mask(indpsf)Convert any type of psf base index to boolen mask. check_fittable(region, optregion, indpsf)dim1to2(array1d)Reshape flattened image to 2 d. dim2to1(array2d)Flatten image findbase(region)This function should be overwritten by derived classes. fit_psf([image])Fit the PSF for an image fitpsfcoeff(img, base)This function should be overwritten by derived classes. iter_regions()Convert regions to 1d boolean mask array and iterate optregion(region, indpsf)This function should be overwritten by derived classes. regions()This function should be overwritten by derived classes. remove_psf([image])Remove te PSF from the image. Attributes Documentation
-
image¶ Image.
np.array of shape (n, m) or None (if not set yet).
-
image1d¶ Image flatted to a 1 d vector.
-
image_dim¶ Dimenension of the image that this fitter works on.
-
min_pixels_in_region= 1¶ Can this fitter deal with masked data?
This attribute is not fool-proof; it is set by hand for the pre-defined fitters. If you define your own fitter, you will ahve to check yourself if if works with masked data.
-
psf¶ Fitted Point-Spread-Function (PSF)
-
psfbase1d¶ PSF base flattened to an 2d array (stack of 1d images)
Methods Documentation
-
anyreg_to_mask(reg)[source] [edit on github]¶ Convert any type of a region definition to a 1d boolean mask.
Also check that the region has the correct size.
Parameters: - reg : boolean mask of size image in 1d or 2d or 1d integer array
-
baseind_to_mask(indpsf)[source] [edit on github]¶ Convert any type of psf base index to boolen mask.
-
check_fittable(region, optregion, indpsf)[source] [edit on github]¶
-
dim1to2(array1d)[source] [edit on github]¶ Reshape flattened image to 2 d.
-
dim2to1(array2d)[source] [edit on github]¶ Flatten image
-
findbase(region)[source] [edit on github]¶ This function should be overwritten by derived classes.
-
fit_psf(image=None)[source] [edit on github]¶ Fit the PSF for an image
Parameters: - image : np.array of shape (n, m) or None
N, M array. If
None, use the image set previously.
Returns: - psf : np.array of shape (n, m)
Fitted PSF.
-
fitpsfcoeff(img, base)[source] [edit on github]¶ This function should be overwritten by derived classes.
-
iter_regions()[source] [edit on github]¶ Convert regions to 1d boolean mask array and iterate
-
optregion(region, indpsf)[source] [edit on github]¶ This function should be overwritten by derived classes.
-
regions()[source] [edit on github]¶ This function should be overwritten by derived classes.
-
remove_psf(image=None)[source] [edit on github]¶ Remove te PSF from the image.
Parameters: - image : np.array of shape (n, m) or None
N, M array. If
None, use the image set previously.
Returns: - resid : np.array of shape (n, m)
original image with PSF subtracted.