primpy package

Calculations for the primordial Universe.

primpy subpackages

primpy.bigbang module

General setup for equations for standard Big Bang cosmology.

primpy.bigbang.get_H0(h, units='planck')[source]

Get present-day Hubble parameter from little Hubble h.

primpy.bigbang.get_a0(h, Omega_K0, units='planck')[source]

Get present-day scale factor from curvature density parameter.

primpy.bigbang.get_N_BBN(h, Omega_K0)[source]

Get the epoch of Big Bang nucleosynthesis in terms of e-folds (in Planck units).

primpy.bigbang.get_w_delta_reh(N_end, N_reh, log_cHH_end, log_cHH_reh)[source]

Get the e.o.s. parameter for reheating w_reh from e-folds and comoving Hubble horizon.

primpy.bigbang.get_rho_crit_kg_im3(h)[source]

Get present-day critical density from little Hubble h.

primpy.bigbang.get_Omega_r0(h)[source]

Get present-day radiation density parameter from little Hubble h.

primpy.bigbang.Hubble_parameter(N, Omega_m0, Omega_K0, h, units='planck')[source]

Hubble parameter (in reduced Planck units) at N=ln(a) during standard Big Bang.

Parameters:
Nfloat, np.ndarray

e-folds of the scale factor N=ln(a) during standard Big Bang evolution, where the scale factor would be given in reduced Planck units (same as output from primpy).

Omega_m0float

matter density parameter today

Omega_K0float

curvature density parameter today

hfloat

dimensionless Hubble parameter today, “little h”

unitsstr

Output units, can be any of {‘planck’, ‘H0’, ‘SI’} returning units of 1/tp, km/s/Mpc or 1/s respectively.

Returns:
Hfloat

Hubble parameter during standard Big Bang evolution of the Universe. In reduced Planck units [tp^-1].

Notes

Omega_r0 is derived from the Hubble parameter using Planck’s law. Omega_L0 is derived from the other density parameters to sum to one.

primpy.bigbang.no_Big_Bang_line(Omega_m0)[source]

Return Omega_L0 for dividing line between universes with/without Big Bang.

Parameters:
Omega_m0float

matter density parameter today

Returns:
Omega_L0float

Density parameter of cosmological constant Lambda along the dividing line between a Big Bang evolution (for smaller Omega_L0) and universes without a Big Bang (for larger Omega_L0).

primpy.bigbang.expand_recollapse_line(Omega_m0)[source]

Return Omega_L0 for dividing line between expanding/recollapsing universes.

Parameters:
Omega_m0float

matter density parameter today

Returns:
Omega_L0float

Density parameter of cosmological constant Lambda along the dividing line between expanding (for larger Omega_L0) and recollapsing (for smaller Omega_L0) universes.

primpy.bigbang.comoving_Hubble_horizon(N, Omega_m0, Omega_K0, h, units='planck')[source]

Comoving Hubble horizon at N=ln(a) during standard Big Bang.

Parameters:
Nfloat, np.ndarray

e-folds of the scale factor N=ln(a) during standard Big Bang evolution, where the scale factor would be given in reduced Planck units (same as output from primpy).

Omega_m0float

matter density parameter today

Omega_K0float

curvature density parameter today

hfloat

dimensionless Hubble parameter today, “little h”

unitsstr

Output units, can be any of {‘planck’, ‘Mpc’, ‘SI’} returning units of lp, Mpc, or m respectively.

Returns:
cHHfloat

Comoving Hubble horizon during standard Big Bang evolution of the Universe.

Notes

Omega_r0 is derived from the Hubble parameter using Planck’s law. Omega_L0 is derived from the other density parameters to sum to one.

primpy.bigbang.conformal_time(N_start, N, Omega_m0, Omega_K0, h)[source]

Conformal time during standard Big Bang evolution from N_start to N.

Parameters:
N_startfloat

e-folds of the scale factor N=ln(a) during standard Big Bang evolution at lower integration limit (e.g. at end of inflation), where the scale factor would be given in reduced Planck units (same as output from primpy).

Nfloat, np.ndarray

e-folds of the scale factor N=ln(a) during standard Big Bang evolution at upper integration limit (e.g. at end of inflation), where the scale factor would be given in reduced Planck units (same as output from primpy).

Omega_m0float

matter density parameter today

Omega_K0float

curvature density parameter today

hfloat

dimensionless Hubble parameter today, “little h”

Returns:
etafloat, np.ndarray

conformal time passing between a_start and a during standard Big Bang evolution of the Universe. Same shape as N.

Notes

Omega_r0 is derived from the Hubble parameter using Planck’s law. Omega_L0 is derived from the other density parameters to sum to one.

primpy.bigbang.conformal_time_ratio(Omega_m0, Omega_K0, h, b_forward, b_backward=None)[source]

Conformal time ratio before to after the end of inflation (until today).

Parameters:
Omega_m0float

matter density parameter today

Omega_K0float

curvature density parameter today

hfloat

dimensionless Hubble parameter today, “little h”

b_forwardBunch object same as returned by scipy.integrate.solve_ivp()

Solution returned by primpy.solver.solve(). Needs to have been run with track_eta=True.

b_backwardBunch object same as returned by scipy.integrate.solve_ivp(), default: None

Additional solution returned by primpy.solver.solve(). This second solution is assumed to be an integration from inflation start backwards in time.

Returns:
ratiofloat

Ratio of conformal time before (during and before inflation) to after (from the end of inflation until today). Needs to be >1 in order to solve the horizon problem.

primpy.equations module

General setup for ODEs.

class primpy.equations.Equations[source]

Bases: ABC

Base class for equations.

Allows one to compute derivatives and derived variables. Most of the other classes take ‘equations’ as an object.

Attributes:
idxdict

dictionary mapping variable names to indices in the solution vector y

