Continuum

Continuum Configuration

Continuum configuration for spectral fitting.

class unite.continuum.config.Scale(name=None, *, prior=None)[source]

Bases: Parameter

Typed token for the 'scale' parameter slot.

scale is the continuum flux at norm_wav. When the same Scale instance is placed in the 'scale' slot of multiple ContinuumRegion objects, those regions share a single sampled amplitude in the model.

Placing a Scale token in any slot other than 'scale' raises a ValueError at ContinuumConfiguration construction time.

Parameters:
namestr, optional

Human-readable label used as the numpyro site name.

priorPrior, optional

Prior distribution. Defaults to Uniform(0, 2).

Parameters:
  • name (str | None)

  • prior (Prior | None)

class unite.continuum.config.NormWavelength(name=None, *, prior=None)[source]

Bases: Parameter

Typed token for the 'norm_wav' parameter slot.

norm_wav is the rest-frame reference wavelength at which the continuum equals scale. The model automatically applies the systemic redshift before evaluating the continuum form.

Sharing the same NormWavelength instance across multiple regions ties them to a single consistent reference wavelength — essential for globally-normalised forms such as PowerLaw and Blackbody.

Placing a NormWavelength token in any slot other than 'norm_wav' raises a ValueError at ContinuumConfiguration construction time.

Parameters:
namestr, optional

Human-readable label used as the numpyro site name.

priorPrior, optional

Prior distribution. Defaults to Fixed(1.0) (1 micron).

Parameters:
  • name (str | None)

  • prior (Prior | None)

class unite.continuum.config.ContShape(name=None, *, prior=None)[source]

Bases: Parameter

Typed token for form-specific shape/parameter slots.

Used for continuum form parameters such as spectral indices (beta), polynomial coefficients (c1, c2, etc.), and other dimensionless or form-specific parameters (e.g. angle, temperature, tau_v). The default prior is Uniform(-10, 10); in practice the form’s default_priors() provides a more specific default when no token is supplied explicitly.

Parameters:
namestr, optional

Human-readable label used as the numpyro site name.

priorPrior, optional

Prior distribution. Defaults to Uniform(-10, 10).

Parameters:
  • name (str | None)

  • prior (Prior | None)

class unite.continuum.config.ContinuumRegion(low, high, form=<factory>, params=<factory>, name=None)[source]

Bases: object

A single continuum region with wavelength bounds and functional form.

Parameters:
lowastropy.units.Quantity

Lower wavelength bound (must have length units).

highastropy.units.Quantity

Upper wavelength bound (must have length units).

formContinuumForm

Functional form for the continuum in this region.

paramsdict of str to Parameter, optional

Parameter tokens for the form’s parameters, keyed by ContinuumForm.param_names(). Parameters not listed here receive auto-created tokens with the form’s default priors when the region is added to a ContinuumConfiguration.

namestr, optional

Human-readable label for this region. When provided, auto-created parameter tokens use this as a suffix (e.g. scale_blue, beta_blue). Region names must be unique within a ContinuumConfiguration.

Custom priors — supply a Parameter with the desired prior for any slot you want to override:

from unite.prior import Parameter, TruncatedNormal
region = ContinuumRegion(
    1.0 * u.um, 1.5 * u.um, form=PowerLaw(),
    params={
        'scale': Parameter('my_scale',
                           prior=TruncatedNormal(2.0, 0.5, 0, 10)),
        # 'beta' and 'norm_wav' get default priors
    },
)

Shared parameters — pass the same Parameter instance in the params dict of multiple regions. The ContinuumConfiguration detects shared identity and creates a single numpyro site, coupling those regions to one sampled value:

shared_scale = Parameter('global_scale', prior=Uniform(0, 10))
region1 = ContinuumRegion(1.0 * u.um, 1.5 * u.um, form=PowerLaw(),
                          params={'scale': shared_scale})
region2 = ContinuumRegion(2.0 * u.um, 2.5 * u.um, form=PowerLaw(),
                          params={'scale': shared_scale})

Use Scale and NormWavelength typed tokens for the 'scale' and 'norm_wav' slots respectively; they add a validation check that prevents accidentally assigning them to the wrong slot.

