Excitation & Leaf Fluorescence
Inelastic chlorophyll fluorescence optics are factored into three composable stages that operate on CPU scalars/arrays and KernelAbstractions GPU backends without embedding photosynthetic physiology:
- Constituent absorption partitioning (
partition_absorption) splits total leaf material absorptance at each excitation wavelength across pigments, water, and dry matter in proportion to their specific optical depths. - Antenna selection & photosystem allocation (
antenna_excitation,photosystem_excitation) converts absorbed spectral photons into photosynthetic antenna absorption (ChlorophyllOnly,CarotenoidAntenna,MultiChlorophyllAntenna) and PSII/PSI excitation rates ready for physiological models such asLeafPhotosynthesis.jl. - Internal photon escape & emission spectra (
diffuse_plate_optics,dorsiventral_plate_optics,leaf_emission_fates,emission_probabilities) propagate internally emitted fluorescence photons through 1-zone (RegularPlateEscape) or 2-zone (DorsiventralPlateEscape) mesophyll stacks with exact photon conservation ($f_{\mathrm{front}} + f_{\mathrm{back}} + f_{\mathrm{reabsorbed}} = 1$ for all $t \in (0, 1]$) and Stokes-valid emission support. A layer-wisePiecewiseUniformBirthProfile, built by the caller frombirth_layer_fractionsand its own layer yields, carries depth-dependent production through the regular plate. - Several sources and band observation (
allocate_excitation,emission_operators,band_signal) allocate excitation jointly to any number of named sinks, build one front/back/reabsorbed operator per source and evaluate linear band observations of hemispheric face totals.
Constituent Absorption Partitioning
CanopyOptics.AbstractAbsorptionPartition — Type
AbstractAbsorptionPartitionPhysical rule for assigning spectral material absorption to constituents.
CanopyOptics.HomogeneousAbsorption — Type
HomogeneousAbsorption()Assign absorption in one wavelength bin in proportion to constituent absorption coefficients. All constituents must have the same proportions along every optical path. This does not describe spatially segregated pigments in layered mesophyll.
CanopyOptics.AbsorptionPartitionResult — Type
AbsorptionPartitionResult(total_absorbed, constituents, fractions, status)Spectral absorbed photons and their named constituent contributions, in the same photon-flux units and area convention as the caller's input. constituents is a concrete NamedTuple, so adding an absorber does not change a fixed field layout. fractions retains unitless probabilities before photon multiplication, so selection does not lose pigment identity when constituent photons underflow. Fractions are undefined (NaN) for absent absorption coefficients; absorbed photons are then zero. Invalid results contain NaN payloads; absorption_valid checks status. This result owns no wavelength grid, device storage or physiological state.
CanopyOptics.AbsorptionPartitionStatus — Type
AbsorptionPartitionStatusStatus code reporting the availability and compatibility of a constituent absorption partition calculation.
CanopyOptics.AbsorptionPartitionValid — Constant
AbsorptionPartitionValidValid constituent absorption partition (including zero illumination of absorbing material).
CanopyOptics.AbsorptionNoMaterial — Constant
AbsorptionNoMaterialZero material absorption coefficient paired with zero total absorbed photons.
CanopyOptics.AbsorptionInvalidInput — Constant
AbsorptionInvalidInputNegative or nonfinite total absorbed photons or constituent absorption coefficients.
CanopyOptics.AbsorptionIncompatibleInput — Constant
AbsorptionIncompatibleInputPositive total absorbed photons supplied with an empty or all-zero constituent set.
CanopyOptics.partition_absorption — Function
partition_absorption(HomogeneousAbsorption(), absorbed_photons, coefficients)Partition the supplied total absorbed photons at one wavelength/bin using named constituent concentration × absorption-coefficient products in a common optical-depth convention. Inputs must share FT. No PROSPECT database or leaf composition is chosen here; their assembly belongs to the host.
For each constituent, Qi = Qabs ki / sum(ki). Scale the nonnegative coefficient products before summing to avoid overflow. This defines constituent probabilities; it never normalizes or alters the supplied optical absorption budget. Obtain Qabs independently from the optical solver (e.g. `prospectbudget`).
Negative/nonfinite inputs return AbsorptionInvalidInput. An empty/all-zero coefficient set with nonzero Qabs returns AbsorptionIncompatibleInput; with Qabs=0 it returns AbsorptionNoMaterial. Zero illumination of absorbing material is instead AbsorptionPartitionValid. All paths are scalar and nonthrowing for same-FT numerical inputs. Mixed-precision tuples have no implicit conversion.
CanopyOptics.absorption_valid — Function
absorption_valid(result::AbsorptionPartitionResult) -> BoolReturn true when result represents a valid absorption partition, including material with zero absorption coefficient (AbsorptionNoMaterial).
Antenna Selection & Photosystem Excitation
CanopyOptics.AbstractAntennaSelection — Type
AbstractAntennaSelectionRule for transferring absorbed constituent photons into an antenna excitation pool.
CanopyOptics.ChlorophyllOnly — Type
ChlorophyllOnly()Transfer only chlorophyll absorption into the antenna pool (requires :chlorophyll).
CanopyOptics.CarotenoidAntenna — Type
CarotenoidAntenna(transfer_fraction)Chlorophyll absorption plus an explicit fraction of carotenoid-absorbed photons enters the antenna pool. Requires :chlorophyll and :carotenoids contributions. The finite fraction in [0,1] is a photon-transfer probability, not an energy efficiency, PSII allocation or physiological nonphotochemical-quenching rate.
CanopyOptics.MultiChlorophyllAntenna — Type
MultiChlorophyllAntenna(; chlb_transfer = 1, carotenoid_transfer = 0)Antenna photon-selection rule for LeafMultiPigmentProperties partitions containing :chlorophyll_a and :chlorophyll_b (and :carotenoids when carotenoid_transfer > 0). Uses complementary_excitation to preserve exact total-selection and zero-pigment limits.
CanopyOptics.antenna_excitation — Function
antenna_excitation(selection, partition)Selected antenna photons in the partition's photon/area units, before photosystem allocation. Invalid partition status, a missing required pigment name or an invalid selection returns a typed NaN. Unselected absorption remains in partition; it is not removed from material energy accounting or assigned to a physiological KN.
Custom AbstractAntennaSelection types implement select_absorbed_photons for a valid partition, returning a scalar of the same FT. Neither a fixed absorber list nor a wavelength database is imposed on custom selections.
CanopyOptics.select_absorbed_photons — Function
select_absorbed_photons(selection, partition)Extension hook for an antenna selection applied to a valid absorption partition. Implementations return selected photons with the input FT, or typed NaN for missing required constituents. Normally call antenna_excitation, which checks status and the returned photon bound. Built-in selections accumulate the smaller selected or unselected probability before multiplying by photons, using the complementary probability identity near total selection. This retains zero-pigment and all-selected limits even if constituent photon amounts have underflowed. This equivalent probability identity improves rounding without clipping, changing constituent diagnostics or repairing an optical flux budget.
CanopyOptics.photosystem_excitation — Function
photosystem_excitation(antenna_photons, allocation_fraction)Allocate antenna photons to one declared photosystem, with an explicit finite fraction in [0,1]. Values refer to the same wavelength bin and photon/area units; the caller chooses and integrates the spectral domain. A PSII allocation is applied once here, not again in a leaf model receiving the resulting PSII excitation. Invalid numerical inputs return typed NaN; no empirical fraction is supplied.
CanopyOptics.allocate_excitation — Function
allocate_excitation(photons, fractions) -> (sinks, unallocated)Allocate photons jointly to any number of named sinks with explicit fractions, returning (sinks = NamedTuple, unallocated = FT). sinks has the keys and order of fractions; each sink receives fraction * photons. Zero, one, two or more sinks are allowed. Values refer to one wavelength bin and photon/area unit.
The function does not know what photons are; the caller's fractions state the convention. Fractions f of antenna excitation apply to antenna_excitation output. Fractions a = h*f of leaf-absorbed photons, with h the antenna share of absorbed photons, apply to total absorption. Applying a after antenna selection counts the transfer loss twice; applying f to total absorption omits it.
photons and every fraction share one floating-point type; mixed precision is a MethodError, as for photosystem_excitation. Valid input has finite photons ≥ 0, finite fractions in [0,1] and a fraction sum at most 1 + N*eps(FT) for N sinks (left-to-right summation of N rounded fractions). Otherwise every sink and unallocated is typed NaN. With no sinks, valid photons are returned unallocated. unallocated = max(1 - Σf, 0) * photons: never negative and never above photons; within the allowance a sum above one leaves zero. A single sink reproduces photosystem_excitation(photons, fraction) exactly. The scalar call is type stable and allocation free for any N; broadcast it over CPU or GPU arrays. No empirical fraction, yield or rate constant is supplied.
Internal Leaf Photon Escape (1-Zone & 2-Zone Plates)
CanopyOptics.AbstractLeafBirthProfile — Type
AbstractLeafBirthProfileNormalized internal photon birth-depth distribution, independent of yield and spectrum.
CanopyOptics.UniformBirthProfile — Type
UniformBirthProfile()Uniform photon production over dimensionless depth 0 ≤ z ≤ 1.
CanopyOptics.ExponentialBirthProfile — Type
ExponentialBirthProfile(excitation_depth, forward_amplitude, backward_amplitude)Conditional birth density proportional to $f\,\exp(-a z) + g\,\exp\bigl(-a(1 - z)\bigr)$, where $a$ is excitation_depth, $(f, g)$ are forward_amplitude and backward_amplitude, and $z = 0$ is the fixed anatomical front face. These amplitudes weight excitation-depth contributions, not emission directions. The host constructor conditions finite nonnegative relative amplitudes on their positive sum, using scaling to avoid overflow and retaining both proportions when representable (extreme amplitude ratios can underflow). Depth must be finite and nonnegative; all three arguments share the same FT.
For a homogeneous, front-illuminated regular plate, the relative amplitudes are $(1,\, r_{\mathrm{exc}}\exp(-a))$. The effective depth follows total material attenuation; depth-independent pigment allocation and physiological yield cancel on conditioning. This effective exponential closure is not an exact angular solution inside a leaf.
CanopyOptics.PiecewiseUniformBirthProfile — Type
PiecewiseUniformBirthProfile(weights)Birth density that is uniform within each of N equal-width layers of normalized depth $0 \le z \le 1$ ($z = x/d$ in a homogeneous plate of thickness $d$, $z = 0$ at the fixed anatomical front face, the coordinate of ExponentialBirthProfile). Layer $k$ spans $[(k-1)/N,\, k/N]$ and receives the fraction $w_k$ of the born photons:
\[p(z) = N\,w_k \quad \text{for } (k-1)/N < z < k/N, \qquad \sum_{k=1}^{N} w_k = 1 .\]
weights is an NTuple{N,FT} or a host AbstractVector{FT} of finite nonnegative relative weights with a positive sum; N ≥ 1. The host constructor stores them normalized (scaled by their maximum, then divided by their compensated sum, so large finite weights do not overflow and the stored fractions sum to one within about two roundings for any N) in the field layer_fractions::NTuple{N,FT}; the object is isbits. Zero weights are allowed and describe dark layers. Invalid input throws ArgumentError; mixed or non-floating-point element types are a MethodError.
This type carries a state-dependent birth profile prepared by the caller, typically excitation fractions from birth_layer_fractions multiplied by the caller's own layer allocation and yield (photons produced per layer). It owns no allocation, yield, rate constant or excitation model. Because the plate is homogeneous, the excitation and emission optical depths to depth $z$ are $a z$ and $b z$ at every wavelength; equal-width layers with uniform production inside each are a discretization of the source, not tissue layers with their own optical properties. The method for RegularPlateEscape is closed form; there is no method for the two-zone DorsiventralPlateEscape.
CanopyOptics.birth_layer_fractions — Function
birth_layer_fractions(birth::ExponentialBirthProfile{FT}, Val(N)) -> NTuple{N,FT}
birth_layer_fractions(birth, Val(N), FT) -> NTuple{N,FT}Fractions of the normalized birth (excitation) density in N equal-width layers of dimensionless depth, the layer coordinate of PiecewiseUniformBirthProfile. For ExponentialBirthProfile with depth $a$ and normalized amplitudes $(f, g)$ the exact layer integrals are
\[P_k = \frac{\operatorname{expm1}(-a/N)}{\operatorname{expm1}(-a)} \Bigl[f\,e^{-a(k-1)/N} + g\,e^{-a(N-k)/N}\Bigr],\]
evaluated as $L(a/N)/(N L(a))$ times the bracket for $a < 1$ so that $a \to 0$ gives $1/N$, and as the ratio of expm1 otherwise so that large finite $a$ neither overflows nor underflows the prefactor. They sum to one to roundoff.
The three-argument form takes the floating-point type explicitly. It is required for UniformBirthProfile, which carries no number and gives N copies of 1/N, and is accepted for an exponential profile of the same FT (another FT is a MethodError), so generic code can always pass it. N ≥ 1 is a compile-time constant; the result is isbits and the evaluation allocation free.
This is the physics-free half of a depth-dependent source: the caller multiplies the fractions by its own antenna excitation, layer allocation to the source and layer yield, sums the products for the source's production and passes the products to PiecewiseUniformBirthProfile. No allocation or yield is supplied here.
CanopyOptics.DorsiventralBirthProfile — Type
DorsiventralBirthProfile(
adaxial_weight, abaxial_weight,
adaxial_excitation_depth, adaxial_forward, adaxial_backward,
abaxial_excitation_depth, abaxial_forward, abaxial_backward,
)
DorsiventralBirthProfile(adaxial_weight, adaxial_profile, abaxial_weight, abaxial_profile)
DorsiventralBirthProfile(adaxial_weight, abaxial_weight)Two-zone normalized internal photon birth-depth distribution for DorsiventralPlateEscape.
Local dimensionless depth $\zeta_i \in [0, 1]$ runs anatomically adaxial $\to$ abaxial in both zones:
- Zone 1 (adaxial / palisade): $\zeta_1 = 0$ at the outer adaxial epidermis and $\zeta_1 = 1$ at the internal palisade–spongy boundary, with conditional density proportional to $f_1 \exp(-a_1 \zeta_1) + g_1 \exp\bigl(-a_1 (1 - \zeta_1)\bigr)$.
- Zone 2 (abaxial / spongy): $\zeta_2 = 0$ at the internal palisade–spongy boundary and $\zeta_2 = 1$ at the outer abaxial epidermis, with conditional density proportional to $f_2 \exp(-a_2 \zeta_2) + g_2 \exp\bigl(-a_2 (1 - \zeta_2)\bigr)$.
Reversing the anatomical leaf orientation (adaxial $\leftrightarrow$ abaxial) therefore maps $(w_1, a_1, f_1, g_1) \leftrightarrow (w_2, a_2, g_2, f_2)$, swapping front and back escape while leaving reabsorbed invariant.
The two-argument DorsiventralBirthProfile(adaxial_weight, abaxial_weight) constructor creates a piecewise-uniform birth profile ($a_1 = a_2 = 0$) with normalized zone weights. Passing UniformBirthProfile directly to leaf_emission_fates on a DorsiventralPlateEscape weights both zones equally ($(1/2, 1/2)$).
CanopyOptics.RegularPlateEscape — Type
RegularPlateEscape(emission_depth, interface_transmission)Symmetric regular plate with finite effective emission optical depth b ≥ 0 and the internal-interface-to-outside photon transmission probability 0 < t ≤ 1. The within-plate traversal survival is exp(-b); it is distinct from t. Both boundaries have reflection 1-t. Emission starts equally toward either face. Reflection paths end at the front face, back face or material reabsorption. Perfectly trapping interfaces (t=0) are excluded from this three-fate contract.
Preparation/validation occurs on the host. The scalar application is allocation free and supports Float32/Float64 CPU/CUDA; no optical database, intrinsic emission spectrum, physiological yield, grid or device is owned by this object.
CanopyOptics.DorsiventralPlateEscape — Type
DorsiventralPlateEscape(adaxial_depth, abaxial_depth, adaxial_transmission, abaxial_transmission[, interface_transmission = 1])Two-zone dorsiventral internal emission escape kernel with finite nonnegative zone emission optical depths adaxial_depth ≥ 0 (palisade / zone 1) and abaxial_depth ≥ 0 (spongy / zone 2), internal-to-outside diffuse exit transmission probabilities 0 < adaxial_transmission ≤ 1 and 0 < abaxial_transmission ≤ 1, and internal palisade–spongy boundary transmission 0 < interface_transmission ≤ 1 (default 1 for an index-matched mesophyll boundary, or < 1 for an intercellular air-space interface).
Within-zone single-pass survival is exp(-b_i) with isotropic half-space initial emission (1/2 toward either boundary of the birth zone). Reabsorption is terminal with no secondary re-emission, wavelength redistribution, physiological yield, or directional radiance assumption. Photon conservation front + back + reabsorbed ≈ 1 holds to floating-point roundoff without clipping or post-hoc rescaling across normal and subnormal interface transmissions.
This isbits scalar object owns five floating-point values, allocates zero memory on evaluation, and runs identically on CPU and CUDA (Float32/Float64).
CanopyOptics.diffuse_plate_optics — Function
diffuse_plate_optics(material_depth, refractive_index)Prepare one regular PROSPECT plate from finite material optical depth k ≥ 0 and refractive index nr > 1, using the same floating-point type. Return traversal_transmission, traversal_absorptance, effective_depth, interface_entry_transmission and interface_exit_transmission.
Traversal transmission is $2 E_3(k)$ and absorption is evaluated directly near zero. The effective exponential depth is its negative logarithm, computed from direct loss near the conservative limit so a rounded unit transmission does not erase weak absorption. This depth is an internal-source approximation, not angle-resolved propagation. Both interfaces use hemispheric ($90^\circ$) Fresnel transmission, with $t_{\mathrm{exit}} = t_{\mathrm{entry}} / n_r^2$. The entry convention differs from default PROSPECT's first-surface 40-degree cone and is not a solar zenith angle.
This is host preparation, tested in Float32/Float64 over the native optical database's refractive-index range. The nearly index-matched limit of the legacy Fresnel expression is unsupported; invalid computed interface probabilities are rejected. There is no CUDA or ForwardDiff contract for this helper. Use its prepared values in RegularPlateEscape and ExponentialBirthProfile for CPU/CUDA application. Zero traversal transmission from underflow is rejected instead of floored; the scalar escape core can accept independently resolved finite effective depths beyond this preparation domain.
No plate count, material composition, wavelength grid, intrinsic spectrum, physiological yield or source normalization is chosen here. In particular, this does not reconstruct a fractional PROSPECT remainder's internal interfaces.
CanopyOptics.dorsiventral_plate_optics — Function
dorsiventral_plate_optics(
k_adaxial, k_abaxial, nr;
surface_adaxial = ConeSurface(40, 1),
surface_abaxial = ConeSurface(40, 1),
n_surface_adaxial = nr,
n_surface_abaxial = nr,
hemispherical = false,
internal_air_gap = false,
)Host preparation helper mapping finite nonnegative palisade (k_adaxial) and spongy (k_abaxial) material optical depths and aqueous mesophyll refractive index $n_r > 1$ into effective exponential emission depths, outer entry/exit transmissions, internal palisade–spongy boundary transmission, and a prepared DorsiventralPlateEscape.
Outer diffuse internal exit transmissions $t_{\mathrm{exit}} = t_{\mathrm{hem,ext}}(n_{\mathrm{eff}}, \sigma) / n_r^2$ obey isothermal detailed-balance étendue conservation ($n_{\mathrm{eff}} = n_{\mathrm{scale}} \, n_{\mathrm{surface}}$), supporting both ConeSurface and RoughDielectricSurface as well as epicuticular wax refractive indices (n_surface_adaxial, n_surface_abaxial). hemispherical selects hemispherical ($90^\circ$) vs $40^\circ$-cone external entry transmission (adaxial_entry_transmission, abaxial_entry_transmission) for excitation transport; diffuse internal exit transmission is always hemispherical.
For the internal boundary between zones:
internal_air_gap = false(default):interface_transmission = 1(unbroken index-matched mesophyll boundary, exact two-sublayer slab limit).internal_air_gap = true: symmetric diffuse mesophyll ($n_r$) $\to$ intercellular air space ($n = 1$) $\to$ mesophyll ($n_r$) transmission $t_{\mathrm{gap}} = t_{90} / \bigl(n_r^2 (2 - t_{90})\bigr)$ where $t_{90} = \operatorname{calctav}(90^\circ, n_r)$, accounting for multiple internal reflections within the air gap.
CanopyOptics.leaf_emission_fates — Function
leaf_emission_fates(escape, birth)Return (front, back, reabsorbed) probabilities per already-produced internal photon. Birth orientation uses fixed anatomical faces. Reabsorption is terminal; no secondary emission, wavelength redistribution, absorptance or yield is applied. Photon conservation holds to floating-point roundoff without clipping or rescaling. Hemispheric face totals do not specify directional canopy radiance.
Built-in methods require the escape and an exponential or piecewise-uniform birth profile to share FT; UniformBirthProfile() has no numeric parameters. Additional escape or birth models can define methods without altering a LeafModel or host grid.
Conditional Fluorescence Emission Spectra
CanopyOptics.TabulatedPhotonSpectrum — Type
TabulatedPhotonSpectrum(wavelength_nm, relative_photon_mass)Host-prepared discrete photon measure on finite, positive, strictly increasing wavelengths in nm. Both vectors must have the same floating-point element type. Masses are finite and nonnegative with at least one positive entry; they need not sum to one. For a tabulated photon density, the caller must first multiply by the corresponding quadrature measures exactly once.
The constructor copies its inputs and retains raw masses so a rare supported tail is not lost by premature normalization. The vectors remain mutable Julia arrays; emission_probabilities revalidates them before preparation. This object contains neither absorptance nor fluorescence yield, and is not a device kernel argument.
CanopyOptics.AbstractEmissionSupport — Type
AbstractEmissionSupportExcitation-dependent emission support rule; extend emission_allowed.
CanopyOptics.StrictStokes — Type
StrictStokes()Permit only emission wavelengths strictly longer than excitation. Equality is excluded. This explicit approximation omits thermal anti-Stokes excitation. Conditioning changes the reference spectral shape while retaining the separately prescribed physiological photon yield; removed weights do not establish additional quenching or heat production.
CanopyOptics.emission_allowed — Function
emission_allowed(support, emission_nm, excitation_nm) -> BoolScalar extension hook for an AbstractEmissionSupport. Host preparation supplies finite positive wavelengths of the same floating-point type. Implementations return a Boolean and can be device compatible without depending on a canopy, physiology model, or spectrum storage layout.
CanopyOptics.emission_probabilities — Function
emission_probabilities(spectrum, support, excitation_nm)Prepare conditional photon probabilities on the spectrum's original grid, with exact zeros outside the explicit support. Excitation must be finite, positive, and have the same floating-point type as the table. Empty retained support is an error, not an inactive physical source; callers skip genuinely inactive sources before requesting a conditional spectrum.
Select raw relative masses before max-scaled normalization, preserving a small retained tail even when excluded weights are vastly larger. The result is a host vector in the table's precision that can be transferred to any backend. No yield, absorptance, energy conversion, or spectral-bin width is applied here. Convert photon outcomes to energy using their emission wavelengths, not excitation.
Emission Operators & Band Observation
CanopyOptics.emission_operators — Function
emission_operators(probabilities, fates) -> (front, back, reabsorbed)Multiply conditional emission probabilities by optical escape fates on one (emission, excitation) grid, giving the operators M_F = p .* F, M_B = p .* B and M_A = p .* A of one source. probabilities[m, e] holds, column by column, the output of emission_probabilities (any spectrum or support rule) or an all-zero dark column. Rows are emission bins and columns excitation bins.
Dark-column contract: a zero (dark) column is permitted only in excitation bins where this source produces no photons. Photons produced in a dark column have no outcome and are silently lost; emission_closure_residual cannot detect this because it does not see production. For an excitation bin with production and empty emission support, expand the emission grid or treat it as an error. Check all(iszero, produced[iszero.(vec(sum(probabilities; dims = 1)))]) before applying the operators.
fates is either a NamedTuple (front = F, back = B, reabsorbed = A) of three matrices (keys in any order), or a matrix of (front, back, reabsorbed) NamedTuples as returned by broadcasting leaf_emission_fates over an emission-escape column and an excitation-birth row. All arrays have the size and floating-point element type of probabilities; mismatches throw on the host. Arrays may live on any backend that supports broadcasting; no clipping, renormalization or yield is applied. Call once per source: sources may differ in probabilities and in fates. Multiplying an operator by already-produced photons per excitation bin gives hemispheric face totals in photons; see emission_closure_residual.
CanopyOptics.emission_closure_residual — Function
emission_closure_residual(operators, probabilities) -> vectorPhoton-closure diagnostic per excitation column: r[e] = Σ_m (M_F + M_B + M_A - p)[m, e] for operators from emission_operators. Differences are formed per element before the emission sum, so r[e] is a roundoff-level residual: the operators of a column sum to the column sum of p (one for a conditional spectrum, zero for a dark column). The caller chooses a tolerance; nothing is clipped or renormalized.
r checks the fates weighted by p, not production: a dark column has r[e] = 0 even if photons are produced there, which would be lost. Dark columns are allowed only where production is zero (see emission_operators).
CanopyOptics.band_signal — Function
band_signal(response, operator, produced_photons) -> FTLinear band observation response' * operator * produced_photons, in photons for photon-basis weights. operator[m, e] is one face operator of one source (from emission_operators); produced_photons[e] holds photons already produced by that source in each excitation bin (absorption, allocation and yield applied once, by the caller). Production must be zero in dark (all-zero) operator columns; photons produced there are lost (see emission_operators).
response[m] are dimensionless photon-basis weights on the emission grid, for example a detector quantum efficiency times a filter transmission. Emission-bin measures are already inside the probabilities and are not applied again. A power responsivity (A/W) is not a photon weight: if the caller folds the photon energy hc/λ_m of the emission wavelength into the weights, the result is in energy units. That conversion is the caller's and always uses emission wavelengths.
This is a linear functional of hemispheric face totals. It knows nothing of instrument geometry or fluorometers and gives no directional radiance. For several sources, call once per source and sum. All three arrays share one floating-point type and a matching grid; mismatches throw. Device arrays are supported by their matrix-vector product and dot.