Skip to content

Pft Method Audit

Module: spectralbridge.pft_method_audit.

Additive, design-conditional audit of PFT whole-curve inference.

Established scaled-MAD envelopes and synchronized nonparametric combination; explicit blocked energy/FPCA adaptations. Does not claim species-independent effects.

API glossary ยท Workflow / scientific context

Signatures and documentation below are collected from the current source. Advanced objects are not newly declared stable by inclusion here.

Audience: advanced.

AuditConfig dataclass

AuditConfig(permutations: int = 9999, seed: int = 20261014, pc_variance: float = 0.95, pc_cap: int = 10, max_gap_nm: float = 8)

Configure the historical whole-spectrum PFT method audit and its explicit resampling budgets.

validate

validate()

Audience: advanced.

wavelength_weights

wavelength_weights(w, max_gap=8)

Trapezoidal weights on disconnected supported segments, never across gaps.

Audience: advanced.

upper_p

upper_p(values)

Exchangeable ensemble upper-tail ranks, inclusive of identity and ties.

Audience: advanced.

npc_probability

npc_probability(statistics)

Synchronized Tippett combination; calibrate min partial p on same ensemble.

Audience: advanced.

envelope_critical

envelope_critical(maxima, alpha)

Conservative Monte Carlo MAD multiplier with strict excursion/tie rule.

Audience: advanced.

method_statistics

method_statistics(values, labels, blocks, wavelengths, *, config=None, seed=None, integration_weights=None) -> dict

Evaluate synchronized conditional whole-spectrum permutation statistics.

Parameters:

Name Type Description Default
values array - like

Stored reflectance matrix (N polygon/year curves, B wavelengths). Units remain unchanged; finite common variable columns within eligible mixed blocks are used, without imputation.

required
labels array - like

Binary 0/1 group labels, shape (N,).

required
blocks array - like

Nonmissing exact-history block labels, shape (N,).

required
wavelengths array - like

Increasing coordinates in nm, shape (B,).

required
config AuditConfig

Permutations, rank and gap settings.

None
seed int

Overrides the config seed.

None
integration_weights array - like

Nonnegative weights (B,). Default is disconnected wavelength quadrature; use explicit discrete sensor weights for widely spaced channels.

None

Returns:

Name Type Description
dict dict

Observed/permuted curves and four statistics, component/NPC p-values, rows/columns retained, scale, SE, normalized weights and FPCA diagnostics.

Raises:

Type Description
ValueError

Invalid dimensions/labels/blocks/weights or insufficient complete variable support / exchangeable mixed blocks.

Labels move as whole curves within blocks. Conditional exchangeability is an assumption; results do not establish causal PFT mechanisms. NPC calibrates a joint probability combination, not an uncorrected minimum p. Multiplicity adjustment and family envelopes belong to the calling analysis.

Audience: advanced.

run_method_audit

run_method_audit(comparisons, legacy, output, *, config=None)

Audit historical PFT comparisons against checksum-verified prior results with restart checkpoints.