Raises:
TypeError

If low or high are not astropy Quantities with length units.

ValueError

If low >= high.

Parameters:
low: Quantity | float
high: Quantity | float
form: ContinuumForm | str
params: dict[str, Parameter]
name: str | None = None
property center: float

Midpoint wavelength of the region.

class unite.continuum.config.ContinuumConfiguration(regions=None, *, zorder=0)[source]

Bases: object

Collection of continuum regions for spectral fitting.

Regions are sorted by wavelength at construction time and must not overlap. Parameters for each region are represented as Parameter tokens. Sharing the same token instance across multiple regions ties those parameters to a single sampled value in the model — analogous to how FWHM and Flux tokens work for emission lines.

Parameters:
regionslist of ContinuumRegion, optional

Continuum regions. Will be sorted by low bound.

Raises:
ValueError

If any two regions overlap.

Parameters:

Examples

Auto-generate from line wavelengths (independent local continua):

>>> from astropy import units as u
>>> from unite.continuum import ContinuumConfiguration
>>> cont = ContinuumConfiguration.from_lines(
...     [6564.61, 4862.68, 6585.27, 6549.86] * u.AA)
>>> len(cont)
2

Manual construction with independent regions and custom priors:

>>> from astropy import units as u
>>> from unite.continuum.config import (
...     ContinuumConfiguration, ContinuumRegion)
>>> from unite.continuum.library import Linear
>>> from unite.prior import Parameter, TruncatedNormal, Fixed
>>> region = ContinuumRegion(
...     1.0 * u.um, 1.5 * u.um, form=Linear(),
...     params={
...         'scale': Parameter('my_scale',
...                            prior=TruncatedNormal(2.0, 0.5, 0.0, 10.0)),
...         'norm_wav': Parameter('my_nw', prior=Fixed(1.25)),
...         # 'slope' receives the default Uniform(-10, 10) prior
...     },
... )
>>> cont = ContinuumConfiguration([region])

Global power-law with parameters shared across two spectral windows:

>>> from astropy import units as u
>>> from unite.continuum.config import (
...     ContinuumConfiguration, ContinuumRegion, Scale, NormWavelength, ContShape)
>>> from unite.continuum.library import PowerLaw
>>> from unite.prior import Uniform, Fixed
>>> pl = PowerLaw()
>>> shared_scale = Scale('pl_scale', prior=Uniform(0, 10))
>>> shared_beta  = ContShape('pl_beta',  prior=Uniform(-5, 5))
>>> shared_nw    = NormWavelength(
...     'pl_nw', prior=Fixed(1.0))  # single reference wavelength
>>> cont = ContinuumConfiguration([
...     ContinuumRegion(0.9 * u.um, 1.4 * u.um, form=pl,
...                     params={'scale': shared_scale, 'beta': shared_beta,
...                             'norm_wav': shared_nw}),
...     ContinuumRegion(1.7 * u.um, 2.5 * u.um, form=pl,
...                     params={'scale': shared_scale, 'beta': shared_beta,
...                             'norm_wav': shared_nw}),
... ])
>>> # → one 'pl_scale', one 'pl_beta', one 'pl_nw' site in the numpyro model
zorder: int
property resolved_params: list[dict[str, Parameter]]

Resolved parameter tokens for each region (read-only copy).

Index i contains the full {param_name: Parameter} mapping for self.regions[i], including auto-created tokens for any parameters the user did not explicitly provide.

classmethod from_lines(wavelengths, width=<Quantity 15000. km / s>, form=None, *, zorder=0)[source]

Auto-generate continuum regions from line wavelengths.

Each line gets a region of total width width (i.e. ±width/2 in velocity space around the line center). Overlapping regions are merged. All generated regions are independent: each receives its own auto-created parameter tokens.

Return type:

ContinuumConfiguration

Parameters:
wavelengthsastropy.units.Quantity

Rest-frame wavelengths of spectral lines (must have length units).

widthastropy.units.Quantity, optional

Total velocity width of each region (must have velocity units, e.g. km/s). Each line is padded by ±width/2. Defaults to 3000 km/s.

formContinuumForm, optional

Functional form to assign to every region. Defaults to Linear.

