Skip to content

Instantly share code, notes, and snippets.

@andycasey
Created February 5, 2026 01:05
Show Gist options
  • Select an option

  • Save andycasey/3d765376be4f911be7d089ba197b28f9 to your computer and use it in GitHub Desktop.

Select an option

Save andycasey/3d765376be4f911be7d089ba197b28f9 to your computer and use it in GitHub Desktop.
Get all APOGEE UNe lamp exposures for Karlo de Leon and David Hogg
import h5py as h5
import numpy as np
from tqdm import tqdm
from astropy.table import Table
rows = []
path = "/mnt/ceph/users/sdssv/work/asaydjari/2025_11_22/outdir/almanac/allobs_57600_61000.h5"
with h5.File(path, "r") as almanac:
for obs in ("apo", "lco"):
for mjd in tqdm(almanac[obs].keys()):
gp = almanac[obs][mjd]["exposures"]
match = (gp["lamp_une"][:] == 1)
indices = np.where(match)
for index in indices[0]:
row = {k: gp[k][index] for k in gp.keys()}
rows.append(row)
t = Table(data=rows, names=list(rows[0].keys()))
t.write("~/20260205-UNe-exposures.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment