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.fritz module provides Python wrappers around the fritz.science SkyPortal API. It covers photometry (light curves), spectra, alerts, and group-level source management. Every download function follows the same convention: pass get_object=True to receive a rich Python object with plotting and filtering methods, or omit it to get the raw data structure. All objects store data locally so subsequent calls are fast.
You need a fritz.science account and a personal API token from your profile page. The first time you call any
download_ function, ztfquery will prompt you for the token and save it to ~/.ztfquery. You need ztfquery >= 1.12.0 for Fritz support.Getting a light curve for a ZTF source
Download the light curve and get a FritzPhotometry object
get_object=True wraps the downloaded data in a FritzPhotometry instance. Without it the function returns a bare pandas DataFrame.Plot the light curve
Extracting coordinates from a light curve
Theget_coordinates() method aggregates the per-epoch RA/Dec measurements that Fritz reports alongside each photometry point.
method argument accepts any NumPy reduction function name that operates column-wise, such as "nanmean", "nanmedian", "nanmin", or "nanmax".
Filtering photometry
Useget_data() to slice the photometry table by filter name, detection status, and time range without modifying the underlying lc.data DataFrame.
get_data() parameters:
| Parameter | Type | Description |
|---|---|---|
detected | bool or None | True = detections only; False = upper limits only; None = all |
filters | str or list | Filter name(s) such as "ztfg", "ztfr", "ztfi", or ["ztfg","ztfr"]; "*" means no filter |
time_range | [start, end] | ISO-format date strings; use None for an open boundary |
query | str or list | Additional pandas query() expressions applied last |
Storing and loading locally
EveryFritzPhotometry object can be saved to disk and reloaded without hitting the Fritz API again.
ztfquery storage location (used when lc.store() was called after download):
The default storage path is
$ZTFDATA/fritz/lightcurve/fritz_lightcurve_ZTF20acmzoxo.csv. Call lc.store() after the initial download to write the file; subsequent calls to FritzPhotometry.from_name() will load from disk without hitting the Fritz API.Spectra
Thedownload_spectra() function follows the same pattern as download_lightcurve() but returns a FritzSpectrum object (or a list of them if the source has multiple spectra).
Plot the spectrum
Inspect the raw Fritz dictionary
The complete JSON payload from Fritz is always available as
spec.fritzdict:FritzAccess: working with groups
FritzAccess provides a higher-level interface for managing collections of sources organised into Fritz science groups.
Fast reload from local storage
Downloading sources can be slow for large groups. Once you have fetched them, every subsequent session can reload from disk:Local files are stored at
$ZTFDATA/fritz/{groupname}_sources.csv. You can still force an update at any time with faccess.load_samples(groupname), which overwrites the cached file.Get an IRSA metadata query for a source
get_target_metaquery(name) produces a keyword-argument dictionary that can be passed directly to ZTFQuery.load_metadata() to download IRSA images for a Fritz source:radec, size, and a sql_query built from the source’s creation date and last detection date (with ±100 day buffers by default).Per-source FritzSource methods
Access a single source via
source = faccess.get_sample("SNeIa").get_source("ZTF20acmzoxo"):source.get_classification() — spectral classificationsource.get_coordinates() — RA/Dec positionsource.get_redshift() — redshift valuesource.get_metaquery() — IRSA query dictBulk downloading
Use
fritz.bulk_download(fobject, names) with nprocess=4 for multiprocessed batch downloads of light curves, spectra, or alerts across many targets at once. Pass a Dask client for cluster-scale parallelism.