independent_variablestring

name of independent variable

Methods

__call__(x, y)

Vector of derivatives.

add_variable(*args)

Add dependent variables to the equations.

sol(sol, **kwargs)

Post-processing of scipy.integrate.solve_ivp() solution.

__call__(x, y)[source]

Vector of derivatives.

Parameters:
xfloat

independent variable

ynp.ndarray

dependent variables

Returns:
dynp.ndarray

Vector of derivatives

sol(sol, **kwargs)[source]

Post-processing of scipy.integrate.solve_ivp() solution.

add_variable(*args)[source]

Add dependent variables to the equations.

  • creates an index for the location of variable in y

  • creates a class method of the same name with signature name(self, x, y) that should be used to extract the variable value in an index-independent manner.

Parameters:
*argsstr

Name of the dependent variables

primpy.events module

Setup for event tracking in scipy.integrate.solve_ivp().

class primpy.events.Event(equations, direction=0, terminal=False, value=0)[source]

Bases: object

Base class for event tracking.

Gives a more usable wrapper to callable event to be passed to scipy.integrate.solve_ivp().

Parameters:
equations: Equations

The equations for computing derived variables.

direction: int, default: 0

The direction of the root finding (if any), one of {-1, 0, +1}.

terminal: bool, default: False

Whether to stop at this root or continue integrating.

value: float, default: 0

Offset to root.

Methods

__call__(x, y)

Vector of derivatives.

__call__(x, y)[source]

Vector of derivatives.

Parameters:
xfloat

independent variable

ynp.ndarray

dependent variables

Returns:
rootfloat

event occurs when this is zero from a given direction

class primpy.events.UntilTEvent(equations, value, direction=0, terminal=True)[source]

Bases: Event

Stop after a given amount of time t has passed.

Methods

__call__(x, y)

Root of t - value.

__call__(x, y)[source]

Root of t - value.

class primpy.events.UntilNEvent(equations, value, direction=0, terminal=True)[source]

Bases: Event

Stop after a given number of e-folds _N.

Methods

__call__(x, y)

Root of _N - value.

__call__(x, y)[source]

Root of _N - value.

class primpy.events.InflationEvent(equations, direction=0, terminal=False, value=0, **kwargs)[source]

Bases: Event

Track inflation start/end.

Methods

__call__(x, y)

Root of V - dphidt**2.

__call__(x, y)[source]

Root of V - dphidt**2.

class primpy.events.AfterInflationEndEvent(equations, direction=1, terminal=True, value=0)[source]

Bases: Event

Go a bit past the end of inflation.

Methods

__call__(x, y)

Root of w - value.

__call__(x, y)[source]

Root of w - value.

class primpy.events.CollapseEvent(equations, direction=0, terminal=True, value=0)[source]

Bases: Event

Stop if Universe collapses, i.e. test whether H**2 turns negative.

Methods

__call__(x, y)

Root of H2 - value.

__call__(x, y)[source]

Root of H2 - value.

class primpy.events.Phi0Event(equations, direction=0, terminal=True, value=0)[source]

Bases: Event

Track zero crossings of inflaton phi.

Methods

__call__(x, y)

Root of phi - value.

__call__(x, y)[source]

Root of phi - value.

class primpy.events.ModeExitEvent(equations, value, direction=0, terminal=True)[source]

Bases: Event

Track when mode exits the horizon aH.

Methods

__call__(x, y)

Root of _logaH - log(value).

__call__(x, y)[source]

Root of _logaH - log(value).

primpy.exceptionhandling module

Custom exceptions and warnings.

exception primpy.exceptionhandling.PrimpyError[source]

Bases: Exception

Base class for exceptions in primpy.

exception primpy.exceptionhandling.InflationStartError(message, *args, **kwargs)[source]

Bases: PrimpyError

Exception when the inflation start condition for open or closed universes is violated.

Parameters:
messagestr

Explanation of the error.

Other Parameters:
geometrystr, default: “all types of”

Should be either ‘open’ or ‘closed’ to relate to the respective condition at inflation start.

exception primpy.exceptionhandling.StepSizeError(message, *args)[source]

Bases: PrimpyError

Warning when the scipy integrator failed because of a too small step size.

Parameters:
messagestr

Explanation of the warning.

exception primpy.exceptionhandling.InsufficientInflationError(message, *args)[source]

Bases: PrimpyError

Exception when there are insufficient number of e-folds for inflation.

Parameters:
messagestr

Explanation of the error.

exception primpy.exceptionhandling.BigBangError(message, *args)[source]

Bases: PrimpyError

Exceptions for the standard Big Bang evolution.

Parameters:
messagestr

Explanation of the error.

exception primpy.exceptionhandling.PrimpyWarning[source]

Bases: UserWarning

Base class for warnings in primpy.

exception primpy.exceptionhandling.InflationWarning(message, *args)[source]

Bases: PrimpyWarning

Warnings for the inflationary background evolution.

Parameters:
messagestr

Explanation of the warning.

exception primpy.exceptionhandling.CollapseWarning(message, *args)[source]

Bases: InflationWarning

Warning when the Universe has collapsed.

Parameters:
messagestr

Explanation of the warning.

exception primpy.exceptionhandling.InflationStartWarning(message, *args, **kwargs)[source]

Bases: InflationWarning

Warnings when the start of inflation could not be determined.

Parameters:
messagestr

Explanation of the warning.

Other Parameters:
eventsdict, default: None

Dictionary of events captured. Can be any of N_events, t_events, phi_events.

exception primpy.exceptionhandling.InflationEndWarning(message, *args, **kwargs)[source]

Bases: InflationWarning

Warnings when the end of inflation could not be determined.

Parameters:
messagestr

Explanation of the warning.

Other Parameters:
eventsdict, default: None

