Covariance
Analytic covariance API.
Exposes the joint one-sided cross-spectral density in closed form for the
scaffold's placeholder statistical model (a frequency-independent
equicorrelation structure). No Newtonian-noise or seismic physics is modelled
here; the physical model is the joint backend in :mod:gwmock_newtonian_noise.joint.
Cross-spectral density convention¶
This is the canonical statement for the whole package; every other module links
here. Every cross-spectral matrix the package returns, for a set of real
channels x_a sampled at fs over N samples, is the one-sided density
C_ab(f) = (2 / (fs N)) E[X_a conj(X_b)], X = numpy.fft.rfft(x),
i.e. Harms' convention <x~(f) y~*(f')> = 1/2 delta(f - f') S_xy(f) (Harms,
Living Rev. Relativ. 22, 6 (2019), eqs. 274-275), also used by gwmock-noise.
Consequences:
Cis Hermitian and positive semidefinite per frequency; a Cholesky/eigen factorLwithL L^H = CsynthesizesX = L wand reproducesC.- A pure delay,
x_b(t) = x_a(t - tau), givesC_ab = C_aa exp(+2 pi i f tau). - Real (isotropic, untimed) matrices are identical in the conjugate convention.
.. warning::
scipy.signal.csd(x_a, x_b) estimates E[conj(X_a) X_b], which in this
convention is C_ba = conj(C_ab). Use scipy.signal.csd(x_b, x_a) to
compare with C_ab. Results of versions before 0.2.0 used the scipy order;
conjugate any stored complex matrix to migrate.
analytic_covariance(channel_order, coupling, sampling_frequency, grid_size=DEFAULT_GRID_SIZE)
¶
Return the exact, closed-form one-sided cross-spectral density.
Every channel is temporally white in this scaffold model, so the returned
matrix is frequency-independent: 2 * Sigma / sampling_frequency at
every frequency, where Sigma is :func:equicorrelation_matrix. This is
an exact analytic value, not a statistical estimate off a realization --
the same convention the public gwmock_noise dummy backend uses, so it
can be tested against a closed-form value rather than a statistical one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_order
|
list[str]
|
Channel names, in the order the returned matrix indexes its last two axes. |
required |
coupling
|
float
|
Equicorrelation coefficient, |
required |
sampling_frequency
|
float
|
Sampling frequency in hertz. |
required |
grid_size
|
int
|
Number of one-sided frequency points to report. |
DEFAULT_GRID_SIZE
|
Returns:
| Type | Description |
|---|---|
JointCovariance
|
The joint one-sided cross-spectral density as a |
JointCovariance
|
class: |
Source code in src/gwmock_newtonian_noise/covariance.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
equicorrelation_matrix(channel_order, coupling)
¶
Return the per-sample covariance matrix for the scaffold's placeholder model.
Every off-diagonal entry is coupling and every diagonal entry is
:data:SAMPLE_VARIANCE; positive definite for any channel count whenever
0.0 <= coupling < 1.0 (eigenvalues are 1 + (n - 1) * coupling with
multiplicity 1 and 1 - coupling with multiplicity n - 1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_order
|
list[str]
|
Channel names; only |
required |
coupling
|
float
|
Equicorrelation coefficient, |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
An |
Source code in src/gwmock_newtonian_noise/covariance.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |