Skip to content

Instantly share code, notes, and snippets.

@akoumjian
Created August 4, 2026 16:55
Show Gist options
  • Select an option

  • Save akoumjian/e698c4c93f00881f2a96fe8b7bc4134e to your computer and use it in GitHub Desktop.

Select an option

Save akoumjian/e698c4c93f00881f2a96fe8b7bc4134e to your computer and use it in GitHub Desktop.
adam-core band conversion examples
"""Examples of canonicalizing and converting photometric bands with adam-core."""
import numpy as np
from adam_core.photometry import convert_magnitude
from adam_core.photometry.bandpasses import map_to_canonical_filter_bands
# Example 1: ZTF r (I41/r) -> canonical Bessell V.
magnitudes_ztf_r = np.array([20.1, 20.4], dtype=float)
ztf_r = map_to_canonical_filter_bands(
observatory_codes=["I41", "I41"],
bands=["r", "r"],
allow_fallback_filters=False,
)
# ztf_r == ["ZTF_r", "ZTF_r"]
magnitudes_v = convert_magnitude(
magnitude=magnitudes_ztf_r,
source_filter_id=ztf_r,
target_filter_id=np.array(["V", "V"], dtype=object),
composition="NEO",
)
# Example 2: ZTF r (I41/r) -> Rubin/LSST i (X05/i).
magnitudes_ztf_r = np.array([20.1, 20.4], dtype=float)
ztf_r = map_to_canonical_filter_bands(
observatory_codes=["I41", "I41"],
bands=["r", "r"],
allow_fallback_filters=False,
)
# ztf_r == ["ZTF_r", "ZTF_r"]
lsst_i = map_to_canonical_filter_bands(
observatory_codes=["X05", "X05"],
bands=["i", "i"],
allow_fallback_filters=False,
)
# lsst_i == ["LSST_i", "LSST_i"]
magnitudes_lsst_i = convert_magnitude(
magnitude=magnitudes_ztf_r,
source_filter_id=ztf_r,
target_filter_id=lsst_i,
composition="NEO",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment