TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/MickaelRigault/ztfquery/llms.txt
Use this file to discover all available pages before exploring further.
ztfquery.sedm module connects to Pharos, the Caltech archive for the SED Machine (SEDM) integral-field spectrograph mounted on the Palomar 60-inch telescope. SEDM provides low-resolution (R ≈ 100) spectra for ZTF transient classification. The SEDMQuery class handles the full lifecycle: discovering which data exist, downloading the files to your local $ZTFDATA/sedm/redux/ tree, and surfacing them as local paths ready for analysis with pysedm.
You need a Pharos account to access SEDM data. If you are a ZTF member and do not have an account, email Richard Walters (rsw@astro.caltech.edu). Your credentials are stored in
~/.ztfquery after the first authentication prompt.Downloading IFU cubes for a ZTF target
Create a SEDMQuery instance
SEDMQuery loads the local “whatfiles” index — the nightly logs of what SEDM observed each night. If this is your first time using the module, the index needs to be built from scratch, which downloads history back to June 2018.First use is slow. Building the complete whatfiles index for the first time can take several minutes because it fetches every nightly summary file since SEDM began systematic ZTF follow-up. On subsequent uses only the missing recent nights are fetched, making startup nearly instant.
Download IFU cubes
$ZTFDATA/sedm/redux/YYYYMMDD/ where YYYYMMDD is the observation date. Each night with data for the target gets its own subdirectory.Downloading spectra in TXT format
SEDM also produces extracted 1-D spectra. These are available as FITS files (default) or in the plain-text format used by the ZTF Marshal.Reading and visualising with pysedm
Once you have a cube path,pysedm provides a complete analysis environment for SEDM data.
Citation required. If you use a SEDM spectrum obtained since July 2018 (inclusive) in a publication, please cite the pysedm pipeline paper: Rigault et al. 2019 (arXiv:1902.08526).
Understanding whatfiles
Every night SEDM writes awhat.list log file recording which targets were observed, at what airmass, with what exposure time. ztfquery.sedm mirrors these logs locally as the whatfiles index.
Storage location
Whatfiles are stored as individual
.parquet files at $ZTFDATA/sedm/whatfiles/what_YYYYMMDD.parquet and as a merged store at $ZTFDATA/sedm/whatfiles/stored_data.parquet.Automatic updates
Every time you call
SEDMQuery() it checks whether any recent nights are missing from the local index and downloads only those. You never need to manage updates manually.download_target_data("ZTF18abqlpgq", kind="e3d"), the library first searches the whatfiles index for every night on which that target was observed, then builds the correct Pharos URLs for those nights, and finally downloads only the files that are not already on disk.
The first time you import
ztfquery.sedm the library needs to download the complete whatfiles history (June 2018 to today). This is a one-time cost. After that, each call only fetches the new nights since your last update.IRSA light curves with LCQuery
As a bonus, theztfquery.lightcurve module provides access to the IRSA ZTF Light Curve API. These are catalog-matched light curves derived from epochal science images — entirely independent of alert packets, and well-suited for variable star and AGN science.
Query by sky position
Query by ZTF object ID
Download with advanced parameters
download_data() static method returns a pandas DataFrame directly. If you already have a DataFrame (e.g. loaded from a CSV), wrap it in LCQuery to access .show():
IRSA light curves are built from matching the epochal PSF-fit catalogs against reference coadd sources. They are not generated from ZTF alert packets. The same source may appear under a different
oid in the alert stream. For the highest-cadence, alert-based light curves use the Fritz API (see the Fritz Light Curves guide).