CLI Reference

The campfire command-line tool manages authentication, catalog sync, and FITS downloads. After installing the Python package, the campfire command is available in your terminal.

Quick Start#

bash
campfire login                        # Authenticate
campfire sync                         # Sync the full catalog (metadata only)
campfire download --obs ember_uds_p4  # Download FITS files
campfire status                       # Check catalog and download status

Catalog Sync#

campfire sync#

Sync the full object/spectra catalog from the server. This is a metadata-only operation — it pulls all accessible observations' metadata into a local SQLite database and regenerates CSV catalogs. No FITS files are downloaded.

bash
campfire sync

What it does:

  1. Fetches all objects and spectra metadata you have access to
  2. Upserts into the local SQLite database
  3. Exports objects.csv and spectra.csv catalogs
  4. Detects stale local files (FITS files that have been reprocessed on the server)

Output:

code
Syncing catalog...
✓ Synced 8 observations, 2450 objects, 7200 spectra

⚠ 3 local file(s) have been updated on the server.
  Run: campfire download --stale

Sync is fast and safe to run often — it refreshes inspection results, redshifts, flags, and any new objects added to the database.


Downloading FITS Files#

campfire download#

Download FITS spectrum files. Requires a prior campfire sync to populate the local catalog.

bash
campfire download --obs ember_uds_p4              # By observation
campfire download --program EMBER-UDS             # By program
campfire download --field COSMOS                  # By field
campfire download --program EMBER-UDS --grating PRISM  # With grating filter
campfire download --stale                         # Re-download reprocessed files
campfire download --all                           # Everything accessible
campfire download --obs ember_uds_p4 --dry-run    # Preview without downloading

At least one filter is required (or --all / --stale).

Options:

OptionDescription
--obs NAMEDownload by observation name (repeatable)
--program NAMEDownload by program slug (repeatable)
--field NAMEDownload by field name (repeatable)
--grating NAMEFilter by grating type (repeatable)
--staleRe-download files updated on the server
--allDownload everything accessible
--workers NParallel download workers (default: 4)
--yesSkip confirmation prompt
--dry-runShow plan without downloading

Downloads are incremental — only new or changed files are downloaded. Files are verified with SHA-256 hashes.

Output:

code
Checking files...
  ember_uds_p4: 12 new (450.2 MB)
  capers_cosmos_p1: up to date

Download 12 files (450.2 MB)?
Proceed? [Y/n]: y

ember_uds_p4: 100%|██████████| 12/12 [00:45<00:00]

✓ Download complete
  Files downloaded: 12
  Total size: 450.2 MB

Listing Observations#

Running campfire download with no filters shows all available observations and their download status:

bash
campfire download

Output:

code
  OBSERVATION               PROGRAM         FIELD       SPECTRA   LOCAL
  ember_uds_p4              EMBER-UDS       UDS            1350   1350 (complete)
  capers_cosmos_p1          CAPERS          COSMOS          960   480/960
  rubies_egs_p2             RUBIES          EGS             600

Use --obs, --program, or --field to download, or --all for everything.

Status#

campfire status#

Check credentials, catalog, and download status.

bash
campfire status

Output:

code
✓ Credentials valid
  User: user@example.com

Data directory: /Users/you/.campfire/data
Catalog: 8 observations (last synced 2026-03-15 14:30)

  OBSERVATION               DOWNLOADED     SIZE
  ember_uds_p4              1350           2.1 GB
  capers_cosmos_p1          480            750 MB

⚠ 3 local file(s) updated on server. Run: campfire download --stale

Disk usage: 2.9 GB

Authentication#

campfire login for browser OAuth, campfire login --api-key for headless environments. campfire whoami shows the current user; campfire logout clears credentials. See Getting Started for the full walkthrough.


Local Data Layout#

The data directory defaults to $CAMPFIRE_ROOT if set, otherwise ~/campfire. This matches the pipeline's directory structure, so pipeline users can access reduced spectra without re-downloading.

code
$CAMPFIRE_ROOT/            # or ~/campfire/
├── meta/
│   ├── campfire.db        # SQLite database (full catalog + download tracking)
│   ├── objects.csv        # Object catalog (for pandas/astropy)
│   └── spectra.csv        # Spectra catalog (for pandas/astropy)
└── products/
    ├── ember_uds_p4/
    │   ├── ember_uds_p4_prism_clear_123456_spec.fits
    │   └── ...
    └── capers_cosmos_p1/
        └── ...

Credentials are stored separately in ~/.campfire/credentials.

CSV Catalogs#

The CSV catalogs are regenerated after each campfire sync:

python
from astropy.table import Table

objects = Table.read('~/campfire/meta/objects.csv')
spectra = Table.read('~/campfire/meta/spectra.csv')

high_z = objects[objects['redshift'] > 3.0]

Three CSVs are generated: objects.csv (one row per sky-object, with inspection state), spectra.csv (one row per spectrum, with FITS paths), and photometry.csv (wide-format broadband photometry).

objects.csv columns:

ColumnTypeDescription
object_idstrUnique sky-object identifier
fieldstrField name (cosmos, uds, egs, …)
ra, decfloatCoordinates (J2000, degrees)
redshiftfloatBest redshift (inspected > auto)
redshift_autofloatAutomated (zfit) redshift
redshift_inspectedfloatManually inspected redshift
redshift_qualityint0 (not inspected), 1 (impossible), 2 (tentative), 3 (probable), 4 (secure)
n_targets, n_spectraintCross-program counts
programs, gratings, observationsstrSemicolon-separated lists
member_target_idsstrSemicolon-separated per-program target IDs
max_snr, max_exposure_timefloatAggregates across spectra
has_photometryboolWhether a photometry match exists
photo_z, photo_z_err_lo, photo_z_err_hifloatPhoto-z (if matched)
last_inspected_at, last_inspected_bystrInspection metadata
last_data_change_at, staleness_reasonstrStaleness tracking

Tags are not denormalized into objects.csv — use cf.query_objects(tags=[...]) or cf.get_tags() from the Python client.

spectra.csv columns:

ColumnTypeDescription
spectrum_idstrStable per-spectrum identifier
target_idstrPer-program target ID
object_idstrParent sky-object ID
gratingstrGrating (PRISM, G140M, G235M, G395M, …)
fits_pathstrRemote FITS file path
file_hash, file_sizeRemote file metadata
signal_to_noise, exposure_timefloatPer-spectrum quality
reduction_versionstrPipeline version
redshift_autofloatPer-spectrum automated redshift
dq_flagsintPer-spectrum DQ bitmask (see Flags)
program_slug, observation, fieldstrProvenance
local_pathstrRelative path to downloaded FITS

photometry.csv is wide-format: one row per (object_id, catalog_name) with identification columns (object_id, field, catalog_name, catalog_id, match_distance_arcsec), photo-z columns (photo_z, photo_z_err_lo, photo_z_err_hi), and per-band f_<band> / e_<band> pairs in μJy.


Global Options#

OptionDescription
--base-url URLOverride API URL (for development)
--versionShow version
--helpShow help

Admin Commands#

The campfire deploy subgroup provides archive-maintainer tooling — deploying reduced products to Supabase + R2, generating RGB cutouts and map tiles, and reconciling object associations. These commands are intended for archive maintainers only and are gated behind the deploy extra:

bash
pip install -e ".[deploy]"
campfire deploy --help

If you're not a maintainer, you can ignore this subgroup.