Skip to content

read_fits

Read a 1D spectrum from a FITS file (local path or http(s) URL).

Category Input / output
Backend astropy - wraps the domain-standard astropy implementation
Version 2.0.0
Reads -
Writes spectrum

Linear WCS: λ = CRVAL1 + (p − CRPIX1)·CDELT1 with 1-based CRPIX1. Logarithmic axes: IRAF DC-FLAG = 1 means CRVAL1/CDELT1 are log10(λ) (axis = 10(…)); a CTYPE1 ending in '-LOG' (WAVE-LOG, AWAV-LOG) is a WCS Paper III logarithmic axis, λ = CRVAL1·exp((p − CRPIX1)·CDELT1 / CRVAL1). v2.0.0: the '-LOG' case is now decoded with the Paper III formula — v1 applied 10 to it, which returned inf for any CRVAL1 in Å (CTYPE1='WAVE-LOG', CRVAL1=5000, CDELT1=1, CRPIX1=1: v1 [inf, inf, inf], v2 [5000, 5001.0001, 5002.0004], matching astropy.wcs). The IRAF DC-FLAG branch is unchanged.

Parameters

Parameter Default Required Description
path None yes Local path or http(s) URL of the FITS file to read.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("read_fits", ctx, {
    "path": "<value>"
})
spectro run read_fits --input spectrum.fits \
  --param path=<value>
{
  "tool": "read_fits",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "path": "<value>"
    }
  }
}

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

References

  • FITS Standard 4.0 — Pence et al. 2010, A&A 524, A42
  • astropy.io.fits — Astropy Collaboration 2022, ApJ 935, 167
  • Greisen, Calabretta, Valdes & Allen 2006, A&A 446, 747 — WCS Paper III (spectral coordinates; '-LOG' axes).