lisa_noise.diagnostics.verify

Attributes

Classes

SegmentVerification

Diagonal comparison curves for one segment, in the XYZ and AET bases.

Functions

whitened_residual(data, cov, n_samples, delta_t) → numpy.ndarray

q_j = (2 dt / N) d_j† C_j⁻¹ d_j for data (Nf, 3) and cov (Nf, 3, 3).

whiteness_summary(freq, q[, band_edges]) → dict

Test q against the Gamma(3, 1) law it follows under a correct covariance.

verify_segment(result_file, data_file[, ...]) → SegmentVerification

Build the comparison curves for one segment.

plot_verification(v)

Render the comparison figure and return the Figure.

Module Contents

lisa_noise.diagnostics.verify.WHITENESS_BAND_EDGES = (0.0001, 0.001, 0.01, 0.03, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1)
class lisa_noise.diagnostics.verify.SegmentVerification

Diagonal comparison curves for one segment, in the XYZ and AET bases.

Every array is indexed by science-band frequency bin. The *_xyz / *_aet pairs each give the three diagonal channels (X,Y,Z or A,E,T) of the periodogram, the best-fit (MAP) model PSD, and the L1 noise estimate.

When the result carries posterior samples (sampler runs), band_xyz / band_aet hold the lower and upper credible bounds of the model PSD, shape (Nf, 3, 2) with [..., 0] the lower and [..., 1] the upper edge; both are None for point-estimate (MLE) results. credible_level records the enclosed posterior mass (e.g. 0.95).

When the fit used the windowed (taper-convolved) covariance, model_windowed_xyz / model_windowed_aet hold that model — the expectation of the periodogram of the tapered data — while model_* remain the untapered instrument PSD. The credible band then refers to the windowed model.

whitened is the whitened residual q_j = (2 dt / N) d_j† C_j⁻¹ d_j of every science-band bin, with C the covariance the data were fit with (the windowed one for a windowed fit). Under a correct covariance the three whitened channels are independent unit complex Gaussians, so q_j follows a Gamma(3, 1) law: mean 3, variance 3, P(q > 10) = 0.28 %. whiteness summarises the test: the whole-band mean and variance, the Kolmogorov–Smirnov statistic and p-value against Gamma(3, 1), the fraction of bins above 10, the lag-1 autocorrelation of q_j across bins, and one row per band with its mean and standard error sqrt(3 / n).

segment_idx: int
science_band: tuple[float, float]
freq: numpy.ndarray
periodogram_xyz: numpy.ndarray
periodogram_aet: numpy.ndarray
model_xyz: numpy.ndarray
model_aet: numpy.ndarray
l1_xyz: numpy.ndarray
l1_aet: numpy.ndarray
band_xyz: numpy.ndarray | None = None
band_aet: numpy.ndarray | None = None
credible_level: float | None = None
model_windowed_xyz: numpy.ndarray | None = None
model_windowed_aet: numpy.ndarray | None = None
whitened: numpy.ndarray | None = None
whiteness: dict | None = None
lisa_noise.diagnostics.verify.whitened_residual(data: numpy.ndarray, cov: numpy.ndarray, n_samples: int, delta_t: float) → numpy.ndarray

q_j = (2 dt / N) d_j† C_j⁻¹ d_j for data (Nf, 3) and cov (Nf, 3, 3).

lisa_noise.diagnostics.verify.whiteness_summary(freq: numpy.ndarray, q: numpy.ndarray, band_edges=WHITENESS_BAND_EDGES) → dict

Test q against the Gamma(3, 1) law it follows under a correct covariance.

lisa_noise.diagnostics.verify.verify_segment(result_file: str, data_file: str, credible_level: float = 0.95, max_band_samples: int = 400) → SegmentVerification

Build the comparison curves for one segment.

Parameters:
  • result_file – A single-segment pipeline output HDF5 (see lisa_noise.io.write.write_inference_result()).

  • data_file – The processed segment data HDF5 (MojitoProcessor output) the result was fit to.

  • credible_level – Posterior mass enclosed by the credible band when the result carries samples (default 0.95). Ignored for point-estimate results.

  • max_band_samples – Cap on the number of posterior draws evaluated for the band; the chain is thinned uniformly above this to bound runtime.

lisa_noise.diagnostics.verify.plot_verification(v: SegmentVerification)

Render the comparison figure and return the Figure.

Three rows of spectra (XYZ | AET) and, when the verification carries the whitened residual, a fourth row with the whiteness test: the distribution of q_j against the Gamma(3, 1) law on the left, its band means with their standard errors against the expectation of 3 on the right.