analysis package  Provides modules to analyse results from cosmomodels runs.
pyflation.analysis.adiabatic  Tools to calculate the spectra of adiabatic perturbations
Return the cross correlation of scalar perturbations P_{I,J}
For multifield systems the full crossterm matrix is returned which has shape nfields*nfields.
Parameters :  modes : array_like
axis : integer


Returns :  Pphi_matrix : array_like, dtype: float64

Return the modes of the scalar perturbations P_{I,J}.
This is a helper function which wraps the full calculation in Pphi_matrix and requires only the model as an argument. Provided for compatibility with previous versions.
Parameters :  m : Cosmomodels instance


Returns :  Pphi_modes : array_like, dtype: float64

Return the spectrum of (first order) curvature perturbations P_R1 for a model m.
For a multifield model this is given by:
where and are the mode matrix elements.
This is the unscaled version which is related to the scaled version by .
This function is a wrapper function which only requires the model as a parameter. The full calculation is done in the Pr_spectrum function in the pyflation.analysis.adiabatic module.
Parameters :  m : Cosmomodels instance
tix : integer, optional
kix : integer, optional


Returns :  Pr : array_like, dtype: float64

Return the spectrum of (first order) curvature perturbations P_R1 for each k, given the first order perturbation modes.
For a multifield model this is given by:
where and are the mode matrix elements.
This is the unscaled version which is related to the scaled version by .
Parameters :  phidot : array_like
modes : array_like
axis : integer


Returns :  Pr : array_like, dtype: float64

Return the spectrum of (first order) curvature perturbations P_R1 for each k.
For a multifield model this is given by:
where and are the mode matrix elements.
This is the unscaled version which is related to the scaled version by .
Parameters :  phidot : array_like
Pphi_modes : array_like
axis : integer


Returns :  Pr : array_like, dtype: float64

Return the spectrum of (first order) curvature perturbations P_zeta for each k.
For a multifield model this is given by:
This is the unscaled version P_zeta which is related to the scaled version by .
Parameters :  m : Cosmomodels instance
tix : integer, optional
kix : integer, optional


Returns :  Pzeta : array_like, dtype: float64

Return the spectrum of (first order) curvature perturbations P_zeta for each k.
For a multifield model this is given by:
This is the unscaled version P_zeta which is related to the scaled version by .
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  Pzeta_spectrum : array_like, dtype: float64

Find horizon crossing for all ks
Parameters :  m : Cosmomodels instance
factor : float


Returns :  hcross : array

Return the value of n_s
Parameters :  sPr : array_like
k : array_like
kix : integer
running : boolean, optional


Returns :  n_s : float
alpha_s : float, present only if running = True

Return the spectrum of (first order) curvature perturbations for each timestep and k mode.
This is the scaled power spectrum which is related to the unscaled version by .
Parameters :  m : Cosmomodels instance
tix : integer, optional
kix : integer, optional


Returns :  calPr : array_like

Return the spectrum of scaled (first order) curvature perturbations for each timestep and k mode.
This is the scaled power spectrum which is related to the unscaled version by .
Parameters :  m : Cosmomodels instance
tix : integer, optional
kix : integer, optional


Returns :  scaled_Pzeta : array_like

pyflation.analysis.nonadiabatic  Module to calculate relative pressure perturbations.
Derivative of pressure of the background fields
Parameters :  Vphi : array_like
phidot : array_like
H : array_like


Returns :  Pdotalpha : array

Notes
All the arguments should have the same number of dimensions. Vphi and phidot should be arrays of the same size, but H should have a dimension of size 1 corresponding to the “field” dimension of the other variables.
Return the alternate spectrum of (first order) isocurvature perturbations P_S for each k. This is only available for a two field model and is given by:
where
This is the unscaled version which is related to the scaled version by .
Parameters :  phidot : array_like
Pphi_modes : array_like
axis : integer


Returns :  Pr : array_like, dtype: float64

Isocurvature perturbation S of the fields given as quantum mode functions.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  result : array

Power spectrum of the isocurvature perturbation S.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  Sspectrum : array

Matrix of the first order perturbed pressure of the field components.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  result : array_like

Perturbed nonadiabatic pressure of the fields given as quantum mode functions.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Power spectrum of the full perturbed nonadiabatic pressure.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  deltaPnadspectrum : array

Perturbed relative pressure of the fields given as quantum mode functions.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  result : array

Power spectrum of the full perturbed relative pressure.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  deltaPrelspectrum : array

Power spectrum of the full perturbed relative pressure.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  deltaPspectrum : array

