lisa_noise.diagnostics.verify ============================= .. py:module:: lisa_noise.diagnostics.verify Attributes ---------- .. autoapisummary:: lisa_noise.diagnostics.verify.WHITENESS_BAND_EDGES Classes ------- .. autoapisummary:: lisa_noise.diagnostics.verify.SegmentVerification Functions --------- .. autoapisummary:: lisa_noise.diagnostics.verify.whitened_residual lisa_noise.diagnostics.verify.whiteness_summary lisa_noise.diagnostics.verify.verify_segment lisa_noise.diagnostics.verify.plot_verification Module Contents --------------- .. py:data:: WHITENESS_BAND_EDGES :value: (0.0001, 0.001, 0.01, 0.03, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1) .. py:class:: 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)``. .. py:attribute:: segment_idx :type: int .. py:attribute:: science_band :type: tuple[float, float] .. py:attribute:: freq :type: numpy.ndarray .. py:attribute:: periodogram_xyz :type: numpy.ndarray .. py:attribute:: periodogram_aet :type: numpy.ndarray .. py:attribute:: model_xyz :type: numpy.ndarray .. py:attribute:: model_aet :type: numpy.ndarray .. py:attribute:: l1_xyz :type: numpy.ndarray .. py:attribute:: l1_aet :type: numpy.ndarray .. py:attribute:: band_xyz :type: numpy.ndarray | None :value: None .. py:attribute:: band_aet :type: numpy.ndarray | None :value: None .. py:attribute:: credible_level :type: float | None :value: None .. py:attribute:: model_windowed_xyz :type: numpy.ndarray | None :value: None .. py:attribute:: model_windowed_aet :type: numpy.ndarray | None :value: None .. py:attribute:: whitened :type: numpy.ndarray | None :value: None .. py:attribute:: whiteness :type: dict | None :value: None .. py:function:: 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). .. py:function:: 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. .. py:function:: 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. :param result_file: A single-segment pipeline output HDF5 (see :func:`lisa_noise.io.write.write_inference_result`). :param data_file: The processed segment data HDF5 (MojitoProcessor output) the result was fit to. :param credible_level: Posterior mass enclosed by the credible band when the result carries samples (default ``0.95``). Ignored for point-estimate results. :param max_band_samples: Cap on the number of posterior draws evaluated for the band; the chain is thinned uniformly above this to bound runtime. .. py:function:: 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.