Dictionary of events captured. Can be any of N_events, t_events, phi_events.

solBunch object same as returned by scipy.integrate.solve_ivp(), default: None

Bunch object returned by primpy.solver.solve().

exception primpy.exceptionhandling.BigBangWarning(message, *args)[source]

Bases: PrimpyWarning

Warnings for the standard Big Bang evolution.

Parameters:
messagestr

Explanation of the warning.

primpy.inflation module

General setup for equations for cosmic inflation.

class primpy.inflation.InflationEquations(K, potential, verbose=False)[source]

Bases: Equations, ABC

Base class for inflation equations.

Methods

H(x, y)

Hubble parameter.

H2(x, y)

Hubble parameter squared.

V(x, y)

Inflationary Potential.

d2Vdphi2(x, y)

Second derivative of inflationary potential.

dVdphi(x, y)

First derivative of inflationary potential.

inflating(x, y)

Inflation diagnostic for event tracking.

postprocessing_inflation_end(sol)

Extract end point of inflation from event tracking.

postprocessing_inflation_start(sol)

Extract starting point of inflation from event tracking.

sol(sol, **kwargs)

Post-processing of scipy.integrate.solve_ivp() solution.

w(x, y)

Equation of state parameter.

H(x, y)[source]

Hubble parameter.

H2(x, y)[source]

Hubble parameter squared.

V(x, y)[source]

Inflationary Potential.

dVdphi(x, y)[source]

First derivative of inflationary potential.

d2Vdphi2(x, y)[source]

Second derivative of inflationary potential.

w(x, y)[source]

Equation of state parameter.

inflating(x, y)[source]

Inflation diagnostic for event tracking.

postprocessing_inflation_start(sol)[source]

Extract starting point of inflation from event tracking.

postprocessing_inflation_end(sol)[source]

Extract end point of inflation from event tracking.

sol(sol, **kwargs)[source]

Post-processing of scipy.integrate.solve_ivp() solution.

primpy.initialconditions module

Initial conditions for inflation.

class primpy.initialconditions.InitialConditions(equations, **kwargs)[source]

Bases: ABC

Base class for initial conditions.

Methods

__call__(y0, **ivp_kwargs)

Initialise background equations of inflation.

abstract __call__(y0, **ivp_kwargs)[source]

Initialise background equations of inflation.

class primpy.initialconditions.SlowRollIC(equations, phi_i, t_i=None, eta_i=None, x_end=1e+300, **kwargs)[source]

Bases: InitialConditions

Slow-roll initial conditions given phi_i and either of N_i or Omega_Ki.

Class for setting up initial conditions during slow-roll inflation where the potential energy dominates over the kinetic energy.

Methods

__call__(y0, **ivp_kwargs)

Set background equations of inflation for _N, phi and dphi.

__call__(y0, **ivp_kwargs)[source]

Set background equations of inflation for _N, phi and dphi.

class primpy.initialconditions.InflationStartIC(equations, phi_i, t_i=None, eta_i=None, x_end=1e+300, **kwargs)[source]

Bases: InitialConditions

Inflation start initial conditions given phi_i and either of N_i or Omega_Ki.

Class for setting up initial conditions at the start of inflation, when the curvature density parameter was maximal after kinetic dominance.

Methods

__call__(y0, **ivp_kwargs)

Set background equations of inflation for _N, phi and dphi.

__call__(y0, **ivp_kwargs)[source]

Set background equations of inflation for _N, phi and dphi.

class primpy.initialconditions.ISIC_Nt(equations, N_tot, phi_i_bracket, t_i=None, eta_i=None, x_end=1e+300, verbose=False, **kwargs)[source]

Bases: InflationStartIC

Inflation start initial conditions given N_tot and either of N_i or Omega_Ki.

Methods

__call__(y0, **ivp_kwargs)

Set background equations of inflation optimizing for N_tot.

__call__(y0, **ivp_kwargs)[source]

Set background equations of inflation optimizing for N_tot.

class primpy.initialconditions.ISIC_NsOk(equations, N_star, Omega_K0, h, phi_i_bracket, t_i=None, eta_i=None, x_end=1e+300, verbose=False, **kwargs)[source]

Bases: InflationStartIC

Inflation start initial conditions given N_star, Omega_K0, h.

Additionally either N_i or Omega_Ki need to be specified.

Methods

__call__(y0, **ivp_kwargs)

Set background equations of inflation optimizing for N_star.

__call__(y0, **ivp_kwargs)[source]

Set background equations of inflation optimizing for N_star.

primpy.oscode_solver module

Setup for running pyoscode.solve().

primpy.oscode_solver.solve_oscode(background, k, **kwargs)[source]

Run pyoscode.solve() and store information for post-processing.

This is a wrapper around pyoscode.solve() to calculate the solution to the Mukhanov-Sasaki equation.

Parameters:
backgroundBunch object same as returned by scipy.integrate.solve_ivp()

Bunch object as returned by primpy.solver.solve(). Solution to the inflationary background equations used to calculate the frequency and damping term passed to oscode.

kint, float, np.ndarray

Comoving wavenumber used to evolve the Mukhanov-Sasaki equation.

Returns:
solBunch object same as returned by scipy.integrate.solve_ivp()

Solution to the inverse value problem, containing the primordial power spectrum value corresponding to the wavenumber k. Monkey-patched version of the Bunch type usually returned by scipy.integrate.solve_ivp().

Other Parameters:
y0(float, float, float, float)

Initial values (y0_1, dy0_1, y0_2, dy0_2) of perturbations and their derivatives for two independent solutions. The perturbations (y0_1, y0_2) are scaled with k and their derivatives with k**2 in order to produce freeze-out values of about order(~1). default : determined by input inflationary potential

rtolfloat

Tolerance passed to pyoscode. default : 5e-5

