HostPhot

HostPhot: global and local photometry of galaxies hosting supernovae or other transients - Published in JOSS (2022)

https://github.com/temuller/hostphot

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 11 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

cosmology cutout galaxy image photometry python sep sextractor supernova transients
Last synced: 4 months ago · JSON representation

Repository

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

Basic Info
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 3
  • Open Issues: 5
  • Releases: 8
Topics
cosmology cutout galaxy image photometry python sep sextractor supernova transients
Created almost 4 years ago · Last pushed 7 months ago
Metadata Files
Readme License

README.md

drawing

Global and local photometry of galaxies hosting supernovae or other transients

repo Documentation Status license Tests and Publish Python Version PyPI DOI 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:

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

Requirements

HostPhot requirements can be found in the requirements.txt file.

Tests

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

code pytest -v

Modules

Cutouts

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

```python from hostphot.cutouts import download_images

name = 'SN2004eo' hostra, hostdec = 308.2092, 9.92755 # coords of host galaxy of SN2004eo survey = 'PanSTARRS' downloadimages(name, hostra, host_dec, survey=survey) ```

Image Pre-processing

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

```python from hostphot.coadd import coadd_images

coaddfilters = 'riz' coaddimages(name, filters=coadd_filters, survey=survey) # creates a new fits file ```

```python from hostphot.processing.masking import create_mask

one can extract the mask parameters from the coadd

this also creates new fits files

coaddmaskparams = createmask(name, hostra, hostdec, filt=coaddfilters, survey=survey, extract_params=True)

for filt in 'grizy': createmask(name, hostra, hostdec, filt, survey=survey, commonparams=coaddmaskparams) ```

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:

```python import hostphot.photometry.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.multibandphot(name, ra, dec, z, survey=survey, apradii=apradii, usemask=True, correctextinction=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:

```python import hostphot.photometry.global_photometry as gp

