Metadata¶
hs.ImageMeta is the top-level metadata object attached to each image. It stores
the core layout and data type directly, while richer acquisition and file-format
details are grouped into focused metadata classes.
Section |
API |
Description |
|---|---|---|
Shape |
Image dimensions and interleave layout. |
|
Camera |
Camera and lens identity, model information, serial numbers, and acquisition configuration. |
|
Spectral |
Band count, wavelength metadata, spectral binning, response width, and spectral coregistration error. |
|
Spatial |
Optical and spatial sampling details such as focal length, slit width, spatial ROI, binning, field of view, and spatial coregistration error. |
|
Radiometric |
Measurement units, valid value limits, scaling, correction flags, gain, and radiometric quality information. |
|
Temporal |
Exposure time, frame timing, averaging, trigger mode, and acquisition start/end timestamps. |
|
Calibration |
Calibration process, calibration date, and optional extra calibration information used by downstream processing. |
|
Sensor |
Sensor artifact annotations such as bad pixels, bad bands, and repaired pixels. |
|
Encoding |
Pixel storage details such as byte order, scale factor, zero point, bit depth, and compression. |
|
Display |
Visualization hints such as default RGB bands and human-readable band names. |
|
Data Products |
Processing level of the stored data (raw, partially/fully corrected, or
reflectance), distinct from the physical unit recorded on
|
|
Extra |
Free-form metadata entries that are not represented by the structured
API fields, accessed with |
Image metadata¶
- class hs.ImageMeta(shape, interleave=None, dtype=None, camera=None, spectral=None, spatial=None, radiometric=None, temporal=None, calibration=None, sensor=None, encoding=None, display=None, description=None, data_offset=None, data_products=None, **py_kwargs)¶
Header information.
The header type contains a union of the metadata supported by the different HSI file formats. PAM files ignore certain entries, while ENVI and the custom yaml format support the full set of keys.
- Parameters:
interleave (Interleave | None)
dtype (DType)
camera (CameraMeta | None)
spectral (SpectralMeta | None)
spatial (SpatialMeta | None)
radiometric (RadiometricMeta | None)
temporal (TemporalMeta | None)
calibration (CalibrationMeta | None)
sensor (SensorMeta | None)
encoding (EncodingMeta | None)
display (DisplayMeta | None)
description (str | None)
data_offset (int | None)
data_products (DataProductsMeta | None)
py_kwargs (Any)
- n_planes()¶
Get the number of planes in the image, i.e. the dimension of the outer axis. Depends on the interleave.
- plane_shape()¶
Get the natural plane shape, i.e. the shape of the two innermost dimensions of the interleave shape.
- calibration¶
Calibration provenance metadata.
- Type:
- camera¶
Camera identification and optics metadata.
- Type:
- data_offset¶
Get optional data offset (used for binary files with embedded headers).
- Getter:
- Type:
int | None
- data_products¶
Data product processing-level metadata.
- Type:
- display¶
Display hint metadata.
- Type:
- encoding¶
Pixel encoding metadata.
- Type:
- interleave¶
Image interleave mode.
- Type:
- radiometric¶
Radiometric characteristics metadata.
- Type:
- sensor¶
Sensor artifact metadata.
- Type:
- spatial¶
Spatial characteristics metadata.
- Type:
- spectral¶
Spectral characteristics metadata.
- Type:
- temporal¶
Temporal acquisition metadata.
- Type:
Legacy compatibility accessors¶
These attributes are kept for older code and map onto the grouped metadata objects shown above.
- ImageMeta.byte_order¶
Data byte-ordering.
- Type:
- ImageMeta.capture¶
Camera acquisition parameters (compatibility shim).
- Type:
CaptureMeta | None
- ImageMeta.default_bands¶
Bands indexes used for displaying false color images.
- ImageMeta.measurement_info¶
Radiometric measurement info (compatibility shim).
- Type:
MeasurementInfo | None
- ImageMeta.wavelength_info¶
Information about data wavelengths.
- Getter:
- Type:
WavelengthMeta | None
Shape and layout¶
- class hs.Shape(bands, samples, lines)
Describes the shape of a hyper-spectral image.
- bands
The spectral bands of the image.
Nonewhen 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.
Nonewhen 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.
Nonewhen the dimension is unbounded, for example for a continuously streaming source with no fixed number of lines.- Type:
int | None
- class hs.ShapeMeta(streaming_dim, plane_dim, interleave)¶
- Parameters:
streaming_dim (Optional[int])
interleave (Interleave)
- interleave¶
Image interleave mode.
- Type:
- class hs.Interleave¶
Data interleave mode.
Defines the memory layout of the file. To achieve good performance, as suitable interleave mode should be used for a given application.
- BSQ: The full image for each spectral band is stored consecutively in memory. This format is
effective for spatial access.
- BIP: All spectral bands for each pixel is stored consecutively, followed by a line of pixels.
This format is effective for spectral access.
- BIL: Each line of pixels is stored consecutively for each band. This format achieves improved
spatial access along the width of the image while retaining good performance for spectral access as well.
A good default for images is the BIL format which is balanced between spatial and spectral access.
- axis_num(axis)¶
- BIL = BIL¶
- BIP = BIP¶
- BSQ = BSQ¶
- class hs.Axis
Named axes, independent of memory ordering.
- Bands = Axis.Bands
- Lines = Axis.Lines
- Samples = Axis.Samples
Metadata categories¶
- class hs.CameraMeta(id=None, architecture=None, manufacturer=None, model_name=None, serial=None, lens_manufacturer=None, lens_model=None, lens_serial=None, configuration=None, pixel_pitch_um=None)¶
Camera identification and optics metadata (P4001 §7, Camera section).
- architecture¶
Camera architecture, such as line-imaging spectrometer, scanned point spectrometer, array camera, or tunable-filter camera.
- Type:
str | None
- class hs.SpectralMeta(number_of_bands=None, binning=None, wavelengths=None, response_fwhm=None, coregistration_error=None)¶
Spectral characteristics metadata (P4001 §7, Spectral section).
- number_of_bands¶
Number of spectral bands, when not implied by wavelength metadata or image shape.
- Type:
int | None
- response_fwhm¶
Spectral response function width per band, typically expressed in the same unit as the wavelengths.
- wavelengths¶
Center wavelength for each spectral band, including wavelength units.
- Type:
WavelengthMeta | None
- class hs.SpatialMeta(focal_length_mm=None, slit_width_um=None, spatial_roi=None, binning=None, fov=None, psf_width=None, coregistration_error=None)¶
Spatial characteristics metadata (P4001 §7, Spatial section).
- class hs.RadiometricMeta(unit=Ellipsis, dark_corrected=None, negative_truncated=None, linearity_error=None, aperture=None, read_noise=None, effective_throughput=None, adc_gain=None, limits=None, scaling=None)¶
Radiometric characteristics metadata (P4001 §7, Radiometric section).
- effective_throughput¶
Effective throughput per band, used for radiometric noise estimation.
- limits¶
Valid or expected measurement limits for pixel values.
- Type:
MeasurementLimits | None
- unit¶
Radiometric unit of measurement for pixel values.
Assigning one of the deprecated variants (
Raw,Absorbance,Arbitrary) raises aDeprecationWarning.- Type:
- class hs.TemporalMeta(exposure_time_ms=None, frame_time_ms=None, n_averages=None, trigger_mode=None, start_time=None, end_time=None)¶
Temporal acquisition metadata (P4001 §7, Temporal section).
- end_time¶
End time of the collection.
- Type:
datetime.datetime | None
- start_time¶
Start time of the collection.
- Type:
datetime.datetime | None
- trigger_mode¶
Triggering mode used during acquisition.
- Type:
TriggerMode | None
- class hs.CalibrationMeta(calibration_process=None, calibration_date=None, additional_info=None)¶
Calibration provenance metadata (P4001 §7, Calibration Information section).
- additional_info¶
Additional calibration data required for downstream post-processing.
- Type:
Any | None
- calibration_date¶
Date and time of the sensor calibration.
- Type:
datetime.datetime | None
- class hs.SensorMeta(bad_pixels=None, bad_bands=None, repaired_pixels=None)¶
Sensor artifact metadata (P4001 §7, Sensor Artifacts section).
- class hs.EncodingMeta(byte_order=Ellipsis, scale_factor=None, zero_point=None, bits_per_pixel=None)¶
Pixel encoding metadata (P4001 §7, Pixel Encoding section).
- byte_order¶
Byte ordering used for multi-byte pixel values.
- Type:
- compression¶
Compression settings used for encoded pixel data.
Nonewhen the pixel data is stored uncompressed. Otherwise an object describing the compression method and its parameters; the only method currently produced is JPEG, which carries aqualityfield.- Type:
object | None
- class hs.DisplayMeta(default_bands=None, band_names=None)¶
Display hint metadata (P4001 §7, Display section).
- class hs.DataProductsMeta(output_data=None)¶
Data product processing-level metadata (P4001 §7, Data Products Basics section).
- output_data¶
Processing level of the stored data (raw, partially/fully corrected, or reflectance).
- Type:
OutputDataType | None
- class hs.OutputDataType¶
Data product processing level (P4001 §7, Data Products Basics section).
This is distinct from RadiometricMeta::unit, which records the physical unit of the stored values (DN, reflectance, radiance, …). OutputDataType instead records how far the data has been processed towards that unit, e.g. distinguishing raw sensor data from data that has been partially or fully corrected.
- AbsoluteRadiometric = OutputDataType.AbsoluteRadiometric¶
- PartiallyCorrectedData = OutputDataType.PartiallyCorrectedData¶
- RawData = OutputDataType.RawData¶
- Reflectance = OutputDataType.Reflectance¶
- RelativeRadiometric = OutputDataType.RelativeRadiometric¶
Spectral metadata¶
- class hs.WavelengthMeta(band_data, unit)¶
Data wavelength information.
Describes the wavelength for each band in the represented data. All units supported by the ENVI format are supported.
- unit¶
Unit of each wavelength.
- Type:
- class hs.WavelengthUnit¶
Wavelength units.
- Angstroms = WavelengthUnit.Angstroms¶
- Centimeter = WavelengthUnit.Centimeter¶
- GHz = WavelengthUnit.GHz¶
- Index = WavelengthUnit.Index¶
- MHz = WavelengthUnit.MHz¶
- Meter = WavelengthUnit.Meter¶
- Micrometer = WavelengthUnit.Micrometer¶
- Millimeter = WavelengthUnit.Millimeter¶
- Nanometer = WavelengthUnit.Nanometer¶
- Unknown = WavelengthUnit.Unknown¶
- WaveNumber = WavelengthUnit.WaveNumber¶
Radiometric metadata¶
- class hs.MeasurementInfo(unit, limits=None, scaling=None)¶
Radiometric measurement info (kept for FFI and migration compatibility; prefer RadiometricMeta).
- limits¶
Valid or expected measurement limits for pixel values.
- Type:
MeasurementLimits | None
- unit¶
Radiometric unit of measurement for pixel values.
Assigning one of the deprecated variants (
Raw,Absorbance,Arbitrary) raises aDeprecationWarning.- Type:
- class hs.MeasurementLimits(min, max)¶
Valid or expected measurement limits for pixel values.
- class hs.MeasurementUnit¶
Radiometric unit of measurement for pixel values (P4001 §7, Radiometric section).
The non-deprecated variants are the values IEEE 4001-2025 (7.1.1, Table 5) defines for “Radiometric unit of measurement”, plus [MeasurementUnit::Unknown] for the not-yet-set case.
This records only the unit the stored values are expressed in. How far the data has been processed to reach that unit is a separate axis, recorded as [OutputDataType] on [DataProductsMeta].
- Absorbance = MeasurementUnit.Absorbance¶
- Arbitrary = MeasurementUnit.Arbitrary¶
- Dn = MeasurementUnit.Dn¶
- Microflick = MeasurementUnit.Microflick¶
- RadianceNmSr = MeasurementUnit.RadianceNmSr¶
- RadianceUmSr = MeasurementUnit.RadianceUmSr¶
- Raw = MeasurementUnit.Raw¶
- Reflectance = MeasurementUnit.Reflectance¶
- Unknown = MeasurementUnit.Unknown¶
Note
The Raw, Absorbance, and Arbitrary members are deprecated: IEEE 4001-2025
(7.1.1, Table 5) does not define them as radiometric units. Assigning one to
hs.RadiometricMeta.unit raises a DeprecationWarning.
Raw conflated the unit with the processing level; use Dn together with
hs.DataProductsMeta.output_data set to
hs.OutputDataType.RawData. For Absorbance and Arbitrary, use
Unknown and record the unit as extra metadata on hs.ImageMeta.
Acquisition metadata¶
- class hs.CaptureMeta(exposure_time_micro, capture_bit_depth, gain_db)¶
Camera acquisition parameters (kept for FFI and migration compatibility; prefer TemporalMeta, EncodingMeta, and RadiometricMeta).