HostPhot: global and local photometry of galaxies hosting supernovae or other transients

Type Ia supernovae (SNe Ia) have assumed a fundamental role as cosmological distance indicators since the discovery of the accelerating expansion rate of the universe. Correlations between their optical peak luminosity, the decline rate of their light curves and their optical colours allow them to be standardised, reducing their observed r.m.s scatter. Over a decade ago, the optical peak luminosity of SNe Ia was found to correlate with host galaxy stellar mass, further improving their standardisation. Since then, host galaxy properties have been used in cosmological analyses of SNe Ia and tremendous effort has gone into finding the property, such as star formation rate, that fundamentally drives the correlation between SNe Ia and their host galaxies. Furthermore, it has been noted that the local environment in which the progenitors of SNe Ia evolve is much better at reducing the scatter in estimated distances than the global environment, i.e., the whole galaxy. HostPhot is a tool that facilitates the calculation of both local and global photometry of galaxies hosting SNe Ia, therefore helping in the study of the environmental effect on these objects.


Summary
Type Ia supernovae (SNe Ia) have assumed a fundamental role as cosmological distance indicators since the discovery of the accelerating expansion rate of the universe (Perlmutter et al., 1999;Riess et al., 1998). Correlations between their optical peak luminosity, the decline rate of their light curves and their optical colours allow them to be standardised, reducing their observed r.m.s scatter (e.g. Phillips, 1993;Tripp, 1998). Over a decade ago, the optical peak luminosity of SNe Ia was found to correlate with host galaxy stellar mass, further improving their standardisation (Kelly & others, 2010;Lampeitl et al., 2010;Sullivan et al., 2010). Since then, host galaxy properties have been used in cosmological analyses of SNe Ia (Betoule et al., 2014;Brout et al., 2019;Scolnic et al., 2018) and tremendous effort has gone into findig the property, such as star formation rate (Rigault et al., 2013), that fundamentally drives the correlation between SNe Ia and their host galaxies. Furthermore, it has been noted that the local environment in which the progenitors of SNe Ia evolve is much better at reducing the scatter in estimated distances than the global environment, i.e., the whole galaxy (Roman et al., 2018;Kelsey et al., 2021). Therefore, the study of the effect of environment on SNe Ia is an active field of research and key in future cosmological analyses.

Statement of need
HostPhot is an open-source Python package for measuring galaxy photmetry, both locally and globally. Galaxy photometry is fundamental as it is commmonly used to estimate the galaxy parameters, such as stellar mass and star formation rate. However, the codes used to calculate photometry by different groups can vary and there is no dedicated package for this. The API for HostPhot allows the user to extract public image cutouts of surveys, such as the Panoramic Survey Telescope and Rapid Response System (Pan-STARRS) Data Release 1 (PS1), Dark Energy Survey (DES) and Sloan Digital Sky Survey (SDSS). Different sets of filters are available depending on the chosen survey: grizy for PS1, grizY for DES and ugriz for SDSS. All photometry is corrected for Milky Way dust extinction. Furthermore, HostPhot also works with private data obtained by the user and can even be easily modified to include other surveys.
The major novelty of HostPhot is dealing with low-redshift galaxies (z < 0.1) as obtaining photometry of these is not as simple as those at higher redshift. Foreground stars can be in the line of sight of nearby galaxies, making the extraction of the photometry a complex procedure. In addition, low-redshift galaxies have visible structures, while at high redshift they just look like simple ellipses. HostPhot is able to detect sources in the images, cross-match them with catalogs of stars (e.g., Gaia (Gaia Collaboration, 2016)) and remove them by applying a convolution with a 2D Gaussian kernel. This process ensures that only stars (and in some cases other galaxies that are not of interest) are removed, keeping the structure of the galaxy intact.
HostPhot can calculate the photometry of an entire galaxy (global) or in a given circular aperture (local) and it heavily relies on the Astropy (Astropy Collaboration et al., 2018Collaboration et al., , 2013 and Photutils (Bradley et al., 2021) packages for this. Local photometry can be calculated for different circular apertures in physical units (e.g., 4 kpc) at the redshift of the given object, as has been done on previous works (e.g., Roman et al., 2018;Kelsey et al., 2021). In addition, as the physical size depends on the assumed cosmology, the cosmological model can be changed by the user, suiting their needs. On the other hand, for the global photometry, the user can choose between using a different aperture for each filter/image or a common aperture for all the filters/images (as done in, e.g., Wiseman et al., 2020). For the latter, HostPhot coadds images in the desired filters, as selected by the user (e.g., riz), and estimates the common aperture parameters from the coadd image. The aperture used for the global photometry can also be optimised, by increasing the size until the change in flux is negligible, encompassing the entire galaxy. In a few cases, nearby galaxies can have very complex structures. HostPhot offers the option of interactively setting the aperture via an intuitive GUI. This option also allows the user to test how the change in aperture shape can affect the calculated photometry.
HostPhot is user-friendly and well documented 1 , which allows the community to easily contribute to this package. HostPhot is already being used by different groups, such as HostFlows 2 and DES, and will allow the supernova community to find exciting new scientific discoveries with future cosmological analyses. Finally, although HostPhot is mainly aimed at supernova science, it can be used in other fields in astronomy as well.