Skip to main content

bandpasses

PyPI - Version PyPI - Python Version

The bandpasses of the instrument involved in the Lemaitre dataset: MeagCam, HSC and ZTF.

  • The MegaCam bandpasses were re-determined from the decommissioned MegaCam filters by M. Betoule and a team from the Laboratoire des matériaux avancés (LMA). These determinations differ slightly from the passband models that were published along with the SNLS and JLA papers. They are all non-radial. They do not (yet?) include per-CCD quantum efficiency determinations.

  • The ZTF bandpasses were re-assembled by P. Rosnet from a series of bench measurements sent by the ZTF team at Caltech. These passbands differ from the models sncosmo (ztfg, ztfr and ztfi), which contains only averaged passbands, which account for (1) the QE difference betweem the single- and double-coated CCDs (2) the passband radial variations due to the coating non-uniformities and to the variations of the incident beam angle w.r.t. the filter surface.

  • The HSC passbands are based on the measurements performed by Kawanomoto et al. These passband models are radial. They do not (yet?) include any per-CCD quantum efficiency determinations.

The passband models are distributed with sncosmo>=2.12, which is able to handle non-radial variations as well as per-CCD quantum efficiencies.

This module contains the raw measurements and the code that was used to prepare the sncosmo release. It also contain code that automatically registers the Lemaitre passbands in sncosmo when the module is imported.

We also use the bbf module for fast computation of broadband fluxes. Within bbf, the passbands are projected on a wavelength and position-dependent spline basis, which is cached as a binary hdf5 file. The bbf module is

Getting started

Installation

pixi handles all compiled dependencies including scikit-sparse. First add it from conda-forge, then the package itself:

pixi add "scikit-sparse<0.5"
# Install the lastest release on Pypi
pixi add --pypi lemaitre-bandpasses 
# Or from the latest development version on Gitlab
# (UV_GIT_LFS=1 is required due to a known pixi/uv issue: https://github.com/prefix-dev/pixi/issues/2000)
UV_GIT_LFS=1 pixi add --git https://gitlab.in2p3.fr/lemaitre/bandpasses.git --branch main --pypi lemaitre-bandpasses

To work from a local clone instead:

git clone git@gitlab.in2p3.fr:lemaitre/bandpasses.git
cd bandpasses && pixi install

Using pip

scikit-sparse requires the SuiteSparse C library; install it before running pip:

  • Linux / macOS — conda: conda install "scikit-sparse<0.5"
  • Linux (Debian/Ubuntu) — apt: sudo apt-get install libsuitesparse-dev
  • macOS — Homebrew: brew install suite-sparse

Then:

pip install lemaitre-bandpasses
# or from a local clone:
git clone git@gitlab.in2p3.fr:lemaitre/bandpasses.git && cd bandpasses && pip install -e .

Instantiating bandpasses from sncosmo

import sncosmo

# getting the average ZTF/MegaCam6/HSC bandpasses
for name in ['ztf::g', 'ztf::r', 'ztf::I']:
    band = sncosmo.get_bandpass(name)
for name in ['megacam6::' + b for b in ['g', 'r', 'i2', 'z']]:
    band = sncosmo.get_bandpass(name)
for name in ['hsc::' + b for b in ['g', 'r', 'r2', 'i', 'i2', 'z', 'Y']]:
    band = sncosmo.get_bandpass(name)

# getting, e.g. the ZTF r-passband at a given position
r = sncosmo.get_bandpass('ztf::r', x=724, y=2829, sensor_id=55)

# this function can be vectorized
r = sncosmo.get_bandpass('ztf::r', x=[724., 1802, 222.], y=[42., 58., 2512], sensor_id=[5, 42, 22])

Working with bbf.FilterLibs

from lemaitre import bandpasses

flib = bandpasses.get_filterlib(rebuild=False)

The filterlib contains all the lemaitre passbands, projected on specific (adapted) spline bases. Then it is possible to use it to compute efficiently broadband fluxes.

First, load a stellar library. A stellar library is like a FilterLib: it consists in a collection of spectra, projected on a spline basis:

import bbf.stellarlib.pickles
pickles = bbf.stellarlib.pickles.fetch()

With that in hand, one can compute broadband fluxes on all (average passbands) in the library:

fluxes = bbf.flux(flib, pickles)
from bbf.magsys import SpecMagSys

ms = SpecMagSys('AB')
mags = bbf.mag(flib, pickles, magsys=ms)

# or just
mags = bbf.mag(flib, pickles, 'AB')

We may be in a situation where we have actually one passband instance per measurement. bbf handles that:

nmeas = 10_000

star = np.random.choice(np.arange(len(pickles)), size=nmeas
x = np.random.rand(3000., 3000., nmeas)
y = np.random.rand(3000., 3000., nmeas)
sensor_id = np.random.choice(np.arange(64), size=nmeas)

mags = bbf.mags(flib, pickles, star, x, y, sensor_id, magsys='AB')

Metadata

Release files for lemaitre-bandpasses 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lemaitre-bandpasses 0.4.4
File Size Uploaded Provenance Actions
lemaitre_bandpasses-0.4.4.tar.gz 66.9 MB Without provenance Details for lemaitre_bandpasses-0.4.4.tar.gz

Release files / lemaitre_bandpasses-0.4.4.tar.gz

Download URL lemaitre_bandpasses-0.4.4.tar.gz
Size 66.9 MB
Tags Source
SHA-256 checksum
How to use checksums
f0196c323c379522acbc2cc43bbd60d62cefe2b01e54c9d0ea06a921a1e0eab4
BLAKE2b-256 checksum
How to use checksums
68e540793930208625da430295b5277339393c2c613135311e5cdcde78c18a27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for lemaitre-bandpasses 0.4.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page