Local Photometry¶
Everything related to local photometry is documented bellow:
- hostphot.local_photometry.choose_cosmology(cosmo)¶
Updates the cosmology used to calculate the aperture size.
- Parameters
cosmo (astropy.cosmology object) – Cosmological model. E.g.
FlatLambdaCDM(70, 0.3)()
.
- hostphot.local_photometry.calc_aperture_size(z, ap_radius)¶
Calculates the size of the aperture in arsec, for aperture photometry, given a physical size.
- Parameters
z (float) – Redshift.
ap_radius (float) – Physical aperture size in kpc.
- Returns
radius_arcsec – Aperture size in arcsec.
- Return type
float
- hostphot.local_photometry.extract_aperture_flux(data, error, px, py, radius)¶
Extracts aperture photometry of a single image.
- Parameters
data (array) – Image data in a 2D numpy array.
error (array) – Errors of
data
.px (float) – x-axis pixel coordinate of the aperture center.
py (float) – y-axis pixel coordinate of the aperture center.
radius (float) – Aperture radius in pixels.
- Returns
raw_flux (float) – Aperture photometry (“raw” flux).
raw_flux_err (float) – Uncertainty on the aperture photometry.
- hostphot.local_photometry.plot_aperture(data, px, py, radius_pix, img_wcs, outfile=None)¶
Plots the aperture for the given parameters.
- Parameters
data (2D array) – Data of an image.
px (float) – X-axis center of the aperture in pixels.
py (float) – Y-axis center of the aperture in pixels.
radius_pix (float) – Aperture radius in pixels.
img_wcs (WCS) – Image’s WCS.
outfile (str, default
None
) – If given, path where to save the output figure.
- hostphot.local_photometry.photometry(name, ra, dec, z, filt, survey, ap_radii=1, bkg_sub=False, use_mask=True, correct_extinction=True, save_plots=True)¶
Calculates the local aperture photometry in a given radius.
- Parameters
name (str) – Name of the object to find the path of the fits file.
ra (float) – Right Ascensions in degrees to center the aperture.
dec (float) – Declinations in degrees to center the aperture.
z (float) – Redshift of the object to estimate the physical calculate of the aperture.
filt (str) – Filter to use to load the fits file.
survey (str) – Survey to use for the zero-points and pixel scale.
ap_radii (float or list-like, default
1
) – Physical size of the aperture in kpc.bkg_sub (bool, default
False
) – IfTrue
, the image gets background subtracted.use_mask (bool, default
True
) – IfTrue
, 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).
save_plots (bool, default
True
) – IfTrue
, the figure with the aperture is saved.
- Returns
mags (list) – Aperture magnitudes for the given aperture radii.
mags_err (list) – Aperture magnitude errors for the given aperture radii.
- hostphot.local_photometry.multi_band_phot(name, ra, dec, z, filters=None, survey='PS1', ap_radii=1, bkg_sub=False, use_mask=True, correct_extinction=True, save_plots=True)¶
Calculates the local aperture photometry for multiple filters.
- Parameters
name (str) – Name of the object to find the path of the fits file.
ra (float) – Right Ascensions in degrees to center the aperture.
dec (float) – Declinations in degrees to center the aperture.
z (float) – Redshift of the object to estimate the physical calculate of the aperture.
filters (str, default,
None
) – Filters to use to load the fits files. IfNone
use all the filters of the given survey.survey (str, default
PS1
) – Survey to use for the zero-points and pixel scale.ap_radii (float or list-like, default
1
) – Physical size of the aperture in kpc.bkg_sub (bool, default
False
) – IfTrue
, the image gets background subtracted.use_mask (bool, default
True
) – IfTrue
, 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).
save_plots (bool, default
True
) – IfTrue
, the a figure with the aperture is saved.
- Returns
results_dict – Dictionary with the object’s photometry and other info.
- Return type
dict
Examples
>>> import hostphot.local_photometry as lp >>> ap_radii = [3, 4] # aperture radii in units of kpc >>> ra, dec = 308.22579, 9.92853 # coords of SN2004eo >>> z = 0.0157 # redshift >>> survey = 'PS1' >>> results = lp.multi_band_phot(name, ra, dec, z, survey=survey, ap_radii=ap_radii, use_mask=True, save_plots=True)