PYPHOT – A tool for computing photometry from spectra#

https://img.shields.io/pypi/v/pyphot.svg https://zenodo.org/badge/70060728.svg https://static.pepy.tech/badge/pyphot https://static.pepy.tech/badge/pyphot/month https://img.shields.io/badge/python-3.9,_3.10,_3.11,_3.12,_3.13-blue.svg

This is a set of tools to compute synthetic photometry in a simple way, suitable for integration in larger projects.

Important

New major release (v2.0.0) which introduces new features and breaking changes.

See What’s new.

The inputs are response functions for the desired photometric passbands and stellar spectra.

Filters are represented individually by a Filter object. Collections of filters are handled with a Library. We provide an internal library that contains a significant number of common filters. Note that we use the word “filter” in a generic sense: in many cases, it corresponds in fact to a total throughput, which includes the actual filter transmission, the transmission of the optics, the wavelength-dependent efficiency of the detector, and (for ground-based photometric systems) the transmission of the atmosphere.

Each filter is minimally defined by a wavelength, a throughput, and a detector type, which may be either energy or photon (default). Many properties, such as central or pivot wavelengths, are computed internally.

Units are provided for the wavelengths of the filters, zero points in multiple units are also accessible (AB, Vega magnitude, Jy, erg/s/cm2/AA). The default detector is assumed to be a photon-counting device, but energy-sensitive detectors are also handled for the computations.

Note

Pyphot handles units from Astropy Units (as default), Pint, and EzUnits (ezunits). You can switch between them using the pyphot.config.set_units_backend() function.

import pyphot.config
pyphot.config.set_units_backend('astropy')
pyphot.config.set_units_backend('pint')
pyphot.config.set_units_backend('ezunits')

Package main content#

This package is mostly organized around 2 main classes:

  • Filter that handles filter definitions and manipulations.

  • Library that handles a collection of filters in a few formats.

Additionally, and for convenience

Documentation Contents#

Installation#

Pyphot is available on PyPI and can be installed using any common package manager.

Installation#

Before installation, make sure you have HDF5 version 1.8.4 or later (required for pytables; see details at PyTables/PyTables). We will remove this dependency in a future release.

For OSX:

brew install hdf5

For Debian-based distributions:

sudo apt-get install libhdf5-serial-dev
  • Installation from PyPI

https://img.shields.io/pypi/v/pyphot.svg
pip install pyphot

pip install git+https://github.com/mfouesneau/pyphot   # if you want the unreleased version
  • Manual installation

Download the repository and run the setup

git clone https://github.com/mfouesneau/pyphot
cd pyphot
pip install .

Contributors#

Author: Morgan Fouesneau (@mfouesneau)

Direct contributions to the code base:

If you want to contribute, please look at our contributing guide.

Citation#

If you use this software in your work, please cite it using the following:

@software{fouesneau2025pyphot,
author       = {Fouesneau, Morgan},
title        = {pyphot},
month        = jan,
year         = 2025,
publisher    = {Zenodo},
version      = {pyphot\_v2.0.0},
doi          = {10.5281/zenodo.14712174},
url          = {https://doi.org/10.5281/zenodo.14712174},
}

Indices and tables#