lisa_noise.modelled.window ========================== .. py:module:: lisa_noise.modelled.window .. autoapi-nested-parse:: Taper-convolved ("windowed") covariance. The data are tapered before the FFT, ``d = rfft(w · x)``, so the covariance of frequency bin ``i`` is the model covariance convolved with the squared spectral window (Burke et al., "Zurückbleiben bitte", Eq. 91):: C_w[i] = Σ_m k[m] · C[i − m], k[m] = |fft(w)[m]|² / N² with ``C(−f) = conj C(f)``. Where ``C`` is smooth over the width of ``k`` this is just ``mean(w²) · C``. It differs at the TDI nulls and at the steep low-frequency end, so :class:`WindowedModel` scales every bin and convolves only the patches of bins where the two differ. Attributes ---------- .. autoapisummary:: lisa_noise.modelled.window.WINDOW_METHODS lisa_noise.modelled.window.MAX_PATCH lisa_noise.modelled.window.U_AET Classes ------- .. autoapisummary:: lisa_noise.modelled.window.WindowedModel Functions --------- .. autoapisummary:: lisa_noise.modelled.window.build_window lisa_noise.modelled.window.spectral_kernel lisa_noise.modelled.window.kernel_half_width lisa_noise.modelled.window.relative_deviation lisa_noise.modelled.window.bins_to_convolve lisa_noise.modelled.window.mask_to_patches Module Contents --------------- .. py:data:: WINDOW_METHODS :value: ('patches', 'exact') .. py:data:: MAX_PATCH :value: 3 .. py:data:: U_AET .. py:function:: build_window(name: str, n_samples: int, alpha: float | None = None) -> numpy.ndarray The time-domain taper ``MojitoProcessor`` applied, from its recorded kwargs. .. py:function:: spectral_kernel(window: numpy.ndarray) -> numpy.ndarray ``k[m] = |fft(w)[m]|² / N²`` at lags ``0 .. N//2`` (``k`` is even). .. py:function:: kernel_half_width(kernel: numpy.ndarray, tol: float = 1e-10) -> int Smallest lag that leaves a fraction ``tol`` of the kernel sum outside. .. py:function:: relative_deviation(a: numpy.ndarray, b: numpy.ndarray, local_max_bins: int = 0) Per-bin largest ``|a − b|`` over the 3×3 entries, relative to the PSDs of ``b``. With ``local_max_bins`` the PSDs are replaced by their running maximum over ``±local_max_bins``, which measures a null against its surroundings. .. py:function:: bins_to_convolve(deviation: numpy.ndarray, tol: float, half_width: int, i_lo: int) Mask of the bins where ``deviation > tol``, widened by half the kernel width. The low-frequency end grows with the fitted slope, so it is doubled in frequency. .. py:function:: mask_to_patches(mask: numpy.ndarray, max_len: int) -> list[tuple[int, int]] ``(start, stop)`` of every run of True, cut into equal parts of at most ``max_len`` bins (short transforms keep the FFT round-off small). .. py:class:: WindowedModel(make_model: Any, freq: numpy.ndarray, window: numpy.ndarray, delta_t: float, seeds: Any, xp: Any = np, method: str = 'patches', patch_tol: float = 1e-05, kernel_tol: float = 1e-10) Taper-convolved covariance ``k ⊛ C`` of any covariance model. :param make_model: ``make_model(freq)`` returns a ``model(freq, params) -> (Nf, 3, 3)`` bound to ``freq`` (which may include DC; that row must be zero). :type make_model: callable :param freq: Science grid: a contiguous slice of ``np.fft.rfftfreq(N, delta_t)``. :type freq: (Nf,) array :param window: Time-domain taper applied to the data. :type window: (N,) array :param delta_t: Sample interval in seconds. :type delta_t: float :param seeds: Parameter vectors at which the bins to convolve are located. The first is also used for the self-check. :type seeds: sequence of arrays :param xp: ``numpy`` or ``jax.numpy``. :type xp: module, optional :param method: ``"exact"`` convolves every bin. :type method: {"patches", "exact"}, optional :param patch_tol: Relative deviation from ``mean(w²) C`` above which a bin is convolved. :type patch_tol: float, optional :param kernel_tol: Fraction of the kernel sum neglected beyond the guard band. :type kernel_tol: float, optional .. py:attribute:: name :value: 'window' .. py:attribute:: inner .. py:attribute:: info .. py:method:: describe() -> str One-line summary for the log.