PYPHOT – A tool for computing photometry from spectra#
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:
Filterthat handles filter definitions and manipulations.Librarythat handles a collection of filters in a few formats.
Additionally, and for convenience
the library class is derived into an ascii file reader
Ascii_Library, and a single hdf file readerHDF_Library.Vegaprovides an interface to a synthetic reference of Vega.Sunprovides an interface to a synthetic and empirical reference of the Sun spectrum.licksprovides an extension to computing lick indices (LickIndex,LickLibrary).pyphot.svo.get_pyphot_filter()provides an interface to the SVO Filter Profile Service to download filters directly from the SVO database.
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
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:
Ariane Lançon (@lancon)
Tim Morton (@timothydmorton)
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},
}
Learn more about CITATION files.
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Fouesneau"
given-names: "Morgan"
orcid: "https://orcid.org/0000-0001-9256-5516"
title: "pyphot"
version: 2.0.0
date-released: 2025-11-15
url: "https://github.com/mfouesneau/pyphot"