Returns:
ContinuumConfiguration
Raises:
TypeError

If wavelengths is not an astropy Quantity with length units, or if width is not a Quantity with velocity units.

ValueError

If wavelengths is empty or width is not positive.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Unique ContinuumForm instances are collected into a 'forms' section keyed by auto-generated names. Unique Parameter tokens are collected into a 'params' section keyed by their names. Each region references its form and params by name, so shared token objects round-trip correctly.

Return type:

dict

Returns:
dict

Keys: 'params', 'forms', 'regions'.

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

ContinuumConfiguration

Parameters:
ddict

As produced by to_dict().

Returns:
ContinuumConfiguration
Parameters:

d (dict)

to_yaml()[source]

Serialize to a YAML string.

Return type:

str

Returns:
str
classmethod from_yaml(text)[source]

Deserialize from a YAML string.

Return type:

ContinuumConfiguration

Parameters:
textstr

YAML string as produced by to_yaml().

Returns:
ContinuumConfiguration
Parameters:

text (str)

save(path)[source]

Save to a YAML file.

Return type:

None

Parameters:
pathstr or Path

Output file path.

Parameters:

path (str | Path)

classmethod load(path)[source]

Load from a YAML file.

Return type:

ContinuumConfiguration

Parameters:
pathstr or Path

Path to a YAML file written by save().

Returns:
ContinuumConfiguration
Parameters:

path (str | Path)

property regions: list[ContinuumRegion]

List of continuum regions (read-only copy).

Continuum Forms

Continuum functional forms: abstract base and concrete implementations.

class unite.continuum.library.ContinuumForm[source]

Bases: ABC

Abstract base class for continuum functional forms.

Each subclass defines a parameterised continuum model that can be evaluated at an array of wavelengths. Forms are stateless (or carry only static configuration like polynomial degree) and are fully serialisable for YAML round-trip.

All forms share a unified parameter interface:

  • scale — the continuum flux at norm_wav.

  • norm_wav — rest-frame reference wavelength where the continuum equals scale. Default prior is Fixed(region_center), pinning it to the region midpoint. Pass an explicit ContinuumNormalizationWavelength token with Fixed(value) to share a consistent reference wavelength across multiple regions.

Subclasses must implement param_names(), default_priors(), evaluate(), to_dict(), and from_dict().

abstractmethod param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

abstractmethod default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

property n_params: int

Number of free parameters (including Fixed reference parameters).