Matrix of the first order perturbed energy densities of the field components.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  result : array_like

Power spectrum of the perturbed energy density.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer


Returns :  deltarhospectrum : array

Get the spectrum of delta Prel from a model instance.
Parameters :  m : Cosmomodels model instance
tix : integer
kix : integer


Returns :  spectrum : array

Combined derivative in efold time of the pressure of the fields.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
axis : integer, optional


Returns :  fullPdot : array

Combined derivative in efold time of the energy density of the field.
Parameters :  phidot : array_like
H : array_like
axis : integer, optional


Returns :  fullrhodot : array

Derivative in efold time of the energy densities of the individual fields.
Parameters :  phidot : array_like
H : array_like
Both arrays should have the same number of dimensions, but H should have a : dimension of size 1 corresponding to the field dimension of phidot. : 

Returns :  rhodots : array

Return the scaled alternate spectrum of (first order) isocurvature perturbations for each k. This is only available for a two field model and is given by:
This is the scaled version which is related to the unscaled version by .
Parameters :  phidot : array_like
Pphi_modes : array_like
axis : integer


Returns :  Pr : array_like, dtype: float64

Return the spectrum of isocurvature perturbations for each timestep and k mode.
This is the scaled power spectrum which is related to the unscaled version by .
Parameters :  m : Cosmomodels instance
tix : integer, optional
kix : integer, optional


Returns :  scaled_S : array_like

Power spectrum of S scaled with k^3/(2*pi^2)
Assumes that k dimension is last.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer
k : array


Returns :  scaled_S_spectrum : array

Power spectrum of delta P scaled with k^3/(2*pi^2)
Assumes that k dimension is last.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer
k : array


Returns :  scaled_dP_spectrum : array

Power spectrum of delta Pnad scaled with k^3/(2*pi^2)
Assumes that k dimension is last.
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
modes : array_like
modesdot : array_like
axis : integer
k : array


Returns :  scaled_dPnad_spectrum : array

Return the value of the slope of the kscaled spectrum of S
Parameters :  scaled_S : array_like
k : array_like
kix : integer
running : boolean, optional


Returns :  spec_S : float
running_S : float, present only if running = True

Sound speeds of the background fields
Parameters :  Vphi : array_like
phidot : array_like
H : array_like


Returns :  calphasq : array

Notes
All the arguments should have the same number of dimensions. Vphi and phidot should be arrays of the same size, but H should have a dimension of size 1 corresponding to the “field” dimension of the other variables.
Total sound speed of the fluids
Parameters :  Vphi : array_like
phidot : array_like
H : array_like
axis : integer
All the arguments should have the same number of dimensions. Vphi and phidot : should be arrays of the same size, but H should have a dimension of size 1 : corresponding to the “field” dimension of the other variables. : 

Returns :  csq : array_like

pyflation.analysis.utilities  Helper module for analysis package
Get the component variables of delta Prel from a model instance.
Parameters :  m: Cosmomodels model instance :
tix: integer :
kix: integer :


Returns :  Tuple containing: : Vphi: array_like :
phidot: array_like :
H: array_like :
modes: array_like :
modesdot: array_like :
axis: integer :

Return variables with the correct shapes for calculation.
Parameters :  Vphi: array_like :
phidot: array_like :
H: array_like :
modes: array_like :
modesdot: array_like :
axis: integer :


Returns :  result: tuple :

Flatten the mode matrix given into nfield^2 long vector.
Parameters :  modematrix: array :
nfields: integer :
ix1: integer, optional :
ix2: integer, optional :


Returns :  mreshaped: array :

Helper function to reshape flat nfield^2 long y variable into nfield*nfield mode matrix. Returns a view of the y array (changes will be reflected in underlying array).
Parameters :  y: array :
nfields: integer :
ix: integer :
ixslice: index slice, optional :


Returns :  result: view of y array with shape nfield*nfield structure : 
Return the k scaling for power spectrum calculations.
Parameters :  k: array :
kix: integer, optional :


Returns :  kscaling: array :
Note for a single variable (not a spectrum) you may want the square root : of this result. : 
Calculate spectrum of input.
Spectrum = Sum_I modes_I * modes_I.conjugate, where sum over I is on the dimension denoted by axis
Parameters :  modes_I: array_like :
axis: integer :


Returns :  spectrum: array_like, float :

Return the value of spectral index (and running) of y at k[kix]
Parameters :  y: array_like :
k: array_like :
kix: integer :
running: boolean, optional :


Returns :  spec_index: float :
alpha: float, present only if running = True :
