Skip to content

FitsImage

Defined in: image/image.ts:57

A decoded image array plus the metadata needed to interpret it.

shape is in FITS axis order (NAXIS1 first, and NAXIS1 is the fastest-varying axis on disk), and is the region’s shape when a cutout was requested. data is row-major in that order, so the element at FITS index (i1, i2, …) is at i1 + s1 * (i2 + s2 * (…)).

Unless { raw: true } was passed, BZERO/BSCALE are resolved as follows:

  • Scaled (BSCALE/BZERO other than 1/0): the narrowest float that preserves the data, Float32Array for BITPIX 8/16/-32 and Float64Array for 32/64/-64, with BLANK pixels set to NaN.
  • Unsigned-integer convention (BSCALE=1 and BZERO at the half range): the matching integer array with no float widening, Uint16Array for BITPIX 16 (BZERO=2^15), Uint32Array for 32, BigUint64Array for 64; BITPIX 8 with BZERO=-2^7 is the signed-byte form and yields Int8Array (BITPIX 8 is natively unsigned, so there is no Uint8 conversion). As with the no-scaling case, a declared BLANK is exposed via blank, not masked: an integer array cannot hold NaN.
  • No scaling (BSCALE=1, BZERO=0): the on-disk integer array is returned as-is; if BLANK is declared it is exposed as blank for the caller to mask. This is a deliberate deviation from astropy, which widens such an image to float32 with NaN at the blanks. fits-js keeps the integers exact and does not force a float copy.
readonly bitpix: number;

Defined in: image/image.ts:66

BITPIX as written in the header (8, 16, 32, 64, -32, -64).


readonly optional blank?: number;

Defined in: image/image.ts:75

BLANK (integer images only), when the header declares it.


readonly bscale: number;

Defined in: image/image.ts:67


readonly bzero: number;

Defined in: image/image.ts:73

BZERO. A bigint BZERO is reported as the nearest number; the canonical 2^63 uint64 offset is exact, an arbitrary large bigint BZERO may not be. Use { raw: true } and the header for exactness.


readonly data: ImageArray;

Defined in: image/image.ts:64


readonly shape: readonly number[];

Defined in: image/image.ts:63

Axis lengths in FITS order. [] only for a header-only NAXIS=0 HDU; a declared zero-length axis keeps its rank (e.g. [4, 0]), matching astropy, with data empty either way.