Basics#

IO#

hs.open(path, /)#

Open a hyper-spectral image file.

The format is auto-detected using the path extension. Currently, PAM (.pam), ENVI (.hdr/.raw), and Custom (.yml) are supported.

Parameters:

path (str) – Path to the hyper-spectral image.

Returns:

The opened file.

Return type:

Image

hs.write(image, path)#

Write an image to a file.

The format is auto-detected using the path extension. Currently, PAM (.pam), ENVI (.hdr/.raw), and Custom (.yml) are supported.

Parameters:
  • image (Image) – Image to write.

  • path (str) – File output path. The extension determines the output file type.

Useful global definitions#

class hs.Shape(bands, samples, lines)#

Describes the shape of a hyper-spectral image.

Parameters:
bands#

The spectral bands of the image. None when the dimension is unbounded, for example for a continuously streaming source with no fixed number of bands.

Type:

int | None

lines#

This is the width of the image. For line-scan cameras, it is the length of a single line. None when the dimension is unbounded, for example for a continuously streaming source with no fixed width.

Type:

int | None

samples#

This is usually the height of the image. If the image was captured using a line-scan hyper-spectral camera, this is also the number of line images captured. None when the dimension is unbounded, for example for a continuously streaming source with no fixed number of lines.

Type:

int | None

class hs.ButeoPamType#

Special PAM-formats for Buteo machine output

New = ButeoPamType.New#
Old = ButeoPamType.Old#

Axes#

To make operations independent of memory ordering, the library uses the a type to specify axes:

class hs.Axis#

Named axes, independent of memory ordering.

Bands = Axis.Bands#
Lines = Axis.Lines#
Samples = Axis.Samples#

For convenience, the following shorthands are included:

hs.lines = hs.Axis.Lines#
hs.samples = hs.Axis.Samples#
hs.bands = hs.Axis.Bands#

Data types#

The library currently uses its own internal types that are analogous to NumPy’s datatypes (no complex numbers for now). This might change in the future. The types are marked with the following tag type:

class hs.DType#

Supported pixel value datatypes. Represents each of the supported underlying types of a dynamic array.

F16 = float16#
F32 = float32#
F64 = float64#
S16 = int16#
S32 = int32#
S64 = int64#
S8 = int8#
U16 = uint16#
U32 = uint32#
U64 = uint64#
U8 = uint8#

For convenience, the following shorthands are included:

hs.uint8 = hs.DType.U8#
hs.int8 = hs.DType.S8#
hs.uint16 = hs.DType.U16#
hs.int16 = hs.DType.S16#
hs.uint32 = hs.DType.U32#
hs.int32 = hs.DType.S32#
hs.uint64 = hs.DType.U64#
hs.int64 = hs.DType.S64#
hs.float32 = hs.DType.F32#
hs.float64 = hs.DType.F64#