Global Photometry¶
Everything related to global photometry is documented bellow:
- hostphot.global_photometry.kron_flux(data, err, gain, objects, kronrad, scale)¶
Calculates the Kron flux.
- Parameters
data (2D array) – Data of an image.
err (float or 2D array) – Background error of the images.
gain (float) – Gain value.
objects (array) – Objects detected with sep.extract().
kronrad (float) – Kron radius.
scale (float) – Scale of the Kron radius.
- Returns
flux (array) – Kron flux.
flux_err (array) – Kron flux error.
- hostphot.global_photometry.optimize_kron_flux(data, err, gain, objects, eps=0.0001)¶
Optimizes the Kron flux by iteration over different values. The stop condition is met when the change in flux is less that
eps
.- Parameters
data (ndarray) – Data of an image.
err (float or ndarray) – Background error of the images.
gain (float) – Gain value.
objects (array) – Objects detected with
sep.extract()
.eps (float, default
0.0001
(0.1%)) – Minimum percent change in flux allowed between iterations.
- Returns
opt_flux (float) – Optimized Kron flux.
opt_flux_err (float) – Optimized Kron flux error.
opt_kronrad (float) – Optimized Kron radius.
opt_scale (float) – Optimized scale of the Kron radius.
- hostphot.global_photometry.extract_kronparams(name, host_ra, host_dec, filt, survey, ra=None, dec=None, bkg_sub=False, threshold=10, use_mask=True, optimize_kronrad=True, eps=0.0001, 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 of the galaxy in degrees.
host_dec (float) – Host-galaxy declination of the galaxy 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 pixel scale.
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.bkg_sub (bool, default False) – If True, the image gets background subtracted.
threshold (float, default 10) – Threshold used by sep.extract() to extract objects.
use_mask (bool, default True) – If True, the masked fits files are used. These must have been created beforehand.
optimize_kronrad (bool, default True) – If True, the Kron radius is optimized, increasing the aperture size until the flux does not increase.
eps (float, default
0.0001
(0.1%)) – Minimum percent change in flux allowed between iterations when optimizing the Kron radius.save_plots (bool, default False) – If True, the mask and galaxy aperture figures are saved.
- Returns
gal_obj (array) – Galaxy object.
img_wcs (WCS) – Image’s WCS.
kronrad (float) – Kron radius.
scale (float) – Scale for the Kron radius.
- hostphot.global_photometry.photometry(name, host_ra, host_dec, filt, survey, ra=None, dec=None, bkg_sub=False, threshold=10, use_mask=True, correct_extinction=True, aperture_params=None, optimize_kronrad=True, eps=0.0001, save_plots=True)¶
Calculates the global aperture photometry of a galaxy using the Kron flux.
Note: the galaxy must be ideally centred in the image.
- Parameters
name (str) – Name of the object to find the path of the fits file.
host_ra (float) – Host-galaxy right ascension of the galaxy in degrees.
host_dec (float) – Host-galaxy declination of the galaxy in degrees.
filt (str) – Filter to use to load the fits file.
survey (str) – Survey to use for the zero-points and pixel scale.
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.bkg_sub (bool, default False) – If True, the image gets background subtracted.
threshold (float, default 10) – Threshold used by sep.extract() to extract objects.
use_mask (bool, default True) – If True, the masked fits files are used. These must have been created beforehand.
correct_extinction (bool, default True) – If True, corrects for Milky-Way extinction using the recalibrated dust maps by Schlafly & Finkbeiner (2011) and the extinction law from Fitzpatrick (1999).
aperture_params (tuple, default None) – Tuple with objects info and Kron parameters. Used for common aperture. If given, the Kron parameters are not re-calculated
optimize_kronrad (bool, default True) – If True, the Kron radius is optimized, increasing the aperture size until the flux does not increase.
eps (float, default
0.0001
(0.1%)) – Minimum percent change in flux allowed between iterations when optimizing the Kron radius.save_plots (bool, default True) – If True, the mask and galaxy aperture figures are saved.
- Returns
mag (float) – Aperture magnitude.
mag_err (float) – Error on the aperture magnitude.
- hostphot.global_photometry.multi_band_phot(name, host_ra, host_dec, filters=None, survey='PS1', ra=None, dec=None, bkg_sub=False, threshold=10, use_mask=True, correct_extinction=True, common_aperture=True, coadd_filters='riz', optimize_kronrad=True, eps=0.0001, save_plots=True)¶
Calculates multi-band aperture photometry of the host galaxy for an object.
- Parameters
name (str) – Name of the object to find the path of the fits file.
host_ra (float) – Host-galaxy right ascension of the galaxy in degrees.
host_dec (float) – Host-galaxy declination of the galaxy in degrees.
filters (str, default,
None
) – Filters to use to load the fits files. If None use all the filters of the given survey.survey (str, default
PS1
) – Survey to use for the zero-points and pixel scale.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.bkg_sub (bool, default
False
) – If True, the image gets background subtracted.threshold (float, default
10
) – Threshold used bysep.extract()
to extract objects.use_mask (bool, default
True
) – IfTrue
, the masked fits files are used. These must have been created beforehand.common_aperture (bool, default
True
) – IfTrue
, use a coadd image for common aperture photometry.coadd_filters (str, default
riz
) – Filters of the coadd image. Used for common aperture photometry.optimize_kronrad (bool, default
True
) – IfTrue
, the Kron radius is optimized, increasing the aperture size until the flux does not increase.eps (float, default
0.0001
(0.1%)) – Minimum percent change in flux allowed between iterations when optimizing the Kron radius.save_plots (bool, default
True
) – IfTrue
, the mask and galaxy aperture figures are saved.
- Returns
results_dict – Dictionary with the object’s photometry and other info.
- Return type
dict
Examples
>>> import hostphot.global_photometry as gp >>> name = 'SN2004eo' >>> host_ra, host_dec = 308.2092, 9.92755 # coords of host galaxy of SN2004eo >>> ra, dec = 308.22579, 9.92853 # coords of SN2004eo >>> results = gp.multi_band_phot(name, host_ra, host_dec, survey=survey, ra=ra, dec=dec, use_mask=True, common_aperture=True, coadd_filters='riz', save_plots=True)