results = gp.multibandphot(name, hostra, hostdec, survey=survey, ra=ra, dec=dec, usemask=True, correctextinction=True, commonaperture=True, coaddfilters='riz', save_plots=True) ```

By default, HostPhot corrects for Milky Way extinction using the recalibrated dust maps by Schlafly & Finkbeiner (2011) and the extinction law from Fitzpatrick (1999).

Surveys List

This is the list of surveys in HostPhot:

  • DES
  • PS1
  • SDSS
  • GALEX
  • 2MASS
  • WISE
  • unWISE
  • Legacy Survey
  • Spitzer (SEIP)
  • VISTA (VHS, VIDEO, VIKING)
  • HST (WFC3 only)
  • SkyMapper (not well calibrated for extended sources)
  • SPLUS
  • UKIDSS
  • JWST (NIRCam only)

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 the following paper:

code @article{Müller-Bravo2022, author = {Tomás E. Müller-Bravo and Lluís Galbany}, title = {HostPhot: global and local photometry of galaxies hosting supernovae or other transients}, doi = {10.21105/joss.04508}, url = {https://doi.org/10.21105/joss.04508}, year = {2022}, publisher = {The Open Journal}, volume = {7}, number = {76}, pages = {4508}, journal = {Journal of Open Source Software} }

What's new!

v3.0.0 * Major internal restructuring of the code * Convert the cutouts into a module with each survey as a different submodule * Storage of input parameters (with timestamps) * Storage of output parameters in a more friendly format * Restructuring of output files * Fix the VISTA SCIENCE ARCHIVE url for downloading VISTA images * Fix issue with VISTA image size when downloading cuouts * The download of VISTA images now automatically chooses the survey with overlap for the given coordinates, prioritising the survey with deeper coverage. * The user experience is kept approximately consistent with previous versions, but there are some changes * Download of HST images is now working! * Adding download of JWST images!


v2.10.0 * Adding JWST! (few NIRCam filters for now - thanks to Lisa Kelsey for this addition) * SkyMapper upgrade from DR2 to DR4 (note that there is still a problem with the photometric calibration of extended sources) * Fix HST functions, which includes working with Drizzlepac images * Change path handling package (os --> pathlib) * Interactive aperture and download of RGB images have been removed and are no longer available * Close some fits images that were previously kept opened

v2.9.0 * Fixing issue when applying/propagating common-mask parameters (e.g. from a coadd) to other images * Updated error propagation for Legacy Survey with inverse-variance maps (using it as a weight mask now) * Bumping up the DR version of VIKING and VIDEO for VISTA

v2.8.0 * Fix SED plotting with negative or too large values/errors, and improve plotting aesthetics * Fix problem downloading some 2MASS images giving internal server error (no image overlap) * Adding UKIDSS, SPLUS and SkyMapper surveys. WARNINGS: SkyMapper photometry (DR2) is not very accurate with extended sources! * The marker showing the galaxy position on images has changed colour for better visualization * Adding functions to easily load previously saved parameteres from pickle files * Adding missing extinction correction for flux (not magnitudes) * Including exposure time into flux for PS1, VISTA and UKIDSS surveys * Adding SDSS ZP offsets into flux * Output zeropoint together with the photometry * Updating LegacySurvey errors, taken from inverse-variance maps and ZP uncertainty * Adding missing offsets to unWISE W1 and W2 bands into fluxes * Kron radius is no longer "optimized", just the scale, which doesn't have any effect in practice for the user

v2.7.1 * Adding SED plotting * Fixed plotting angle of masked object

v2.7.0 * MAJOR BUG: Convertion factor between different pixel scales fixed (it was previously inverted). This affects the common aperture photometry between different surveys! * Moving font family to _constant.py file

v2.6.2 * Prettier plots (now using aplpy), but also more informative! * Scale of the apertures for the masks is now a parameter (r) * Raise exception is now True by default when calculating photometry

v2.6.1 * 2MASS cutouts improved (picking largest image)

v2.6.0: * HST (WFC3 only - pseudo-trial) included * 2MASS cutouts fixed (it now downloads the image closest to the given coordinates)

v2.5.1: * Using sfdmap2 instead of sfdmap to avoid issues with numpy version (requires Python>=3.9)

v2.5.0: * Systematic error floor added to PS1 photometry * Added missing uncertainties in the error budget of DES (~5 mmag) * Flux/counts have been added to output photometry * GALEX now downloads images with largest exposure time by default * Fixed image realignment/orientation between different surveys when using common apertures (for masking and global photometry) * Added option to output mask parameters, and also aperture parameters for global photometry * Option added to set a distant threshold to identify the host galaxy in the image (by default use the nearest object) * Slight change in the column names of the local photometry output file * Offsets in SDSS zeropoints to place it in the AB system * overwrite set to True by default when downloading image cutouts * Other minor bugs fixed

v2.4.0: * Fixed and improved GALEX cutouts * Better galaxy identification * Better output plots for masked images * Option to return NaN or raise an exception when getting photometry

v2.3.2: * Improved download of GALEX images (download even if they seem to be just background noise)

Acknowledgements

I thank Yuchen LIU for helping me adding Spitzer as part of AstroHackWeek 2022.

Owner

  • Name: Tomás E. Müller Bravo
  • Login: temuller
  • Kind: user
  • Location: Barcelona, Spain
  • Company: Institute of Space Sciences (ICE-CSIC)

I am a postdoc at ICE in Barcelona, Spain. My work is mainly focused on supernova cosmology but also on transients physics.

JOSS Publication

HostPhot: global and local photometry of galaxies hosting supernovae or other transients
Published
August 15, 2022
Volume 7, Issue 76, Page 4508
Authors
Tomás E. Müller-Bravo ORCID
Institute of Space Sciences (ICE, CSIC), Campus UAB, Carrer de Can Magrans, s/n, E-08193 Barcelona, Spain, Institut d’Estudis Espacials de Catalunya (IEEC), E-08034 Barcelona, Spain
Lluís Galbany ORCID
Institute of Space Sciences (ICE, CSIC), Campus UAB, Carrer de Can Magrans, s/n, E-08193 Barcelona, Spain, Institut d’Estudis Espacials de Catalunya (IEEC), E-08034 Barcelona, Spain
Editor
Arfon Smith ORCID
Tags
astronomy supernova galaxy

GitHub Events

Total
  • Issues event: 6
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 44
  • Create event: 1
Last Year
  • Issues event: 6
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 44
  • Create event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 398
  • Total Committers: 3
  • Avg Commits per committer: 132.667
  • Development Distribution Score (DDS): 0.399
Past Year
  • Commits: 91
  • Committers: 2
  • Avg Commits per committer: 45.5
  • Development Distribution Score (DDS): 0.066
Top Committers
Name Email Commits
temuller t****o@i****s 239
temuller t****o@t****e 158
Arfon Smith a****n 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 10
  • Total pull requests: 1
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 4 minutes
  • Total issue authors: 5
  • Total pull request authors: 1
  • Average comments per issue: 1.9
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 0
  • Average time to close issues: 6 months
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 1.33
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • LKelsey (4)
  • krachyon (3)
  • temuller (1)
  • Onoddil (1)
  • thmire (1)
Pull Request Authors
  • arfon (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 39 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 26
  • Total maintainers: 1
pypi.org: hostphot

Global and local photometry of galaxies hosting supernovae or other transients

  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 39 Last month
Rankings
Dependent packages count: 10.0%
Downloads: 12.3%
Average: 17.2%
Forks count: 19.1%
Dependent repos count: 21.7%
Stargazers count: 23.0%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/paper.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • docker://openjournals/paperdraft latest composite
docs/requirements.txt pypi
  • readthedocs-sphinx-search *
  • sphinx *
  • sphinx_rtd_theme *
requirements.txt pypi
  • astropy *
  • astroquery *
  • extinction *
  • ipympl *
  • ipython *
  • ipywidgets *
  • matplotlib *
  • numpy *
  • pandas *
  • photutils *
  • pip *
  • pytest *
  • python-dotenv *
  • pyvo *
  • reproject *
  • sep *
  • sfdmap *
pyproject.toml pypi
setup.py pypi