abstractmethod evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
integrate(low, high, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Pixel-integrated continuum model.

Evaluates the (optionally LSF-convolved) continuum averaged over each pixel bin [low, high]. The default implementation evaluates at pixel centres, which is exact for forms whose variation across a pixel is negligible (e.g. Linear).

Subclasses may override this to provide analytic integration.

Return type:

Array

Parameters:
low, highArrayLike, shape (n_pixels,)

Pixel bin edges (observed frame, canonical wavelength unit).

centerfloat

Region midpoint in observed frame.

paramsdict of str to ArrayLike

Parameter values keyed by param_names().

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each pixel centre (same unit as low/high). Default 0.0 means no LSF convolution.

Returns:
Array

Pixel-averaged continuum flux, shape (n_pixels,).

Parameters:
property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
abstractmethod param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
abstractmethod to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

abstractmethod classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

ContinuumForm

Parameters:

d (dict)

unite.continuum.library.form_from_dict(d)[source]

Reconstruct a ContinuumForm from a serialised dictionary.

Return type:

ContinuumForm

Parameters:
ddict

Must contain a 'type' key matching a registered form name.

Returns:
ContinuumForm
Raises:
ValueError

If the type is not recognised.

Parameters:

d (dict)

unite.continuum.library.get_form(name_or_form, **kwargs)[source]

Get a ContinuumForm by name or pass through an existing instance.

Return type:

ContinuumForm

Parameters:
name_or_formstr or ContinuumForm

A registered form name (e.g. 'Linear', 'PowerLaw', 'Polynomial') or an existing ContinuumForm instance.

**kwargs

Passed to the form constructor when name_or_form is a string (e.g. get_form('Polynomial', degree=3)).

Returns:
ContinuumForm
Raises:
ValueError

If the name is not recognised.

Parameters:

name_or_form (str | ContinuumForm)

Examples

>>> get_form('Linear')
Linear()
>>> get_form('Polynomial', degree=3)
Polynomial(degree=3)
>>> get_form(Linear())  # pass-through
Linear()
class unite.continuum.library.Linear[source]

Bases: ContinuumForm

Linear continuum: scale + slope * (wavelength - norm_wav).

This form has no constructor parameters.

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • slope — Continuum slope in flux per wavelength unit. Default prior: Uniform(-10, 10).

  • norm_wav — Reference wavelength where the continuum equals scale. Default prior: Fixed(region_center).

property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

Linear

Parameters:

d (dict)

class unite.continuum.library.Polynomial(degree=1)[source]

Bases: ContinuumForm

Polynomial continuum of configurable degree.

Evaluates scale + c1*x + c2*x**2 + ... where x = wavelength - norm_wav.

Parameters:
degreeint

Polynomial degree (default 1).

Parameters:

degree (int)

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • c1, c2, ... — Higher-order polynomial coefficients. Default prior: Uniform(-10, 10) each.

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
property degree: int

Polynomial degree.

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
integrate(low, high, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Pixel-integrated continuum model.

Evaluates the (optionally LSF-convolved) continuum averaged over each pixel bin [low, high]. The default implementation evaluates at pixel centres, which is exact for forms whose variation across a pixel is negligible (e.g. Linear).

Subclasses may override this to provide analytic integration.

Return type:

Array

Parameters:
low, highArrayLike, shape (n_pixels,)

Pixel bin edges (observed frame, canonical wavelength unit).

centerfloat

Region midpoint in observed frame.

paramsdict of str to ArrayLike

Parameter values keyed by param_names().

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each pixel centre (same unit as low/high). Default 0.0 means no LSF convolution.

Returns:
Array

Pixel-averaged continuum flux, shape (n_pixels,).

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

Polynomial

Parameters:

d (dict)

class unite.continuum.library.Chebyshev(order=2, stretch=1.0)[source]

Bases: ContinuumForm

Chebyshev polynomial continuum of configurable order.

Evaluates a Chebyshev series on coordinates normalized to [-1, 1] within the continuum region, normalized so that the continuum equals scale at norm_wav. Numerically more stable than a standard polynomial basis for higher orders.

The x-coordinate is (wavelength - center) / (half_width * stretch) where half_width is derived from the region bounds passed to evaluate(), and stretch is a form-specific scaling factor (default 1.0 for identity normalization).

The continuum is parameterized as scale * T(x) / T(x_nw) where T is the Chebyshev series with constant term fixed at 1.0, and x_nw is the normalized coordinate at norm_wav.

Parameters:
orderint

Chebyshev order (default 2). Number of coefficients = order + 1.

stretchfloat

Stretch factor to scale the region normalization (default 1.0).

Parameters:

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • c1, c2, ... — Higher-order Chebyshev coefficients (normalized to constant term 1.0). Default prior: Uniform(-10, 10) each.

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
property order: int

Chebyshev order.

property stretch: float

Stretch factor for the region normalization.

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
integrate(low, high, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Pixel-integrated continuum model.

Evaluates the (optionally LSF-convolved) continuum averaged over each pixel bin [low, high]. The default implementation evaluates at pixel centres, which is exact for forms whose variation across a pixel is negligible (e.g. Linear).

Subclasses may override this to provide analytic integration.

Return type:

Array

Parameters:
low, highArrayLike, shape (n_pixels,)

Pixel bin edges (observed frame, canonical wavelength unit).

centerfloat

Region midpoint in observed frame.

paramsdict of str to ArrayLike

Parameter values keyed by param_names().

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each pixel centre (same unit as low/high). Default 0.0 means no LSF convolution.

Returns:
Array

Pixel-averaged continuum flux, shape (n_pixels,).

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

Chebyshev

Parameters:

d (dict)

class unite.continuum.library.BSpline(knots, degree=3)[source]

Bases: ContinuumForm

B-spline continuum with local knot control.

The knot vector must be set via knots at construction time (typically derived from the wavelength coverage of the spectrum). Knots should be in the same wavelength unit as the ContinuumRegion bounds; they are converted to the canonical unit at region construction time via _prepare(). Knots must fall within the region bounds.

The continuum is normalized so that it equals scale at norm_wav, parameterized as scale * S(u) / S(u_nw) where S is the B-spline series with first coefficient fixed at 1.0, and u_nw is the normalized coordinate at norm_wav.

Parameters:
knotsu.Quantity

Knot vector in wavelength units. It is automatically clamped at the region bounds.

degreeint

Spline degree (default 3 for cubic).

Parameters:
  • knots (u.Quantity)

  • degree (int)

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • coeff_1, coeff_2, — Remaining B-spline coefficients (normalized to first 1.0). Default prior: Uniform(-10, 10) each.

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
property degree: int

Spline degree.

property n_basis: int

Number of B-spline basis functions.

property knots: Quantity

Knot vector (in the original units passed at construction).

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

BSpline

Parameters:

d (dict)

class unite.continuum.library.Bernstein(degree=4, stretch=1.0)[source]

Bases: ContinuumForm

Global Bernstein polynomial continuum, normalized at a reference wavelength.

Evaluates a Bernstein series on coordinates normalized to [0, 1] within the continuum region, normalized so that the continuum equals scale at norm_wav.

The wavelength range is derived from the region bounds passed to evaluate(), normalized to [0, 1] for the Bernstein basis. The stretch parameter optionally scales the region normalization.

The continuum is parameterized as scale * B(t) / B(t_nw) where B is the Bernstein series with first term fixed at 1.0, and t_nw is the normalized coordinate at norm_wav.

Parameters:
degreeint

Polynomial degree (default 4). Number of coefficients = degree + 1.

stretchfloat

Stretch factor to scale the region normalization (default 1.0).

Parameters:

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • coeff_1, coeff_2, — Remaining Bernstein coefficients (normalized to first term 1.0). Default prior: Uniform(-10, 10) each.

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

property is_linear: bool

Whether the form is linear in its fitted parameters.

Linear forms can be solved exactly via weighted least squares. Nonlinear forms require iterative solvers (e.g. Gauss-Newton).

Returns:
bool
property degree: int

Polynomial degree.

property stretch: float

Stretch factor for the region normalization.

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
integrate(low, high, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Pixel-integrated continuum model.

Evaluates the (optionally LSF-convolved) continuum averaged over each pixel bin [low, high]. The default implementation evaluates at pixel centres, which is exact for forms whose variation across a pixel is negligible (e.g. Linear).

Subclasses may override this to provide analytic integration.

Return type:

Array

Parameters:
low, highArrayLike, shape (n_pixels,)

Pixel bin edges (observed frame, canonical wavelength unit).

centerfloat

Region midpoint in observed frame.

paramsdict of str to ArrayLike

Parameter values keyed by param_names().

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each pixel centre (same unit as low/high). Default 0.0 means no LSF convolution.

Returns:
Array

Pixel-averaged continuum flux, shape (n_pixels,).

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

Bernstein

Parameters:

d (dict)

class unite.continuum.library.PowerLaw[source]

Bases: ContinuumForm

Power-law continuum: scale * (wavelength / norm_wav) ** beta.

This form has no constructor parameters.

To share a consistent reference wavelength across multiple regions (required for physically meaningful parameter sharing), pass a ContinuumNormalizationWavelength with Fixed(value) carrying your chosen reference wavelength.

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum level at norm_wav. Default prior: Uniform(0, 10).

  • beta — Power-law index (dimensionless). Default prior: Uniform(-5, 5).

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

PowerLaw

Parameters:

d (dict)

class unite.continuum.library.Blackbody[source]

Bases: ContinuumForm

Planck blackbody continuum normalized at a reference wavelength.

Evaluates scale * B_λ(T) / B_λ(norm_wav, T) so that scale directly represents the continuum flux at norm_wav. Wavelength parameters may be in any unit; automatic unit conversion to microns is applied internally.

norm_wav is a named parameter with a default Fixed(region_center) prior. Pass an explicit ContinuumNormalizationWavelength with Fixed(value) to pin it to a specific wavelength across multiple regions — essential for physically consistent normalization when fitting a single blackbody across disjoint spectral windows.

This form has no constructor parameters.

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum flux at norm_wav (in units of continuum_scale). Default prior: Uniform(0, 10).

  • temperature — Blackbody temperature in Kelvin. Default prior: Uniform(100, 50000).

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

Blackbody

Parameters:

d (dict)

class unite.continuum.library.ModifiedBlackbody[source]

Bases: ContinuumForm

Modified blackbody: scale * B_λ(T) * / norm_wav)^beta / B_λ(nw, T).

The power-law modifier beta broadens (beta > 0) or narrows (beta < 0) the SED relative to a pure blackbody. beta = 0 recovers Blackbody. Wavelength parameters may be in any unit; automatic unit conversion to microns is applied internally.

norm_wav is a named parameter with a default Fixed(region_center) prior. Share a ContinuumNormalizationWavelength token across regions to enforce a consistent reference wavelength.

This form has no constructor parameters.

Notes

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Continuum flux at norm_wav (in units of continuum_scale). Default prior: Uniform(0, 10).

  • temperature — Blackbody temperature in Kelvin. Default prior: Uniform(100, 50000).

  • beta — Power-law modifier index (dimensionless). Default prior: Uniform(-4, 4).

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

ModifiedBlackbody

Parameters:

d (dict)

class unite.continuum.library.AttenuatedBlackbody(lambda_ext=<Quantity 5500. Angstrom>)[source]

Bases: ContinuumForm

Dust-attenuated blackbody continuum.

Evaluates scale * B_λ(T) / B_λ(nw,T) * exp(-tau_v * [(λ/lambda_ext)^alpha - (nw/lambda_ext)^alpha]).

Extinction is normalized at norm_wav so that scale represents the observed (attenuated) flux there. Negative alpha gives steeper extinction at short wavelengths (typical dust law). Wavelength parameters may be in any unit; automatic unit conversion to microns is applied internally.

Parameters:
lambda_extastropy.units.Quantity

Reference wavelength for the extinction law. Must be Quantity with any length unit — it will be converted automatically. Defaults to 5500 * u.AA.

Parameters:

lambda_ext (u.Quantity)

Notes

lambda_ext is a static configuration parameter (not sampled). It is stored in microns internally and, along with evaluation wavelengths, automatically converted at model-build time via _prepare().

Model parameters (sampled with priors, overridable via ContinuumRegion(params={...})):

  • scale — Observed continuum flux at norm_wav (in units of continuum_scale). Default prior: Uniform(0, 10).

  • temperature — Blackbody temperature in Kelvin. Default prior: Uniform(100, 50000).

  • tau_v — Optical depth at lambda_ext. Default prior: Uniform(0, 5).

  • alpha — Dust extinction power-law index (negative = steeper at short λ). Default prior: Uniform(-2, 0).

  • norm_wav — Reference wavelength. Default prior: Fixed(region_center).

property lambda_ext: Quantity

Extinction reference wavelength as an astropy Quantity.

param_names()[source]

Names of the parameters this form requires.

Return type:

tuple[str, ...]

Returns:
tuple of str

Parameter names. Always includes 'scale' and 'norm_wav'.

default_priors(region_center=1.0)[source]

Return sensible default priors for each parameter.

The keys must match param_names().

Return type:

dict[str, Prior]

Parameters:
region_centerfloat

Midpoint of the continuum region, used as the default Fixed value for norm_wav.

Returns:
dict of str to Prior
Parameters:

region_center (float)

param_units(flux_unit, wl_unit)[source]

Physical unit mapping for each parameter.

Return type:

dict[str, tuple[bool, UnitBase | None]]

Parameters:
flux_unitastropy.units.UnitBase

Flux density unit of the spectrum (e.g. u.Unit('erg s-1 cm-2 AA-1')).

wl_unitastropy.units.UnitBase

Canonical wavelength unit (e.g. u.um).

Returns:
dict of str to (bool, unit)

For each parameter name: (apply_continuum_scale, physical_unit). If apply_continuum_scale is True, multiply the sampled value by continuum_scale to recover the physical quantity. physical_unit is the resulting astropy unit, or None for dimensionless parameters.

Parameters:
evaluate(wavelength, center, params, obs_low, obs_high, lsf_fwhm=0.0)[source]

Evaluate the (optionally LSF-convolved) continuum model.

All operations must use jax.numpy so the function is compatible with JAX tracing / JIT compilation.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength array (observed frame).

centerfloat

Region midpoint in observed frame (passed for convenience; forms use params['norm_wav'] instead).

paramsdict of str to ArrayLike

Parameter values keyed by param_names(). params['norm_wav'] is already in observed frame (the model applies the systemic redshift before calling this method).

obs_lowfloat

Lower observed-frame wavelength bound of the region.

obs_highfloat

Upper observed-frame wavelength bound of the region.

lsf_fwhmArrayLike, optional

LSF FWHM at each wavelength point (same unit as wavelength). Default 0.0 means no LSF convolution.

Returns:
Array

Continuum flux at each wavelength.

Parameters:
to_dict()[source]

Serialize to a YAML-safe dictionary.

Return type:

dict

classmethod from_dict(d)[source]

Deserialize from a dictionary.

Return type:

AttenuatedBlackbody

Parameters:

d (dict)

Continuum Functions

JAX-jitted continuum evaluation kernels.

All functions are pure JAX with no numpyro dependency and are designed to be called from within jax.jit()-compiled model code.

unite.continuum.functions.planck_function(wavelength_micron, temperature_k, pivot_micron)[source]

Return the normalized Planck function B_λ(T) / B_λ(pivot, T).

Returns the blackbody spectral radiance normalized to unity at pivot_micron, so the fitted amplitude directly represents the observed flux at the pivot wavelength.

Return type:

Array

Parameters:
wavelength_micronArrayLike

Rest-frame wavelengths in microns.

temperature_kArrayLike

Temperature in Kelvin.

pivot_micronfloat

Normalization wavelength in microns.

Returns:
Array

Normalized Planck function (= 1 at pivot_micron).

Parameters:

Notes

Physical constants are pre-combined to avoid gradient overflow in JAX when differentiating exp(hc / λkT) with respect to temperature.

unite.continuum.functions.chebval(x, coeffs)[source]

Evaluate a Chebyshev series using the trigonometric identity.

Return type:

Array

Parameters:
xArrayLike

Evaluation points, normalized to [-1, 1].

coeffslist of ArrayLike

Chebyshev coefficients [c0, c1, ..., cN].

Returns:
Array

Series value at each point in x.

Parameters:
unite.continuum.functions.bernstein_eval(x, coeffs, binom_coeffs)[source]

Evaluate a Bernstein polynomial series using a vectorized basis matrix.

Parameters:
xArrayLike

Evaluation points, must be normalized to the range [0, 1]. Shape: (N,).

coeffsArrayLike

Bernstein coefficients (control points). Shape: (n + 1,).

binom_coeffsArrayLike

Pre-computed binomial coefficients for degree n, where binom_coeffs[i] = C(n, i). Shape: (n + 1,).

Returns:
Array

The evaluated polynomial values at each point in x. Shape: (N,).

unite.continuum.functions.bspline_basis(t, knots, degree)[source]

Compute the B-spline basis matrix via iterative Cox-de Boor recursion.

The Python loop over degree is unrolled at JAX trace time because degree is a concrete int, not a traced value.

Return type:

Array

Parameters:
tArrayLike

Evaluation points, shape (N,).

knotsArrayLike

Clamped knot vector, shape (M,).

degreeint

Spline degree (e.g. 3 for cubic).

Returns:
Array

Basis matrix, shape (N, n_basis) where n_basis = M - degree - 1.

Parameters:
unite.continuum.functions.bspline_eval(wavelength, coeffs, knots, degree)[source]

Evaluate a B-spline continuum model.

Return type:

Array

Parameters:
wavelengthArrayLike

Wavelength values, shape (N,).

coeffsArrayLike

B-spline coefficients, shape (n_basis,).

knotsArrayLike

Clamped knot vector.

degreeint

Spline degree (static for JIT).

Returns:
Array

Continuum flux, shape (N,).

Parameters: