Skip to main content

Module cube_io

Module cube_io 

Source
Expand description

FITS spectral cube reading and writing with per-channel beam support.

Supports 3D cubes (NAXIS=3: freq×dec×ra) and 4D cubes (NAXIS=4: stokes×freq×dec×ra). Per-channel beams are read from, in priority order:

  1. CASA BEAMS binary-table extension (CASAMBM=T in header)
  2. Co-located beamlog text file: {dir}/beamlog.{stem}.txt
  3. Single BMAJ/BMIN/BPA from the primary header (broadcast to all channels)

Structs§

CubeMeta
Metadata for a FITS spectral cube (3D or 4D).
CubeWriter
A streaming writer that holds an initialised output cube open for the lifetime of a processing run, so channels can be written one at a time without the per-call file open/close overhead of write_channel.

Enums§

CubeError
CubeMode
Mode for common-beam determination.

Functions§

init_output_cube
Initialise an output cube by copying the input, then updating the beam headers.
read_beamlog
Read per-channel beams from a plain-text beamlog.
read_channel
Read a single frequency channel from a cube into a 2D array (ny × nx).
read_cube_meta
Read metadata (shape, pixel scale, per-channel beams) from a FITS cube.
write_beamlog
Write per-channel beams to a plain-text beamlog.
write_channel
Write a single frequency channel plane back into an existing FITS cube.