fac_begint, float

Integration of the mode evolution starts when the considered scale 1/k is within a factor of fac_beg of the comoving Hubble horizon, i.e. when 1/k > 1/aH / fac_beg. fac_beg=0 starts integration immediately. default : 0

fac_endint, float

Integration of the mode evolution stops when the considered scale 1/k exceeds the comoving Hubble horizon by a factor of fac_end, i.e. when 1/k > 1/aH * fac_end. default : 100

even_gridbool

Set this to True if the grid of the independent variable is equally spaced. default : False

vacuumtuple

Set of vacuum initial conditions to be computed. Choose any of (‘RST’, ). default : (‘RST’, )

drop_closed_large_scalesbool

If true, this will set the PPS for closed universes on comoving scales of k < 1 to close to zero (1e-30). Strictly speaking, the PPS for closed universes is only defined for rational numbers k > 2. default : True

primpy.parameters module

Constants and parameters for primpy.

primpy.parameters.K_STAR = 0.05

wavenumber at pivot scale in units of 1/Mpc

primpy.parameters.T_CMB_K = 2.72548

+/- 0.00057, in Kelvin, arXiv:0911.1955

primpy.parameters.T_nu_TCMB = 0.7137658555036082

T_ncdm in CLASS

primpy.parameters.N_eff = 3.044

equivalent to N_ur in CLASS for massless neutrinos

primpy.parameters.z_BBN = 1000000000.0

rough estimate of redshift of Big Bang Nucleosynthesis

primpy.parameters.g0 = 3.937090909090909

effective number of relativistic degrees of freedom

primpy.parameters.rho_gamma0_kg_im3 = 4.644956134403369e-31

energy density of photons in kg/m^3

primpy.parameters.rho_nu0_kg_im3 = 3.211126340248152e-31

energy density of relativistic neutrinos in kg/m^3

primpy.parameters.rho_r0_kg_im3 = 7.85608247465152e-31

total radiation energy density in kg/m^3

primpy.perturbations module

Comoving curvature perturbations w.r.t. time t.

class primpy.perturbations.PrimordialPowerSpectrum(background, k, **kwargs)[source]

Bases: object

Primordial Power spectrum of curvature perturbations.

class primpy.perturbations.Perturbation(background, k)[source]

Bases: ABC

Perturbation for wavenumber k.

Methods

oscode_postprocessing(oscode_sol, **kwargs)

Post-processing for pyoscode.solve() solution.

oscode_postprocessing(oscode_sol, **kwargs)[source]

Post-processing for pyoscode.solve() solution.

Translate oscode dictionary output to solve_ivp output with attributes t and y.

Parameters:
oscode_sollist

List [scalar_1, scalar_2, tensor_1, tensor_2] of two independent solutions each for both scalar and tensor modes, where each element is a dictionary returned by pyoscode.solve().

class primpy.perturbations.Mode(background, k, **kwargs)[source]

Bases: Equations, ABC

Template for scalar or tensor modes.

Methods

get_vacuum_ic_RST()

Get initial conditions for scalar modes for RST vacuum.

mukhanov_sasaki_frequency_damping()

Frequency and damping term of the Mukhanov-Sasaki equations.

abstract mukhanov_sasaki_frequency_damping()[source]

Frequency and damping term of the Mukhanov-Sasaki equations.

abstract get_vacuum_ic_RST()[source]

Get initial conditions for scalar modes for RST vacuum.

class primpy.perturbations.ScalarMode(background, k, **kwargs)[source]

Bases: Mode, ABC

Template for scalar modes.

class primpy.perturbations.TensorMode(background, k, **kwargs)[source]

Bases: Mode, ABC

Template for tensor modes.

primpy.potentials module

Inflationary potentials.

class primpy.potentials.InflationaryPotential(**pot_kwargs)[source]

Bases: ABC

Base class for inflaton potential and derivatives.

Attributes:
name

Name of the inflationary potential.

perturbation_ic

Set of well scaling initial conditions for perturbation module.

tag

3 letter tag identifying the type of inflationary potential.

tex

Tex string useful for labelling the inflationary potential.

Methods

V(phi)

Inflationary potential V(phi).

d2V(phi)

Second derivative V''(phi) with respect to inflaton phi.

d3V(phi)

