Skip to content

export_fits_bess

Export ctx.spectrum as a BeSS / ARAS-compliant FITS image.

Category Export
Backend astropy - wraps the domain-standard astropy implementation
Version 1.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes exports.fits_bess

Writes the linear-grid Spectrum1D as a 1D image (BITPIX=-32) with linear WCS (CRVAL1, CDELT1, CRPIX1=1) and the BeSS observation keywords (OBJNAME, BSS_INST, BSS_SITE, OBSERVER, DATE-OBS, MJD-OBS, JD-OBS, EXPTIME, BSS_VHEL, BSS_ESRC). Pixels marked invalid (by the spectrum's mask) are replaced with the BeSS sentinel -32000 before write. The output bytes are always stored in ctx.exports['fits_bess']; a canonical filename (.fits) is generated when path is null.

Parameters

Parameter Default Required Description
path None - Destination file path; null ⇒ canonical filename in a temp dir, bytes only.
object_name 'UNKNOWN' - Target identifier (BeSS OBJNAME).
instrument 'UNKNOWN' - Instrument identifier (BeSS BSS_INST, also INSTRUME).
site 'UNKNOWN' - Observing site identifier (BeSS BSS_SITE).
observer 'UNKNOWN' - Observer name or initials (BeSS OBSERVER).
date_obs_utc '' yes Start-of-exposure UTC timestamp (ISO-8601, e.g. '2026-06-09T22:13:45'). MJD-OBS and JD-OBS are computed from this.
exposure_seconds 0.0 - Exposure time in seconds (BeSS EXPTIME).
vhelio_kms 0.0 - Heliocentric velocity correction already applied (BeSS BSS_VHEL).
spectrum_source 'obs' - BeSS BSS_ESRC: 'obs' (raw observation), 'cor' (calibrated), 'pro' (processed).
telescope None - Optional telescope identifier (TELESCOP); null leaves it out.
n_combined 1 - Number of co-added frames (BeSS BSS_NCMB).

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("export_fits_bess", ctx, {
    "path": None,
    "object_name": "UNKNOWN",
    "instrument": "UNKNOWN",
    "site": "UNKNOWN",
    "observer": "UNKNOWN",
    "date_obs_utc": "",
    "exposure_seconds": 0.0,
    "vhelio_kms": 0.0,
    "spectrum_source": "obs",
    "telescope": None,
    "n_combined": 1
})
spectro run export_fits_bess --input spectrum.fits \
  --param path=none \
  --param object_name=UNKNOWN \
  --param instrument=UNKNOWN \
  --param site=UNKNOWN \
  --param observer=UNKNOWN \
  --param date_obs_utc= \
  --param exposure_seconds=0.0 \
  --param vhelio_kms=0.0 \
  --param spectrum_source=obs \
  --param telescope=none \
  --param n_combined=1
{
  "tool": "export_fits_bess",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "path": null,
      "object_name": "UNKNOWN",
      "instrument": "UNKNOWN",
      "site": "UNKNOWN",
      "observer": "UNKNOWN",
      "date_obs_utc": "",
      "exposure_seconds": 0.0,
      "vhelio_kms": 0.0,
      "spectrum_source": "obs",
      "telescope": null,
      "n_combined": 1
    }
  }
}

Every algorithm is an MCP tool of the same name; describe_algorithm returns this page's metadata as JSON.

References

  • Teyssier 2015, A&A Pro-Am collaboration — BeSS/ARAS submission protocol.
  • Buil 2012, ARAS Observation Guide — BeSS FITS header convention.
  • FITS Standard 4.0 — Pence et al. 2010, A&A 524, A42.