Core types¶
Every high-level algorithm takes hdrl.core objects, not raw PyCPL
images. Constructors and method lists live in the
API Reference; this page is the mapping a pipeline author needs
before copy-pasting an algorithm snippet.
Image¶
hdrl.core.Image holds a data plane and an error plane. There
is no hdrl.core.Image.load. Load FITS with PyCPL
(cpl.core.Image.load or related I/O), then wrap both planes:
import numpy as np
import cpl.core
import hdrl
ny, nx = 64, 80
data = cpl.core.Image(np.full((ny, nx), 100.0, dtype=np.float64))
error = cpl.core.Image(np.full((ny, nx), 1.0, dtype=np.float64))
image = hdrl.core.Image(data, error)
Construction copies both PyCPL images. Later edits to data or
error do not change image. The error-plane bad-pixel mask is
ignored; the data-plane mask becomes the HDRL mask.
Use image.duplicate() for another independent HDRL copy.
hdrl.core.Image.zeros(width, height) allocates empty planes when you
do not have FITS yet.
Pixel methods are 0-based with order (y, x), matching PyCPL.
Rectangular HDRL regions (overscan windows, FPN DC-mask sizes) keep the
C/FITS 1-based (llx, lly, urx, ury) convention where an algorithm
page says so.
Arithmetic names that end in _create return a new image; names
without that suffix modify in place.
ImageList¶
hdrl.core.ImageList is a list of hdrl.core.Image. Create an empty
list and append() images, or collapse with
hdrl.func.Collapse / ImageList.collapse_*.
Some algorithms (Flat) consume the list: HDRL overwrites the C imagelist to save memory. Duplicate first if you still need the inputs. See Flat and Advanced Features.
Value tuples¶
PyHDRL does not bind a public hdrl_value class. Where HDRL C takes
{data, error}, pass a two-element sequence (data, error). Methods
that return a scalar HDRL value give a namedtuple with data,
error and invalid.
Spectrum1D¶
hdrl.core.Spectrum1D is the 1D counterpart used by Efficiency and
Response. Unlike some HDRL C constructors, PyHDRL requires strictly
increasing wavelengths. Typical construction (wavelengths in nm for
efficiency):
import numpy as np
import hdrl
wavelength = np.linspace(400.0, 800.0, 41)
flux = np.ones_like(wavelength)
flux_error = np.full_like(wavelength, 0.01)
spec = hdrl.core.Spectrum1D(flux, flux_error, wavelength, "linear")
C-to-Python names, ownership and experimental APIs are summarized in the API Reference (HDRL C → PyHDRL).