Third derivative V'''(phi) with respect to inflaton phi.

dV(phi)

First derivative V'(phi) with respect to inflaton phi.

inv_V(V)

Inverse function phi(V) with respect to potential V.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

abstract property tag

3 letter tag identifying the type of inflationary potential.

abstract property name

Name of the inflationary potential.

abstract property tex

Tex string useful for labelling the inflationary potential.

abstract property perturbation_ic

Set of well scaling initial conditions for perturbation module.

abstract V(phi)[source]

Inflationary potential V(phi).

Parameters:
phifloat or np.ndarray

Inflaton field phi.

Returns:
Vfloat or np.ndarray

Inflationary potential V(phi).

abstract dV(phi)[source]

First derivative V’(phi) with respect to inflaton phi.

Parameters:
phifloat or np.ndarray

Inflaton field phi.

Returns:
dVfloat or np.ndarray

1st derivative of inflationary potential: V’(phi).

abstract d2V(phi)[source]

Second derivative V’’(phi) with respect to inflaton phi.

Parameters:
phifloat or np.ndarray

Inflaton field phi.

Returns:
d2Vfloat or np.ndarray

2nd derivative of inflationary potential: V’’(phi).

abstract d3V(phi)[source]

Third derivative V’’’(phi) with respect to inflaton phi.

Parameters:
phifloat or np.ndarray

Inflaton field phi.

Returns:
d3Vfloat or np.ndarray

3rd derivative of inflationary potential: V’’’(phi).

abstract inv_V(V)[source]

Inverse function phi(V) with respect to potential V.

Parameters:
Vfloat or np.ndarray

Inflationary potential V.

Returns:
phifloat or np.ndarray

Inflaton field phi.

abstract classmethod sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

class primpy.potentials.MonomialPotential(**pot_kwargs)[source]

Bases: InflationaryPotential

Monomial potential: V(phi) = Lambda**4 * phi**p.

Methods

V(phi)

V(phi) = Lambda**4 * phi**p.

d2V(phi)

V(phi) = Lambda**4 * phi**(p-2) * p * (p-1).

d3V(phi)

V(phi) = Lambda**4 * phi**(p-3) * p * (p-1) * (p-2).

dV(phi)

V(phi) = Lambda**4 * phi**(p-1) * p.

inv_V(V)

phi(V) = (V / Lambda**4)**(1/p).

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_kwargs)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star, **pot_kwargs)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s, **pot_kwargs)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_kwargs)

Slow-roll approximation for inferring N_star from r.

tag = 'mnp'
name = 'MonomialPotential'
tex = '$\\phi^p$'
perturbation_ic = (0.1, 0, 0, 1e-06)
V(phi)[source]

V(phi) = Lambda**4 * phi**p.

dV(phi)[source]

V(phi) = Lambda**4 * phi**(p-1) * p.

d2V(phi)[source]

V(phi) = Lambda**4 * phi**(p-2) * p * (p-1).

d3V(phi)[source]

V(phi) = Lambda**4 * phi**(p-3) * p * (p-1) * (p-2).

inv_V(V)[source]

phi(V) = (V / Lambda**4)**(1/p).

static sr_Nstar2ns(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from r.

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Monomial potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_star: float

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.LinearPotential(**pot_kwargs)[source]

Bases: MonomialPotential

Linear potential: V(phi) = Lambda**4 * phi.

Methods

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_params)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star, **pot_params)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s, **pot_params)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_params)

Slow-roll approximation for inferring N_star from r.

tag = 'mn1'
name = 'LinearPotential'
tex = '$\\phi^1$'
perturbation_ic = (1, 0, 0, 1)
static sr_Nstar2ns(N_star, **pot_params)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s, **pot_params)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_params)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r, **pot_params)[source]

Slow-roll approximation for inferring N_star from r.

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Linear potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_star: float

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.QuadraticPotential(**pot_kwargs)[source]

Bases: MonomialPotential

Quadratic potential: V(phi) = Lambda**4 * phi**2.

Methods

V(phi)

V(phi) = Lambda**4 * phi**2.

d2V(phi)

V''(phi) = 2 * Lambda**4.

d3V(phi)

V'''(phi) = 0.

dV(phi)

V'(phi) = 2 * Lambda**4 * phi.

inv_V(V)

phi(V) = sqrt(V) / Lambda**2.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_kwargs)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star, **pot_kwargs)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s, **pot_kwargs)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_kwargs)

Slow-roll approximation for inferring N_star from r.

tag = 'mn2'
name = 'QuadraticPotential'
tex = '$\\phi^2$'
perturbation_ic = (0.1, 0, 0, 1e-05)
V(phi)[source]

V(phi) = Lambda**4 * phi**2.

dV(phi)[source]

V’(phi) = 2 * Lambda**4 * phi.

d2V(phi)[source]

V’’(phi) = 2 * Lambda**4.

d3V(phi)[source]

V’’’(phi) = 0.

inv_V(V)[source]

phi(V) = sqrt(V) / Lambda**2.

static sr_Nstar2ns(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from r.

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton mass m (i.e. essentially the potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Quadratic potential (Lambda**2 = mass).

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_star: float

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.CubicPotential(**pot_kwargs)[source]

Bases: MonomialPotential

Linear potential: V(phi) = Lambda**4 * phi.

Methods

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_kwargs)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star, **pot_kwargs)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s, **pot_kwargs)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_kwargs)

Slow-roll approximation for inferring N_star from r.

tag = 'mn3'
name = 'CubicPotential'
tex = '$\\phi^3$'
perturbation_ic = (1, 0, 0, 1)
static sr_Nstar2ns(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from r.

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Linear potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_star: float

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.QuarticPotential(**pot_kwargs)[source]

Bases: MonomialPotential

Linear potential: V(phi) = Lambda**4 * phi.

Methods

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_kwargs)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star, **pot_kwargs)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s, **pot_kwargs)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_kwargs)

Slow-roll approximation for inferring N_star from r.

tag = 'mn4'
name = 'QuarticPotential'
tex = '$\\phi^4$'
perturbation_ic = (1, 0, 0, 1)
static sr_Nstar2ns(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_kwargs)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from r.

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Linear potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_star: float

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.StarobinskyPotential(**pot_kwargs)[source]

Bases: InflationaryPotential

Starobinsky potential: V(phi) = Lambda**4 * (1 - exp(-sqrt(2/3) * phi))**2.

Methods

V(phi)

V(phi) = Lambda**4 * (1 - exp(-sqrt(2/3) * phi))**2.

d2V(phi)

V''(phi) = Lambda**4 * 2 * gamma**2 * exp(-2*gamma*phi) * (2 - exp(gamma*phi)).

d3V(phi)

