Image Masking¶
- hostphot.image_masking.mask_image(data, objects, r=5, sigma=20)¶
Masks objects in an image (2D array) by convolving it with a 2D Gaussian kernel.
- Parameters
data (2D array) – Image data.
objects (array) – Objects extracted with
sep.extract()
.r (float, default
5
) – Scale of the semi-mayor and semi-minor axes of the ellipse of the obejcts.sigma (float, default
20
) – Standard deviation in pixel units of the 2D Gaussian kernel used to convolve the image.
- Returns
masked_data – Masked image data.
- Return type
2D array
- hostphot.image_masking.create_mask(name, host_ra, host_dec, filt, survey, ra=None, dec=None, bkg_sub=False, threshold=15, sigma=8, crossmatch=False, extract_params=False, common_params=None, save_plots=True)¶
Calculates the aperture parameters for common aperture.
- Parameters
name (str) – Name of the object to find the path of the fits file.
host_ra (float) – Host-galaxy right ascension in degrees.
host_dec (float) – Host-galaxy declination in degrees.
filt (str or list) – Filter to use to load the fits file. List is commonly used for coadds.
survey (str) – Survey to use for the zero-points and correct filter path.
ra (float, default
None
) – Right ascension of an object, in degrees. Used for plotting.dec (float, default
None
) – Declination of an object, in degrees. Used for plotting.bkg_sub (bool, default
False
) – IfTrue
, the image gets background subtracted.threshold (float, default 15) – Threshold used by
sep.extract()
to extract objects.sigma (float, default
8
) – Standard deviation in pixel units of the 2D Gaussian kernel used to convolve the image.crossmatch (bool, default
False
) – IfTrue
, the detected objects are cross-matched with a Gaia catalog.extract_params (bool, default
False
) – IfTrue
, returns the parameters listed below.common_params (tuple, default
None
) – Parameters to use for common masking of different filters. These are the same as the outputs of this function.save_plots (bool, default
True
) – IfTrue
, the mask and galaxy aperture figures are saved.
- Returns
**This are only returned if
extract_params==True
.**gal_obj (array) – Galaxy object.
nogal_obj (array) – Non-galaxy objects.
img_wcs (WCS) – Image’s WCS.
pixel_scale (float) – Pixel scale for the survey.
- hostphot.image_masking.plot_masked_image(data, masked_data, objects, img_wcs, ra=None, dec=None, outfile=None)¶
Plots the masked image together with the original image and the detected objects.
- Parameters
data (2D array) – Image data.
masked_data (2D array) – Masked image data.
objects (array) – Objects extracted with
sep.extract()
.img_wcs (WCS) – Image’s WCS.
ra (float, default
None
) – Right ascension of an object, in degrees. Used for plotting the position of the object.dec (float, default
None
) – Declination of an object, in degrees. Used for plotting the position of the object.outfile (str, default
None
) – If given, path where to save the output figure.