github ↗
docs menu

Module Ymir_fits

FITS files.

FITS is the file format of astronomy: images, catalogues, sky maps. A file is a list of HDUs, each a header of 80-byte records and a data unit.

ocaml
let ( let* ) = Result.bind

let read path =
  let* hdus = Fits.read path in
  let* sci = Fits.get "SCI" hdus in
  Fits.Image.values Nx.float32 sci

Errors. Every failure in data is Error of a string whose places come first:

<name>: HDU <i> (<EXTNAME>), card <k> (<KEY>), bytes <a>-<b>: <what>

<name> is the path or Fits.of_bytes's name. HDUs count from 0, cards within their HDU from 1, and bytes are inclusive file offsets. Each place appears when known. A caller's bug, such as an illegal keyword name or a dtype FITS cannot store, raises Invalid_argument.

#module Fits : sig ... end