V'''(phi) = Lambda**4 * 2 * gamma**3 * exp(-2*gamma*phi) * (-4 + exp(gamma*phi)).

dV(phi)

V'(phi) = Lambda**4 * 2 * gamma * exp(-2 * gamma * phi) * (-1 + exp(gamma * phi)).

inv_V(V)

phi(V) = -np.log(1 - np.sqrt(V) / Lambda**2) / gamma.

phi2efolds(phi)

Get e-folds N from inflaton phi.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star)

Slow-roll approximation for inferring n_s from N_star.

sr_Nstar2r(N_star)

Slow-roll approximation for inferring r from N_star.

sr_ns2Nstar(n_s)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r)

Slow-roll approximation for inferring N_star from r.

tag = 'stb'
name = 'StarobinskyPotential'
tex = 'Starobinsky'
gamma = np.float64(0.816496580927726)
perturbation_ic = (-1, 0, 0, 1e-08)
V(phi)[source]

V(phi) = Lambda**4 * (1 - exp(-sqrt(2/3) * phi))**2.

dV(phi)[source]

V’(phi) = Lambda**4 * 2 * gamma * exp(-2 * gamma * phi) * (-1 + exp(gamma * phi)).

d2V(phi)[source]

V’’(phi) = Lambda**4 * 2 * gamma**2 * exp(-2*gamma*phi) * (2 - exp(gamma*phi)).

d3V(phi)[source]

V’’’(phi) = Lambda**4 * 2 * gamma**3 * exp(-2*gamma*phi) * (-4 + exp(gamma*phi)).

inv_V(V)[source]

phi(V) = -np.log(1 - np.sqrt(V) / Lambda**2) / gamma.

static sr_Nstar2ns(N_star)[source]

Slow-roll approximation for inferring n_s from N_star.

static sr_ns2Nstar(n_s)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star)[source]

Slow-roll approximation for inferring r from N_star.

static sr_r2Nstar(r)[source]

Slow-roll approximation for inferring N_star from r.

static phi2efolds(phi)[source]

Get e-folds N from inflaton phi.

Find the number of e-folds N till end of inflation from inflaton phi using the slow-roll approximation.

Parameters:
phifloat or np.ndarray

Inflaton field phi.

Returns:
Nfloat or np.ndarray

Number of e-folds N until end of inflation.

classmethod sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Starobinsky potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_starfloat

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

class primpy.potentials.NaturalPotential(**pot_kwargs)[source]

Bases: InflationaryPotential

Natural inflation potential: V(phi) = Lambda**4 * (1 - cos(pi*phi/phi0)).

Natural inflation with phi0 = pi * f where f is the standard parameter used in definitions of natural inflation. Here we use phi0 the position of the maximum and we have a minus in our definition such that the minimum is at zero instead of the maximum.

Methods

V(phi)

V(phi) = Lambda**4 * (1 - cos(pi*phi/phi0)).

d2V(phi)

V(phi) = Lambda**4 * cos(pi*phi/phi0) * (pi / phi0)**2.

d3V(phi)

V(phi) = -Lambda**4 * sin(pi*phi/phi0) * (pi / phi0)**3.

dV(phi)

V(phi) = Lambda**4 * sin(pi*phi/phi0) * pi / phi0.

inv_V(V)

phi(V) = arccos(1 - V / Lambda**4) * phi0 / pi.

phi2efolds(phi, phi0)

Get e-folds N from inflaton phi.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

sr_Nstar2ns(N_star, **pot_kwargs)

Slow-roll approximation for the spectral index n_s.

sr_Nstar2r(N_star, **pot_kwargs)

Slow-roll approximation for the tensor-to-scalar ratio r.

sr_ns2Nstar(n_s, **pot_kwargs)

Slow-roll approximation for inferring N_star from n_s.

sr_r2Nstar(r, **pot_kwargs)

Slow-roll approximation for inferring N_star from r.

tag = 'nat'
name = 'NaturalPotential'
tex = 'Natural'
perturbation_ic = (0.1, 0, 0, 1e-05)
V(phi)[source]

V(phi) = Lambda**4 * (1 - cos(pi*phi/phi0)).

dV(phi)[source]

V(phi) = Lambda**4 * sin(pi*phi/phi0) * pi / phi0.

d2V(phi)[source]

V(phi) = Lambda**4 * cos(pi*phi/phi0) * (pi / phi0)**2.

d3V(phi)[source]

V(phi) = -Lambda**4 * sin(pi*phi/phi0) * (pi / phi0)**3.

inv_V(V)[source]

phi(V) = arccos(1 - V / Lambda**4) * phi0 / pi.

static sr_Nstar2ns(N_star, **pot_kwargs)[source]

Slow-roll approximation for the spectral index n_s.

static sr_ns2Nstar(n_s, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from n_s.

static sr_Nstar2r(N_star, **pot_kwargs)[source]

Slow-roll approximation for the tensor-to-scalar ratio r.

static sr_r2Nstar(r, **pot_kwargs)[source]

Slow-roll approximation for inferring N_star from r.

static phi2efolds(phi, phi0)[source]

Get e-folds N from inflaton phi.

Find the number of e-folds N till end of inflation from inflaton phi using the slow-roll approximation.

Parameters:
phifloat or np.ndarray

Inflaton field phi.

phi0float

Inflaton distance between local maximum and minima.

Returns:
Nfloat or np.ndarray

Number of e-folds N until end of inflation.

classmethod sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Natural inflation potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_starfloat

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Other Parameters:
phi0float

Inflaton distance between local maximum and minima.

class primpy.potentials.DoubleWellPotential(**pot_kwargs)[source]

Bases: InflationaryPotential

Double-Well potential: V(phi) = Lambda**4 * (1 - (phi/phi0)**p)**2.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

Methods

V(phi)

V(phi) = Lambda**4 * (1 - (phi/phi0)**p)**2.

d2V(phi)

V''(phi) = 2p*Lambda**4 * (1-p+(2*p-1)*(phi/phi0)**p) * phi**(p-2) / phi0**p.

d3V(phi)

V'''(phi) = 2p(p-1)Lambda**4 * (2-p+(4*p-2)*(phi/phi0)**p) * phi**(p-3) / phi0**p.

dV(phi)

V'(phi) = 2p*Lambda**4 * (-1 + (phi / phi0)**p) * phi**(p - 1) / phi0**p.

