sigway.spectrum¶
OmegaGW ties a perturbations object, a kernel and an
integrator into one callable that returns the induced GW spectrum
\(\Omega_{\mathrm{GW}}(f)\).
sigway.spectrum.OmegaGW ¶
Scalar-induced gravitational-wave energy-density spectrum \(\Omega_{\mathrm{GW}}(f)\).
Combines a primordial scalar power spectrum \(\mathcal{P}_\zeta(k)\), a transfer kernel and a numerical integrator. The induced tensor power spectrum is the double integral over the rescaled internal momenta \(s\in[0,1]\) and \(t\in[0,\infty)\),
with \(u=(t+s+1)/2\), \(v=(t-s+1)/2\), the geometric factor \(\mathcal{N}(t,s)\)
(polynomial) and the kernel \(\overline{I^2}\).
OmegaGW applies the kernel normalisation and converts this to the
energy-density spectrum \(\Omega_{\mathrm{GW}}(f)\) at \(f = k/2\pi\). See
Theory: the master formula and the
\((s,t)\) reparameterisation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
perturbations
|
ScalarPerturbations
|
The primordial curvature power spectrum \(\mathcal{P}_\zeta(k)\) together with its free parameters (e.g. amplitude, peak scale). See AnalyticPerturbations. |
required |
kernel
|
Kernel
|
The transfer kernel \(\overline{I^2(u,v,k\eta)}\) that encodes the cosmological background during GW production (radiation domination, early matter domination, …) and carries the overall normalisation. See RadiationKernel and Theory: the kernel. |
required |
integrator
|
Integrator
|
Numerical integration strategy over \((s, t)\). When omitted, a
SimpsonIntegrator is built
automatically from the |
None
|
s
|
array - like or callable
|
Grid of \(s\) values passed to
SimpsonIntegrator when
|
None
|
t
|
array - like or callable
|
Grid of \(t\) values passed to
SimpsonIntegrator when
|
None
|
f
|
array - like
|
A fixed internal frequency grid (Hz) used when |
None
|
upsample
|
bool
|
If |
False
|
Attributes:
| Name | Type | Description |
|---|---|---|
perturbations |
ScalarPerturbations
|
The primordial power spectrum object. |
kernel |
Kernel
|
The transfer kernel object. |
integrator |
Integrator
|
The numerical integrator (built from |
f |
Array or None
|
Internal frequency grid for upsampling, or |
upsample |
bool
|
Whether frequency-grid upsampling is active. |
parameter_names |
tuple of str
|
All free parameters of the model in evaluation order: perturbation
parameters first, then kernel parameters. Parameters must have
unique names; a |
Examples:
Compute \(\Omega_{\mathrm{GW}}(f)\) for a log-normal peak in \(\mathcal{P}_\zeta\) centred near \(k_* = 10^{-2}\,\mathrm{s}^{-1}\):
>>> import jax.numpy as jnp
>>> from sigway.spectrum import OmegaGW
>>> from sigway.kernels import RadiationKernel
>>> from sigway.perturbations import AnalyticPerturbations
>>> def pz(k, logAs, logks):
... return 10.0**logAs * jnp.exp(-0.5*(jnp.log(k/10**logks)/0.3)**2)
>>> model = OmegaGW(AnalyticPerturbations(pz, ("logAs", "logks")),
... RadiationKernel(),
... s=jnp.linspace(0, 1, 10),
... t=jnp.geomspace(1e-4, 1e3, 800))
>>> omega = model(jnp.geomspace(1e-5, 1e-1, 200), -2.0, -2.0)
__call__ ¶
Return \(\Omega_{\mathrm{GW}}(f)\) at the requested frequencies.
Each parameter value is forwarded automatically to the perturbation
spectrum or the kernel, according to the order in parameter_names.
The kernel's normalisation prefactor is applied before returning.
The first call compiles the integration loop; subsequent calls with the same array shapes run at full speed without recompilation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
array - like
|
Frequencies \(f\) in Hz at which to evaluate \(\Omega_{\mathrm{GW}}\). |
required |
*theta
|
float
|
Model parameters in the order given by |
()
|
**kw
|
float
|
Alternative to positional |
{}
|
Returns:
| Type | Description |
|---|---|
Array
|
\(\Omega_{\mathrm{GW}}\) evaluated at each frequency in |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both positional and keyword parameters are supplied, or if the
keyword arguments do not match |
jacobian ¶
Compute the parameter derivatives \(\partial\Omega_{\mathrm{GW}}(f_i)/\partial\theta_j\).
Returns the Jacobian matrix needed to build a Fisher information matrix for forecasting parameter constraints. For a detector with noise power spectral density \(S_n(f)\), the Fisher matrix element is
Derivatives with respect to smooth parameters are computed by
automatic differentiation. Parameters that appear inside a step
function or as an integration boundary (e.g. a sharp cutoff scale
\(k_{\max}\) in an early-matter-domination scenario) are not smooth and
would give wrong derivatives from automatic differentiation; their
columns are replaced by a central finite-difference estimate instead.
The set of such non-smooth parameters is read automatically from
perturbations.nonsmooth_params and kernel.nonsmooth_params;
use fd_params to override.
Not available when the perturbation spectrum requires a full numerical mode-function integration (e.g. SingleFieldPerturbations).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
array - like
|
Frequencies \(f\) in Hz, shape |
required |
theta
|
array - like
|
Parameter vector \(\theta\) in the order given by
|
required |
fd_params
|
sequence of str
|
Names of parameters whose derivative column should be computed by
central finite differences rather than automatic differentiation.
Defaults to the union of |
None
|
Returns:
| Type | Description |
|---|---|
Array
|
Jacobian matrix of shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the perturbation object does not support automatic differentiation (e.g. SingleFieldPerturbations). |