Skip to main content

Global and local photometry of galaxies hosting supernovae or other transients

Project description

drawing

Global and local photometry of galaxies hosting supernovae or other transients

repo documentation status license Tests and Publish Python Version PyPI DOI Coverage

Read the full documentation at hostphot.readthedocs.io. It is recommended to read the Further Information section to understand how HostPhot works.


Conda environment

It is recommended to create an environment before installing HostPhot:

conda create -n hostphot pip
conda activate hostphot
pip install hostphot

Requirements

HostPhot has the following requirements:

numpy
pandas
matplotlib
astropy
reproject
photutils
astroquery
extinction
sfdmap
pyvo
sep
ipywidgets (optional: for interactive aperture)
ipympl (optional: for interactive aperture)
ipython (optional: for interactive aperture)
pytest (optional: for testing the code)

Tests

To run the tests, go to the parent directory and run the following command:

pytest -v

Modules

Cutouts

This module allows you to download image cutouts from different surveys (e.g. PS1):

from hostphot.cutouts import download_images

name = 'SN2004eo'
host_ra, host_dec = 308.2092, 9.92755  # coords of host galaxy of SN2004eo
survey = 'PS1'
download_images(name, host_ra, host_dec, survey=survey)

Image Pre-processing

Coadds can be created and stars can be masked out of the images:

from hostphot.coadd import coadd_images

coadd_filters = 'riz'
coadd_images(name, filters=coadd_filters, survey=survey)  # creates a new fits file
from hostphot.image_masking import create_mask

# one can extract the mask parameters from the coadd
# this also creates new fits files
coadd_mask_params = create_mask(name, host_ra, host_dec,
                                filt=coadd_filters, survey=survey,
                                extract_params=True)  

for filt in 'grizy':
    create_mask(name, host_ra, host_dec, filt, survey=survey,
                common_params=coadd_mask_params)

If the user is not happy with the result of the masking, there are a few parameters that can be adjusted. For instance, threshold sets the threshold used by sep for detecting objects. Lowering it will allow the detection of fainter objects. sigma is the width of the gaussian used for convolving the image and masking the detected objects. If crossmatch is set to True, the detected objects are cross-matched with the Gaia catalog and only those in common are kept. This is useful for very nearby host galaxies (e.g. that of SN 2011fe) so the structures of the galaxy are not maked out, artificially lowering its flux.

Local Photometry

Local photometry can be obtained for multiple circular apertures:

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

results = lp.multi_band_phot(name, ra, dec, z,
                             survey=survey, ap_radii=ap_radii, 
                             use_mask=True, save_plots=True)

If the results return NaN values, this means that the flux is below the detection limit for the given survey.

Global Photometry

Global photometry can be obtained in a similar way to local photometry, using common aperture:

import hostphot.global_photometry as gp

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)

Contributing

To contribute, either open an issue or send a pull request (prefered option). You can also contact me directly (check my profile: https://github.com/temuller).

Adding other surveys

If you wish a survey to be added to HostPhot, there are a couple of ways of doing it. 1) You can do a pull request, following the same structure as used for the surveys that are already implemented, or 2) open an issue asking for a survey to be added. Either way, there are a fews things needed to add a survey: where to download the images from (e.g., using astroquery), zero-points to convert the images's flux/counts values into magnitudes, the magnitude system (e.g. AB, Vega), the pixel scaling of the images (in units of arcsec/pixel), the filters transmission functions and any other piece of information necessary to properly estimate magnitudes, errors, etc. If you open an issue asking for a survey to be added, please include all this information. For more information, please check the Adding New Surveys section of the documentation.

Citing HostPhot

If you make use of HostPhot, please cite:

@software{hostphot,
  author       = {Tom\'as E. M\"uller-Bravo and
                  Llu\'is Galbany},
  title        = {temuller/hostphot: HostPhot v2},
  month        = may,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {v2.0.0},
  doi          = {10.5281/zenodo.6586565},
  url          = {https://doi.org/10.5281/zenodo.6586565}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HostPhot-2.1.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

HostPhot-2.1.0-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file HostPhot-2.1.0.tar.gz.

File metadata

  • Download URL: HostPhot-2.1.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for HostPhot-2.1.0.tar.gz
Algorithm Hash digest
SHA256 75c9dcb5518dc7e747c11fc7224c97d48fd87900eaaac010125b920c99172aa5
MD5 04f7637828cd1257520f2c8c01c9f661
BLAKE2b-256 e03dd1736517985711ea7e68c4970a3702524fed45ec347ad9f849c504df1bd4

See more details on using hashes here.

File details

Details for the file HostPhot-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: HostPhot-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for HostPhot-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec7c09ce9ba2048eec208d65a60702cb7dc15081d2abf85833f29fd129bf0488
MD5 19ca445c8c3e0270a94ea3ca452fe8e7
BLAKE2b-256 cd964828a068ac3d740b10f8bbe56a1910ae5a3eeda93c4bb2dc941720f5b561

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page