pttools.ssmtools.spectrum

Functions for computing GW power spectra

Classes

class pttools.ssmtools.spectrum.NucType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Nucleation type

EXPONENTIAL = 'exponential'
SIMULTANEOUS = 'simultaneous'
class pttools.ssmtools.spectrum.SSMSpectrum(bubble, y=None, z_st_thresh=const.Z_ST_THRESH, nuc_type=DEFAULT_NUC_TYPE, nt=const.NTDEFAULT, n_z_lookup=const.N_Z_LOOKUP_DEFAULT, r_star=None, lifetime_multiplier=1, compute=True, label_latex=None, label_unicode=None)

Bases: object

Gravitational wave simulation object

Parameters:
  • bubble (Bubble)

  • y (ndarray)

  • z_st_thresh (float)

  • nuc_type (NucType)

  • nt (int)

  • n_z_lookup (int)

  • r_star (float)

  • lifetime_multiplier (float)

  • compute (bool)

  • label_latex (str)

  • label_unicode (str)

compute()
cs: float | None

\(c_s({T}_\text{gw})\)

label_latex()
Return type:

str

label_unicode()
Return type:

str

plot(fig=None, ax=None, path=None, **kwargs)
Parameters:
Return type:

FigAndAxes

plot_multi(fig=None, path=None, **kwargs)
Parameters:
Return type:

Figure

plot_spec_den_gw(fig=None, ax=None, path=None, **kwargs)
Parameters:
Return type:

FigAndAxes

plot_spec_den_v(fig=None, ax=None, path=None, **kwargs)
Parameters:
Return type:

FigAndAxes

plot_v(fig=None, ax=None, path=None, **kwargs)
Parameters:
Return type:

FigAndAxes

pow_gw: ndarray | None

\(\mathcal{P}_{\text{gw}}(k)\)

pow_v: ndarray | None

\(\mathcal{P}_{\tilde{v}}(q)\)

property source_lifetime_factor: float

Source lifetime correction factor

\[\frac{1}{1 + 2\nu} \left(1 - \left(1 + \frac{\Delta \eta}{\eta_*} \right) \right)^{-1-2\nu}\]
where
\[\frac{\Delta \eta}{\eta_*} = \lambda \frac{2 r_*}{\sqrt{K}}\]
Giombi et al., 2024, eq. 3.13

spec_den_gw: ndarray | None

???

spec_den_v: ndarray | None

\(P_v(q)\)

Functions

pttools.ssmtools.spectrum.convert_params(params)

Convert the physical parameters from a list to a tuple if necessary.

Parameters:

params (Tuple[float, float] | Tuple[float, float, str, Tuple[float, ...]])

Return type:

Tuple[float, float] | Tuple[float, float, str, Tuple[float, …]]

pttools.ssmtools.spectrum.gen_lookup(y, cs, n_z_lookup=const.N_Z_LOOKUP_DEFAULT, eps=0.)
Parameters:
  • y (ndarray) – Input array

  • cs (float) – Speed of sound \(c_s\)

  • n_z_lookup (int) – Number of points for the generated lookup table

  • eps (float) – Seems to be needed for max(z) <= 100. E.g. 1e-8. Why?

Returns:

Generated lookup array for z

Return type:

ndarray

pttools.ssmtools.spectrum.lookup_limits(y, cs, eps=0.)

Defined on p. 12 between eq. 3.44 and 3.45

Parameters:
  • y (ndarray)

  • cs (float)

  • eps (float)

Return type:

Tuple[float, float]

pttools.ssmtools.spectrum.nu(T, nuc_type=NucType.SIMULTANEOUS, a=1.)

Bubble lifetime distribution function

Hindmarsh et al., 2019 eq. 4.27 & 4.32

Parameters:
  • T (float | float64 | ndarray) – dimensionless time

  • nuc_type (NucType) – nucleation type, simultaneous or exponential

  • a (float)

Returns:

bubble lifetime distribution \(\nu\)

Return type:

float | float64 | ndarray

pttools.ssmtools.spectrum.parse_params(params)

Parse physical parameters from the tuple.

Parameters:

params (Tuple[float, float] | Tuple[float, float, str, Tuple[float, ...]]) – tuple of physical parameters

Returns:

\(v_\text{wall}, \alpha\), nucleation type, nucleation arguments

Return type:

Tuple[float, float, NucType, Tuple[float, …]]

pttools.ssmtools.spectrum.pow_spec(z, spec_den)

Power spectrum from spectral density at dimensionless wavenumber z.

Hindmarsh et al., 2019 eq. 4.18, but without the factor of 2.

Parameters:
  • z (float | float64 | ndarray) – dimensionless wavenumber \(z\)

  • spec_den (float | float64 | ndarray) – spectral density

Returns:

power spectrum

Return type:

float | float64 | ndarray

pttools.ssmtools.spectrum.power_gw_scaled_bag(z, params, npt=const.NPTDEFAULT, filename=None, skip=1, method=ssm.Method.E_CONSERVING, de_method=ssm.DE_Method.STANDARD, z_st_thresh=const.Z_ST_THRESH)

Scaled GW power spectrum at array of z = kR* values, where R* is mean bubble centre separation and k is comoving wavenumber. To convert to predicted spectrum, multiply by \((H_n R_*)(H_n au_v)\), where \(H_n\) is the Hubble rate at the nucleation time, and $ au_v$ is the lifetime of the shear stress source.

