fitscube_rs

fitscube-rs: combine single-plane FITS images into a cube (Rust-backed).

A Rust port of the fitscube Python package. The heavy lifting happens in the compiled extension fitscube_rs._fitscube_rs; this module re-exports its public API.

Submodules

Functions

combine_fits(→ list[float])

Combine single-plane FITS images into a cube.

extract_plane_from_cube(→ str)

Extract a single plane (channel or timestep) from a FITS cube.

Package Contents

fitscube_rs.combine_fits(file_list: Sequence[str | os.PathLike | pathlib.Path], out_cube: str | os.PathLike | pathlib.Path, spec_file: str | os.PathLike | pathlib.Path | None = None, spec_list: Sequence[float] | None = None, ignore_spec: bool = False, create_blanks: bool = False, overwrite: bool = False, max_workers: int | None = None, time_domain_mode: bool = False, bounding_box: bool = False, invalidate_zeros: bool = False, float_length: int | None = None) list[float][source]

Combine single-plane FITS images into a cube.

Parameters:
  • file_list (list[str]) – Paths of the FITS images to combine.

  • out_cube (str) – Output cube path.

  • spec_file (str, optional) – File of frequencies (Hz) / times (MJD s), one per line. Mutually exclusive with spec_list.

  • spec_list (list[float], optional) – Frequencies/times supplied directly. Mutually exclusive with spec_file.

  • ignore_spec (bool) – Ignore frequency/time info and just stack.

  • create_blanks (bool) – Interpolate an evenly-spaced axis, blanking gaps.

  • overwrite (bool) – Overwrite the output cube if it exists.

  • max_workers (int, optional) – Concurrency bound for in-flight planes.

  • time_domain_mode (bool) – Combine along time (DATE-OBS) instead of FREQ.

  • bounding_box (bool) – Trim blank padding via a common bounding box.

  • invalidate_zeros (bool) – Treat exactly-zero pixels as NaN.

  • float_length (int, optional) – Output precision in bits (32 or 64).

Returns:

The output-axis values (Hz for frequency, MJD s for time).

Return type:

list[float]

Raises:

ValueError – On invalid input or a FITS error.

fitscube_rs.extract_plane_from_cube(fits_cube: str | os.PathLike | pathlib.Path, channel_index: int | None = None, time_index: int | None = None, hdu_index: int = 0, overwrite: bool = False, output_path: str | os.PathLike | pathlib.Path | None = None) str[source]

Extract a single plane (channel or timestep) from a FITS cube.

Parameters:
  • fits_cube (str) – The cube to extract from.

  • channel_index (int, optional) – Frequency channel to extract. Mutually exclusive with time_index.

  • time_index (int, optional) – Timestep to extract. Mutually exclusive with channel_index.

  • hdu_index (int) – HDU index of the cube data (default 0).

  • overwrite (bool) – Overwrite the output file if it exists.

  • output_path (str, optional) – Output path; generated from the cube name if omitted.

Returns:

Path of the written plane image.

Return type:

str

Raises:

ValueError – On invalid options or a FITS error.