inv_V(V)

phi(V) = phi0 * (1 - sqrt(V) / Lambda**2)**(1/p).

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

tag = 'dwp'
name = 'DoubleWellPotential'
tex = 'Double-Well (p)'
perturbation_ic = (0.1, 0, 0, 1e-05)
V(phi)[source]

V(phi) = Lambda**4 * (1 - (phi/phi0)**p)**2.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

dV(phi)[source]

V’(phi) = 2p*Lambda**4 * (-1 + (phi / phi0)**p) * phi**(p - 1) / phi0**p.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

d2V(phi)[source]

V’’(phi) = 2p*Lambda**4 * (1-p+(2*p-1)*(phi/phi0)**p) * phi**(p-2) / phi0**p.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

d3V(phi)[source]

V’’’(phi) = 2p(p-1)Lambda**4 * (2-p+(4*p-2)*(phi/phi0)**p) * phi**(p-3) / phi0**p.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

inv_V(V)[source]

phi(V) = phi0 * (1 - sqrt(V) / Lambda**2)**(1/p).

static sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

class primpy.potentials.DoubleWell2Potential(**pot_kwargs)[source]

Bases: DoubleWellPotential

Quadratic Double-Well potential: V(phi) = Lambda**4 * (1 - (phi/phi0)**2)**2.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

Methods

phi2efolds(phi_shifted, phi0)

Get e-folds N from inflaton phi.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

tag = 'dw2'
name = 'DoubleWell2Potential'
tex = 'Double-Well (quadratic)'
perturbation_ic = (0.1, 0, 0, 1e-05)
static phi2efolds(phi_shifted, phi0)[source]

Get e-folds N from inflaton phi.

Find the number of e-folds N till end of inflation from inflaton phi using the slow-roll approximation.

Parameters:
phi_shiftedfloat or np.ndarray

Inflaton field phi shifted by phi0 such that left potential minimum is at zero.

phi0float

Inflaton distance between local maximum and minima.

Returns:
Nfloat or np.ndarray

Number of e-folds N until end of inflation.

classmethod sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Double-Well potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_starfloat

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Other Parameters:
phi0float

Inflaton distance between local maximum and minima.

class primpy.potentials.DoubleWell4Potential(**pot_kwargs)[source]

Bases: DoubleWellPotential

Quartic Double-Well potential: V(phi) = Lambda**4 * (1 - (phi/phi0)**4)**2.

Double-Well shifted such that left minimum is at zero: phi -> phi-phi0

Methods

phi2efolds(phi_shifted, phi0)

Get e-folds N from inflaton phi.

phi_end_squared(phi0)

Get inflaton at end of inflation using slow-roll.

sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)

Get potential amplitude Lambda from PPS amplitude A_s.

tag = 'dw4'
name = 'DoubleWell4Potential'
tex = 'Double-Well (quartic)'
perturbation_ic = (0.1, 0, 0, 1e-05)
static phi_end_squared(phi0)[source]

Get inflaton at end of inflation using slow-roll.

Parameters:
phi0float

Inflaton distance between local maximum and minima.

Returns:
phi_end2float

Inflaton phi squared at end of inflation. (unshifted!)

classmethod phi2efolds(phi_shifted, phi0)[source]

Get e-folds N from inflaton phi.

Find the number of e-folds N till end of inflation from inflaton phi using the slow-roll approximation.

Parameters:
phi_shiftedfloat or np.ndarray

Inflaton field phi shifted by phi0 such that left potential minimum is at zero.

phi0float

Inflaton distance between local maximum and minima.

Returns:
Nfloat or np.ndarray

Number of e-folds N until end of inflation.

classmethod sr_As2Lambda(A_s, phi_star, N_star, **pot_kwargs)[source]

Get potential amplitude Lambda from PPS amplitude A_s.

Find the inflaton amplitude Lambda (4th root of potential amplitude) that produces the desired amplitude A_s of the primordial power spectrum using the slow-roll approximation.

Parameters:
A_sfloat or np.ndarray

Amplitude A_s of the primordial power spectrum.

phi_starfloat or None

Inflaton value at horizon crossing of the pivot scale.

N_starfloat or None

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Returns:
Lambdafloat or np.ndarray

Amplitude parameter Lambda for the Double-Well potential.

phi_starfloat

Inflaton value at horizon crossing of the pivot scale.

N_starfloat

Number of observable e-folds of inflation N_star from horizon crossing till the end of inflation.

Other Parameters:
phi0float

Inflaton distance between local maximum and minima.

class primpy.potentials.FeatureFunction[source]

Bases: ABC

Feature in the inflationary potential.

Methods

F(x, x0, a, b)

Feature function.

d2F(x, x0, a, b)

Feature function 2nd derivative.

d3F(x, x0, a, b)

Feature function 3rd derivative.

dF(x, x0, a, b)

Feature function derivative.

abstract static F(x, x0, a, b)[source]

Feature function.

abstract static dF(x, x0, a, b)[source]

Feature function derivative.

abstract static d2F(x, x0, a, b)[source]

Feature function 2nd derivative.

abstract static d3F(x, x0, a, b)[source]

Feature function 3rd derivative.

class primpy.potentials.GaussianDip[source]

Bases: FeatureFunction

Gaussian: F(x) = -a * exp(-(x-x0)**2 / (2*b**2)).

Methods

F(x, x0, a, b)

F(x) = -a * exp(-(x-x0)**2 / (2*b**2)).

d2F(x, x0, a, b)

F''(x) = a/b**4 * (b**2 - (x-x0)**2) * exp(-(x-x0)**2 / (2*b**2)).

d3F(x, x0, a, b)

