Spectrum and metadata API

Spectrum(wave_obs, flux, err, z[, metadata, ...])

Array-only spectrum input for qsospec.

SpectrumMetadata([wave_unit, flux_unit, ...])

Wavelength and flux-density metadata kept outside numerical fitting.

SpectrumInput(source[, row_index, ...])

One deterministic input locator used by batch fitting.

qsospec.resolve_spectrum_metadata(*, survey=None, wave_unit=None, flux_unit=None, flux_scale=None, flux_frame=None, source=None, ra=None, dec=None, galactic_extinction_corrected=None, galactic_extinction=None, metadata=None)[source]

Resolve metadata with explicit keywords taking highest priority.

Parameters:
  • survey (str | None)

  • wave_unit (str | None)

  • flux_unit (str | None)

  • flux_scale (float | None)

  • flux_frame (str | None)

  • source (str | None)

  • ra (float | None)

  • dec (float | None)

  • galactic_extinction_corrected (bool | None)

  • galactic_extinction (Mapping[str, Any] | None)

  • metadata (Any | None)

Return type:

SpectrumMetadata

qsospec.read_spectrum(source, *, row_index=None, redshift=None, object_id=None, reader='auto', flux_unit=None, flux_scale=None)[source]

Read a Parquet/SPARCL, SDSS, LAMOST, or IRAF spectrum.

Standard DESI/SPARCL, SDSS, and LAMOST readers infer cgs f_lambda values in units of 1e-17. IRAF files default to relative f_lambda because their physical scale is not standardized. Callers may override either interpretation explicitly.

Parameters:
  • source (str)

  • row_index (int | None)

  • redshift (float | None)

  • object_id (str | None)

  • reader (str)

  • flux_unit (str | None)

  • flux_scale (float | None)

Return type:

SpectrumData

qsospec.detect_fits_reader(path)[source]

Return sdss, lamost, or iraf from FITS structure.

Parameters:

path (str)

Return type:

str

qsospec.discover_fits_inputs(sources, *, recursive=True)[source]

Expand FITS files, directories, and glob patterns deterministically.

Parameters:
Return type:

Tuple[SpectrumInput, …]

qsospec.read_input_manifest(path)[source]

Read a CSV/Parquet manifest containing paths and optional overrides.

Parameters:

path (str)

Return type:

Tuple[SpectrumInput, …]

qsospec.scan_parquet_spectra(paths, *, row_indices=None, filter_expression=None, batch_size=128)[source]

Scan Parquet sources once with projected columns and bounded batches.

Parameters:
Return type:

Iterator[Tuple[SpectrumInput, SpectrumData]]