Physical parameters

  • vw = params[0] scalar (required) [0 < vw < 1]

  • alpha = params[1] scalar (required) [0 < alpha_n < alpha_n_max(v_w)]

  • nuc_type = params[2] string (optional) [exponential* | simultaneous]

  • nuc_args = params[3] tuple (optional) default (1,)

Steps:

  1. Getting velocity field spectral density

  2. Geeting gw spectral density

  3. turning SD into power

Parameters:
  • z (ndarray) – array \(z = qR_*\)

  • params (Tuple[float, float] | Tuple[float, float, str, Tuple[float, ...]]) – physical parameters, see the description above

  • npt (ndarray | Tuple[int, int, int]) – number of points

  • filename (str) – path to load A2 values from

  • skip (int)

  • method (Method)

  • de_method (DE_Method)

  • z_st_thresh (float)

Returns:

scaled GW power spectrum

Return type:

ndarray

pttools.ssmtools.spectrum.power_v_bag(z, params, npt=const.NPTDEFAULT, filename=None, skip=1, method=ssm.Method.E_CONSERVING, de_method=ssm.DE_Method.STANDARD, z_st_thresh=const.Z_ST_THRESH)

Power spectrum of the velocity field in the Sound Shell Model.

  • vw = params[0] scalar

  • alpha = params[1] scalar

  • nuc_type = params[2] string [exponential* | simultaneous]

  • nuc_args = params[3] tuple default (1,)

Parameters:
  • z (ndarray) – array \(z = qR_*\)

  • params (Tuple[float, float] | Tuple[float, float, str, Tuple[float, ...]]) – physical parameters, see the description above

  • npt (ndarray | Tuple[int, int, int]) – number of points

  • filename (str) – path to load A2 values from

  • z_st_thresh (float) – not used

  • skip (int)

  • method (Method)

  • de_method (DE_Method)

Returns:

power spectrum of the velocity field

Return type:

ndarray

pttools.ssmtools.spectrum.spec_den_gw_scaled(z_lookup, P_v_lookup, y=None, cs=const.CS0, Gamma=const.GAMMA, source_lifetime_factor=1., nz_int=None)

Spectral density of scaled gravitational wave power

Parameters:
  • z_lookup (ndarray) – Lookup table for the \(z = qL_f\) values corresponding to P_v_lookup

  • P_v_lookup (ndarray) – \(\bar{U}_f^2 \tilde{P}_v (z)\), a lookup table for the spectral density of the Fourier transform of the velocity field, not the spectral density of plane wave coefficients, which is lower by a factor of 2.

  • y (ndarray) – \(y = kL_f = kR*\) corresponding to z_lookup. If not given, will be created from z_lookup.

  • cs (float) – Speed of sound (in the broken phase after the phase transition)

  • Gamma (float) – Mean adiabatic index \(\Gamma = \frac{\bar{w}}{\bar{e}}\)

  • source_lifetime_factor (float)

  • nz_int (int)

Returns:

\(\hat{\mathcal{P}}\) Eq. 3.33 of Chloe’s thesis, which should be (\(3\Gamma \bar{U}_f\)) Eq. 3.47 Eq. 3.46 converted to the spectral density and divided by (H L_f)

Return type:

Tuple[ndarray, ndarray] | callable | CPUDispatcher

The factor of 3 comes from the Friedmann equation 3H^2/(8pi G)

pttools.ssmtools.spectrum.spec_den_v(bub, z, a, nuc_type, nt=const.NPTDEFAULT[1], z_st_thresh=const.Z_ST_THRESH, cs=None, return_a2=False)

The full spectral density of the velocity field

This is twice the spectral density of the plane wave components of the velocity field

Returns:

\(P_{\tilde{v}} = 2 * P_v(q)\) of Hindmarsh et al., 2019 eq. 4.17

Parameters:
  • bub (Bubble)

  • z (ndarray)

  • a (float)

  • nuc_type (NucType)

  • nt (int)

  • z_st_thresh (float)

  • cs (float)

  • return_a2 (bool)

pttools.ssmtools.spectrum.spec_den_v_bag(z, params, npt=const.NPTDEFAULT, filename=None, skip=1, method=ssm.Method.E_CONSERVING, de_method=ssm.DE_Method.STANDARD, z_st_thresh=const.Z_ST_THRESH)

Get dimensionless velocity spectral density \(\bar{P}_v\).

Gets fluid velocity profile from bubble toolbox or from file if specified. Convolves 1-bubble Fourier transform \(|A(q T)|^2\) with bubble wall lifetime distribution \(\nu(T \beta)\) specified by “nuc_type” and “nuc_args”.

Parameters:
  • z (ndarray) – array \(z = qR_*\)

  • params (Tuple[float, float] | Tuple[float, float, str, Tuple[float, ...]]) – tuple of vw (scalar), alpha (scalar), nuc_type (string [exponential* | simultaneous]), nuc_args (tuple, default (1,))

  • npt (ndarray | Tuple[int, int, int]) – number of points

  • filename (str)

  • skip (int)

  • method (Method)

  • de_method (DE_Method)

Returns:

dimensionless velocity spectral density \(\bar{P}_v\)

Attributes

pttools.ssmtools.spectrum.DEFAULT_NUC_TYPE = NucType.EXPONENTIAL

Default nucleation type