F'''(x) = a/b**6 * (x-x0) * ((x-x0)**2 - 3*b**2) * exp(-(x-x0)**2 / (2*b**2)).

dF(x, x0, a, b)

F'(x) = a/b**2 * (x-x0) * exp(-(x-x0)**2 / (2*b**2)).

static F(x, x0, a, b)[source]

F(x) = -a * exp(-(x-x0)**2 / (2*b**2)).

static dF(x, x0, a, b)[source]

F’(x) = a/b**2 * (x-x0) * exp(-(x-x0)**2 / (2*b**2)).

static d2F(x, x0, a, b)[source]

F’’(x) = a/b**4 * (b**2 - (x-x0)**2) * exp(-(x-x0)**2 / (2*b**2)).

static d3F(x, x0, a, b)[source]

F’’’(x) = a/b**6 * (x-x0) * ((x-x0)**2 - 3*b**2) * exp(-(x-x0)**2 / (2*b**2)).

class primpy.potentials.TanhStep[source]

Bases: FeatureFunction

Tanh step function: F(x) = a * tanh((x - x0) / b).

Methods

F(x, x0, a, b)

F(x) = a * tanh((x-x0)/b).

d2F(x, x0, a, b)

F''(x) = -2*a/b**2 * tanh((x-x0)/b) * (1 - tanh((x-x0)/b)**2).

d3F(x, x0, a, b)

F'''(x) = -2*a/b**3 * (1 - 4*tanh((x-x0)/b)**2 + 3*tanh((x-x0)/b)**4).

dF(x, x0, a, b)

F'(x) = a/b * (1 - tanh((x-x0)/b)**2).

static F(x, x0, a, b)[source]

F(x) = a * tanh((x-x0)/b).

static dF(x, x0, a, b)[source]

F’(x) = a/b * (1 - tanh((x-x0)/b)**2).

static d2F(x, x0, a, b)[source]

F’’(x) = -2*a/b**2 * tanh((x-x0)/b) * (1 - tanh((x-x0)/b)**2).

static d3F(x, x0, a, b)[source]

F’’’(x) = -2*a/b**3 * (1 - 4*tanh((x-x0)/b)**2 + 3*tanh((x-x0)/b)**4).

class primpy.potentials.FeaturePotential(**pot_kwargs)[source]

Bases: InflationaryPotential, FeatureFunction

Inflationary potential with a feature: V(phi) = V0(phi) * (1+F(phi)).

Methods

V(phi)

Inflationary potential V0(phi) with a feature function F(phi).

d2V(phi)

Second derivative of the inflationary potential with a feature.

d3V(phi)

Third derivative of the inflationary potential with a feature.

dV(phi)

First derivative of the inflationary potential with a feature.

V(phi)[source]

Inflationary potential V0(phi) with a feature function F(phi).

V(phi) = V0(phi) * (1 + F(phi))

dV(phi)[source]

First derivative of the inflationary potential with a feature.

V’(phi) = V0’(phi) * (1 + F(phi)) + V0(phi) * F’(phi)

d2V(phi)[source]

Second derivative of the inflationary potential with a feature.

V’’(phi) = V0’’(phi) * (1 + F(phi)) + 2*V0’(phi)*F’(phi) + V0(phi)*F’’(phi)

d3V(phi)[source]

Third derivative of the inflationary potential with a feature.

\[V'''(\phi) = V_0'''(\phi) * (1 + F(\phi)) + 3 * V_0''(\phi) * F'(\phi) + 3 * V_0'(\phi) * F''(\phi) + V_0(\phi) * F'''(\phi)\]
class primpy.potentials.StarobinskyGaussianDipPotential(**pot_kwargs)[source]

Bases: FeaturePotential, StarobinskyPotential, GaussianDip

Starobinsky potential with a Gaussian dip.

tag = 'sgd'
name = 'StarobinskyGaussianDipPotential'
tex = 'Starobinsky with a Gaussian dip'
class primpy.potentials.StarobinskyTanhStepPotential(**pot_kwargs)[source]

Bases: FeaturePotential, StarobinskyPotential, TanhStep

Starobinsky potential with a hyperbolic tangent step.

tag = 'sts'
name = 'StarobinskyTanhStepPotential'
tex = 'Starobinsky with a tanh step'

primpy.solver module

General setup for running scipy.integrate.solve_ivp().

(Modified from “primordial” by Will Handley.)

primpy.solver.solve(ic, *args, **kwargs)[source]

Run scipy.integrate.solve_ivp() and store information in sol for post-processing.

This is a wrapper around scipy.integrate.solve_ivp(), with easier reusable objects for the equations and initial conditions.

Parameters:
icprimpy.initialconditions.InitialConditions

Initial conditions specifying relevant equations, variables, and initial numerical values.

*args, **kwargs

All other arguments are identical to scipy.integrate.solve_ivp().

Returns:
solBunch object same as returned by scipy.integrate.solve_ivp()

Solution to the inverse value problem.

primpy.units module

Units and constants for primpy.

primpy.units.mp_kg = np.float64(4.341358399139358e-09)

reduced Planck mass in kg

primpy.units.tp_s = np.float64(2.7027701565693675e-43)

reduced Planck time in s

primpy.units.lp_m = np.float64(8.102701086469756e-35)

reduced Planck length in m

primpy.units.Tp_K = np.float64(2.826075522438417e+31)

reduced Planck temperature in K

primpy.units.mp_GeV = np.float64(2.4353234600842885e+18)

reduced Planck mass in GeV

primpy.units.tp_iGeV = np.float64(4.106230717973657e-19)

reduced Planck time in GeV^-1

primpy.units.lp_iGeV = np.float64(4.106230717973658e-19)

reduced Planck length in GeV^-1

primpy.units.Mpc_m = 3.085677581491367e+22

conversion factor from Mpc to m

primpy.units.a_B = 7.565733250280007e-16

radiation constant (Planck’s law)