rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
C11 = -phidot * Q**2 / (4*aH2) * k2 C12 = -phidot * Q**2 / (2*aH2) * onekshape
C11 = -phidot * Q**2 / (4*aH2**2) * k2 C12 = -phidot * Q**2 / (2*aH2**2) * onekshape
def calculate_Cterms(self, bgvars, a, potentials,): """ Calculate the value of the constants needed for source term integration. """ #Unpack variables phi, phidot, H = bgvars k = self.k #Get potentials V, Vp, Vpp, Vppp = potentials #Set ones array with same shape as self.k onekshape = np.ones(self.k.shape) a2 = a**2...
C20 = Q / (aH2) * (-2 + pdot2*(1/(2*a*H) - 0.25)) * onekshape
C20 = Q / (aH2) * (-2 + pdot2*(0.25)) * onekshape
def calculate_Cterms(self, bgvars, a, potentials,): """ Calculate the value of the constants needed for source term integration. """ #Unpack variables phi, phidot, H = bgvars k = self.k #Get potentials V, Vp, Vpp, Vppp = potentials #Set ones array with same shape as self.k onekshape = np.ones(self.k.shape) a2 = a**2...
dphi_tgther, dphidot_tgther = srccython.interpdps2(dpnew, dpdnew, k[0], k[1]-k[0], n, theta)
dphi_tgther, dphidot_tgther = srccython.interpdps2(dpnew, dpdnew, k[0], k[1]-k[0], n, theta, len(q)-1)
def getthetaterms(integrand_elements, dp1, dp1dot): """Return array of integrated values for specified theta function and dphi function. Parameters ---------- integrand_elements: tuple Contains integrand arrays in order (k, q, theta) dp1: array_like Array of values for dphi1 dp1dot: array_like Array of values for dp...
source_logger.debug("Left getfoystart. Filling nans...")
if _debug: source_logger.debug("Left getfoystart. Filling nans...")
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("NaNs filled. Setting dynamical variables...")
if _debug: source_logger.debug("NaNs filled. Setting dynamical variables...")
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("Variables set. Getting potentials for this timestep...")
if _debug: source_logger.debug("Variables set. Getting potentials for this timestep...")
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("Calculating source term integrand for this timestep...")
if _debug: source_logger.debug("Calculating source term integrand for this timestep...")
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("Integrating source term...") source_logger.debug("Number of integrand elements: %f", src_integrand.shape[-1])
if _debug: source_logger.debug("Integrating source term...") source_logger.debug("Number of integrand elements: %f", src_integrand.shape[-1])
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("Integration successful!")
if _debug: source_logger.debug("Integration successful!")
def calculatesource(m, nix, integrand_elements, srcfunc=slowrollsrcterm): """Return the integrated source term at this timestep. Given the first order model and the timestep calculate the integrated source term at this time step. Parameters ---------- m: Cosmomodels.TwoStageModel First order model to be used. nix: i...
source_logger.debug("Entering main time loop...")
if _debug: source_logger.debug("Entering main time loop...")
def getsourceandintegrate(m, savefile=None, srcfunc=slowrollsrcterm, ninit=0, nfinal=-1, ntheta=513, numks=1025): """Calculate and save integrated source term. Using first order results in the specified model, the source term for second order perturbations is obtained from the given source function. The convolution in...
source_logger.debug("Results for this timestep saved.")
if _debug: source_logger.debug("Results for this timestep saved.")
def getsourceandintegrate(m, savefile=None, srcfunc=slowrollsrcterm, ninit=0, nfinal=-1, ntheta=513, numks=1025): """Calculate and save integrated source term. Using first order results in the specified model, the source term for second order perturbations is obtained from the given source function. The convolution in...
def J_A(self, k, alpha, beta, Cterms):
def J_A(self, k, Cterms, alpha, beta):
def J_A(self, k, alpha, beta, Cterms): """Solution for J_A which is the integral for A in terms of constants C1 and C2.""" #Set limits from k kmin = k[0] kmax = k[-1] C1 = Cterms[0] C2 = Cterms[1] J_A = ((alpha ** 2 * (-(Sqrt(kmax * (-k + kmax)) * (80 * C1 * (3 * k ** 2 - 14 * k * kmax + 8 * kmax ** 2) + 3 * C2 * (15...
def J_B(self, k, alpha, beta, Cterms):
def J_B(self, k, Cterms, alpha, beta):
def J_B(self, k, alpha, beta, Cterms): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] C3 = Cterms[2] C4 = Cterms[3] J_B = ((alpha ** 2 * (Sqrt(kmax * (k + kmax)) * (112 * C3 * (105 * k ** 4 + 250 * k ** 3 * kmax - 104 * k ** 2 * kmax ** 2 - 48 * k * kmax *...
def J_C(self, k, alpha, beta, Cterms):
def J_C(self, k, Cterms, alpha, beta):
def J_C(self, k, alpha, beta, Cterms): """Second method for J_C""" kmax = k[-1] kmin = k[0] C5 = Cterms[4] J_C = ((alpha**2*C5*(-(Sqrt(2)*k**3*(-10000*beta**2 - (0+15360*1j)*beta*k + 6363*k**2)) - Sqrt(kmax*(-k + kmax))*((0+3840*1j)*beta*(k - kmax)**2*kmax + 400*beta**2*(3*k**2 - 14*k*kmax + 8*kmax**2) + 9*(15*k**4 +...
def J_D(self, k, alpha, beta, Cterms):
def J_D(self, k, Cterms, alpha, beta):
def J_D(self, k, alpha, beta, Cterms): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" kmax = k[-1] kmin = k[0] C6 = Cterms[5] C7 = Cterms[6] j1 = ((alpha ** 2 * (-240 * Sqrt((k + kmax) / kmax) * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 ...
class SimpleInverseFull(AnalyticSolution):
class OldSimpleInverseFull(AnalyticSolution):
def J_D(self, k, Cterms, **kwargs): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" C6 = Cterms[5] C7 = Cterms[6] J_D = self.J_general_Btype(k, C6, 1) + self.J_general_Btype(k, C7, 3) return J_D
solution and with no phase information.
solution and with no phase information. This uses the solutions of the old equations and is not reliable. Should not be used in production.
def J_D(self, k, Cterms, **kwargs): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" C6 = Cterms[5] C7 = Cterms[6] J_D = self.J_general_Btype(k, C6, 1) + self.J_general_Btype(k, C7, 3) return J_D
super(SimpleInverseFull, self).__init__(*args, **kwargs)
super(OldSimpleInverseFull, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(SimpleInverseFull, self).__init__(*args, **kwargs) self.J_terms = [self.J_A1, self.J_A2, self.J_B1, self.J_B2, self.J_C1, self.J_C2, self.J_D1, self.J_D2, self.J_E1, self.J_E2, self.J_F1, self.J_F2, self.J_G1, self.J_G2] self.calculate_Cterms = self.srceqns.calculate_Cterms
class NewSimpleInverseFull(AnalyticSolution):
class SimpleInverseFull(AnalyticSolution):
def J_G2(self, k, Cterms, **kwargs): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" C16 = Cterms[15] J_G2 = self.J_general_Ftype(k, C16, 2) return J_G2
super(NewSimpleInverseFull, self).__init__(*args, **kwargs)
super(SimpleInverseFull, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(NewSimpleInverseFull, self).__init__(*args, **kwargs) self.calculate_Cterms = self.srceqns.calculate_Cterms self.J_params = self.srceqns.J_params self.J_terms = dict([(Jkey,self.J_factory(Jkey)) for Jkey in self.J_params.iterkeys()])
Hstar = self.bgmodel.yresult[tsix,2]
if self.bgmodel.yresult.ndim > 2: bgyresult = self.bgmodel.yresult[..., 0] else: bgyresult = self.bgmodel.yresult Hstar = bgyresult[tsix,2] Hzero = bgyresult[0,2]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
etadiff = etastar + 1/(self.ainit*self.bgmodel.yresult[0,2]*(1-self.bgepsilon[0]))
etadiff = etastar + 1/(self.ainit*Hzero*(1-self.bgepsilon[0]))
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:].transpose()
foystart[0:3] = bgyresult[tsix,:].transpose()
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:][:, np.newaxis]
foystart[0:3] = bgyresult[tsix,:][:, np.newaxis]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
if n == 1: J_general = C * (2/k**2 - 4/3*kmin/k**3 - 2/(3*kmax**2) - 0.5/(k**2)*np.log(kmax/k)) elif n == 3: J_general = C * (25/36 - 4/9 * (kmin/k)**3 -0.25*(kmax/k)**2 +4/3*np.log(kmax/k)) else: J_general = C * (k**(n-3)*(-4/(n*(n-3)) + 0.5/(n-1)) + 4/3 * (kmax**(n-3)/(n-3) - kmin**n/(n*k**3)) - kmax**(n-1)/(2*k**2*(...
if n == 3: J_general = 4/3 * C * (1/3 - 1/3 * (kmin/k)**3 + np.log(kmax/k)) else: J_general = 4/3 * C * (k**(n-3)*3/(n*(n-3)) + kmax**(n-3)/(n-3) - kmin**n/(n*k**3))
def J_general_Ftype(self, k, C, n): kmin = k[0] kmax = k[-1] if n == 1: J_general = C * (2/k**2 - 4/3*kmin/k**3 - 2/(3*kmax**2) - 0.5/(k**2)*np.log(kmax/k)) elif n == 3: J_general = C * (25/36 - 4/9 * (kmin/k)**3 -0.25*(kmax/k)**2 +4/3*np.log(kmax/k)) else: J_general = C * (k**(n-3)*(-4/(n*(n-3)) + 0.5/(n-1)) + 4/3 * ...
n = self.J_terms[Jkey]["n"]
n = self.J_params[Jkey]["n"]
def J_func(self, preterms, dp1, dp1dot, Cterms, Jkey): """Generic solution for J_func integral.""" q = self.k #Set up variables from list of Jterms and constants #Constant term Cterm = Cterms[Jkey][..., np.newaxis] #Index of q n = self.J_terms[Jkey]["n"] #Get text of dphiterm and set variable dphitermtext = self.J_term...
dphitermtext = self.J_terms[Jkey]["dphiterm"]
dphitermtext = self.J_params[Jkey]["dphiterm"]
def J_func(self, preterms, dp1, dp1dot, Cterms, Jkey): """Generic solution for J_func integral.""" q = self.k #Set up variables from list of Jterms and constants #Constant term Cterm = Cterms[Jkey][..., np.newaxis] #Index of q n = self.J_terms[Jkey]["n"] #Get text of dphiterm and set variable dphitermtext = self.J_term...
pretermix = self.J_terms[Jkey]["pretermix"]
pretermix = self.J_params[Jkey]["pretermix"]
def J_func(self, preterms, dp1, dp1dot, Cterms, Jkey): """Generic solution for J_func integral.""" q = self.k #Set up variables from list of Jterms and constants #Constant term Cterm = Cterms[Jkey][..., np.newaxis] #Index of q n = self.J_terms[Jkey]["n"] #Get text of dphiterm and set variable dphitermtext = self.J_term...
simstart=self.simtstart,
simtstart=self.simtstart,
def run(self, saveresults=True): """Execute a simulation run using the parameters already provided.""" if self.solver not in self.solverlist: raise ModelError("Unknown solver!") #Test whether k exists and if so change init conditions if self.solver in ["rkdriver_withks", "rkdriver_new"]: #set_trace() #Loosely estimate...
yarr[xix-1,:,kix] = v[:,kix]
yarr[xix-1][:,kix] = v[:,kix]
def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ...
src_dict["extra_qsub_args"] = ("
src_dict["extra_qsub_params"] = ("
def source_dict(template_dict, fo_jid=None): """Return dictionary for source qsub script.""" #Write second order file with job_id from first src_dict = template_dict.copy() src_dict["hold_jid_list"] = fo_jid src_dict["runname"] += "-src" src_dict["qsublogname"] += "-node-$TASK_ID" src_dict["extra_qsub_args"] = ("#$ -t ...
mrg_dict["extra_qsub_args"] = ("
mrg_dict["extra_qsub_params"] = ("
def merge_dict(template_dict, src_jid=None): """Return dictionary for first order qsub script. Copies template_dict so as not to change values.""" mrg_dict = template_dict.copy() mrg_dict["runname"] += "-mrg" mrg_dict["hold_jid_list"] = src_jid mrg_dict["qsublogname"] += "-mrg" mrg_dict["extra_qsub_args"] = ("#$ -hold_...
so_dict["extra_qsub_args"] = ("
so_dict["extra_qsub_params"] = ("
def second_order_dict(template_dict, mrg_jid=None): """Return dictionary for first order qsub script. Copies template_dict so as not to change values.""" so_dict = template_dict.copy() so_dict["runname"] += "-so" so_dict["hold_jid_list"] = mrg_jid so_dict["qsublogname"] += "-so" so_dict["extra_qsub_args"] = ("#$ -hold_...
theta_terms = np.empty([4, self.k.shape[0], self.k.shape[0]])
theta_terms = np.empty([4, self.k.shape[0], self.k.shape[0]], dtype=dp1.dtype)
def getthetaterms(self, dp1, dp1dot): """Return array of integrated values for specified theta function and dphi function. Parameters ---------- dp1: array_like Array of values for dphi1 dp1dot: array_like Array of values for dphi1dot Returns ------- theta_terms: tuple Tuple of len(k)xlen(q) shaped arrays of integra...
dp1dot_q = dp1dot[self.k.shape[-1]]
dp1dot_q = dp1dot[:self.k.shape[-1]]
def sourceterm(self, bgvars, a, potentials, dp1, dp1dot): """Return integrated slow roll source term. The source term before integration is calculated here using the slow roll approximation. This function follows the revised version of Eq (5.8) in Malik 06 (astro-ph/0610864v5). Parameters ---------- bgvars: tuple Tup...
J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 * kmax +
J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - 15360 * 1j * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * (3840 * 1j * beta * (k - kmax) ** 2 * kmax +
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
Sqrt(kmax * (k + kmax)) * ((0, 3840) * beta * kmax * (k + kmax) ** 2 +
Sqrt(kmax * (k + kmax)) * (3840 * 1j * beta * kmax * (k + kmax) ** 2 +
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
(0, 60) * beta * (15 * k ** 3 - 54 * k ** 2 * kmin + 8 * k * kmin ** 2 + 16 * kmin ** 3) +
60 * 1j * beta * (15 * k ** 3 - 54 * k ** 2 * kmin + 8 * k * kmin ** 2 + 16 * kmin ** 3) +
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
Sqrt(kmin) * Sqrt(k + kmin) * ((0, -3840) * beta * kmin * (k + kmin) ** 2 -
Sqrt(kmin) * Sqrt(k + kmin) * (-3840 * 1j * beta * kmin * (k + kmin) ** 2 -
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
(15 * k ** 3 * (-80 * beta ** 2 - (0, 60) * beta * k + 9 * k ** 2) * Pi) / 2. + 15 * k ** 3 * (80 * beta ** 2 + (0, 60) * beta * k - 9 * k ** 2) * ArcTan(Sqrt(kmin / (k - kmin))) -
(15 * k ** 3 * (-80 * beta ** 2 - 60 * 1j * beta * k + 9 * k ** 2) * Pi) / 2. + 15 * k ** 3 * (80 * beta ** 2 + 60 *1j * beta * k - 9 * k ** 2) * ArcTan(Sqrt(kmin / (k - kmin))) -
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
k ** 3 * (Sqrt(2) * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2) +
k ** 3 * (Sqrt(2) * (-10000 * beta ** 2 - 15360 * 1j * beta * k + 6363 * k ** 2) +
def J_C(self, k, alpha, beta, C5): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_C = ((alpha ** 2 * C5 * (-(Sqrt(2) * k ** 3 * (-10000 * beta ** 2 - (0, 15360) * beta * k + 6363 * k ** 2)) - Sqrt(kmax * (-k + kmax)) * ((0, 3840) * beta * (k - kmax) ** 2 ...
(0, 10) * beta * (24 * C6 * (448 * k ** 4 - 239 * k ** 3 * kmax + 522 * k ** 2 * kmax ** 2 + 88 * k * kmax ** 3 -
10 * 1j * beta * (24 * C6 * (448 * k ** 4 - 239 * k ** 3 * kmax + 522 * k ** 2 * kmax ** 2 + 88 * k * kmax ** 3 -
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (24 * C6 * (448 * k ** 4 + 239 * k ** 3 * kmax + 522 * k ** 2 * kmax ** 2 - 88 * k * kmax ** 3 -
10 * 1j * beta * (24 * C6 * (448 * k ** 4 + 239 * k ** 3 * kmax + 522 * k ** 2 * kmax ** 2 - 88 * k * kmax ** 3 -
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (24 * C6 * (448 * k ** 4 - 239 * k ** 3 * kmin + 522 * k ** 2 * kmin ** 2 + 88 * k * kmin ** 3 -
10 * 1j * beta * (24 * C6 * (448 * k ** 4 - 239 * k ** 3 * kmin + 522 * k ** 2 * kmin ** 2 + 88 * k * kmin ** 3 -
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 20) * beta * (384 * C6 * (k - kmin) ** 2 * (14 * k ** 2 + 5 * k * kmin + 2 * kmin ** 2) +
20 * 1j * beta * (384 * C6 * (k - kmin) ** 2 * (14 * k ** 2 + 5 * k * kmin + 2 * kmin ** 2) +
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(315 * k ** 3 * ((0, -60) * beta * C7 * k ** 3 + 80 * beta ** 2 * (8 * C6 - C7 * k ** 2) + 9 * k ** 2 * (16 * C6 + C7 * k ** 2)) * Pi) / 2. - 315 * k ** 3 * ((0, -60) * beta * C7 * k ** 3 + 80 * beta ** 2 * (8 * C6 - C7 * k ** 2) + 9 * k ** 2 * (16 * C6 + C7 * k ** 2)) *
(315 * k ** 3 * (-60 * 1j * beta * C7 * k ** 3 + 80 * beta ** 2 * (8 * C6 - C7 * k ** 2) + 9 * k ** 2 * (16 * C6 + C7 * k ** 2)) * Pi) / 2. - 315 * k ** 3 * (-60 * 1j * beta * C7 * k ** 3 + 80 * beta ** 2 * (8 * C6 - C7 * k ** 2) + 9 * k ** 2 * (16 * C6 + C7 * k ** 2)) *
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * Sqrt(k)) -
10 * 1j * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * Sqrt(k)) -
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmax) + Sqrt(-k + kmax))) -
10 * 1j * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmax) + Sqrt(-k + kmax))) -
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmax) + Sqrt(k + kmax))) +
10 * 1j * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmax) + Sqrt(k + kmax))) +
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
(0, 10) * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmin) + Sqrt(k + kmin))))) / (604800. * beta ** 2 * k ** 2))
10 * 1j * beta * (72 * C6 * k + C7 * k ** 3)) * Log(2 * (Sqrt(kmin) + Sqrt(k + kmin))))) / (604800. * beta ** 2 * k ** 2))
def J_D(self, k, alpha, beta, C6, C7): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_D = ((alpha ** 2 * (-((240 * beta ** 2 * (40 * C6 * (24 * k ** 3 + 9 * k ** 2 * kmax + 2 * k * kmax ** 2 - 4 * kmax ** 3) + C7 * kmax * (-105 * k ** 4 - 250 * k ** 3 * k...
self.J_terms = self.J_terms
self.J_terms = self.srceqns.J_terms
def __init__(self, *args, **kwargs): super(CalcedSolution, self).__init__(*args, **kwargs) self.calculate_Cterms = self.srceqns.calculate_Cterms self.J_terms = self.J_terms
C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * k**2 )) C2 = 3.5 * phidot /((a*H)**2) * onekshape C3 = -4.5 / (a*H**2) * k C4 = -phidot/(a*H**2) / k
C1 = 1/H2 * (Vppp + 3 * phidot * Vpp + 2 * phidot * k2 /a2 ) C2 = 3.5 * phidot /(aH2) * onekshape C3 = -4.5 * k / (aH2) C4 = -phidot/(aH2 * k)
def sourceterm(self, bgvars, a, potentials, dp1, dp1dot): """Return integrated slow roll source term. The source term before integration is calculated here using the slow roll approximation. This function follows the revised version of Eq (5.8) in Malik 06 (astro-ph/0610864v5). Parameters ---------- bgvars: tuple Tup...
ramp[self.tstartindex==fotix] = 0
ramp[self.tstartindex==sotix] = 0
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" if _debug: self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k nokix = True kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["...
Hstar = self.bgmodel.yresult[tsix,2]
if self.bgmodel.yresult.ndim > 2: bgyresult = self.bgmodel.yresult[..., 0] else: bgyresult = self.bgmodel.yresult Hstar = bgyresult[tsix,2]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
etadiff = etastar + 1/(self.ainit*self.bgmodel.yresult[0,2]*(1-self.bgepsilon[0]))
etadiff = etastar + 1/(self.ainit*bgyresult[0,2]*(1-self.bgepsilon[0]))
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:].transpose()
foystart[0:3] = bgyresult[tsix,:].transpose()
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:][:, np.newaxis]
foystart[0:3] = bgyresult[tsix,:][:, np.newaxis]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:].transpose()
foystart[0:3] = bgyresult[tsix,:].transpose()
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:][:, np.newaxis]
foystart[0:3] = bgyresult[tsix,:][:, np.newaxis]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:].transpose()
foystart[0:3] = bgyresult[tsix,:].transpose()
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
foystart[0:3] = self.bgmodel.yresult[tsix,:][:, np.newaxis]
foystart[0:3] = bgyresult[tsix,:][:, np.newaxis]
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
J_A = 2*C1*(-0.5*k + kmax - kmin**2/(2*k)) + 2*C2*(-1/12*k**3 + kmax**2/3 - kmin**4/(4*k))
J_A = 2*C1*(-0.5*k + kmax - kmin**2/(2*k)) + 2*C2*(-1/12*k**3 + kmax**3/3 - kmin**4/(4*k))
def J_A(self, k, Cterms, **kwargs): """Solution for J_A which is the integral for A in terms of constants C1 and C2.""" #Set limits from k kmin = k[0] kmax = k[-1] C1 = Cterms[0] C2 = Cterms[1] J_A = 2*C1*(-0.5*k + kmax - kmin**2/(2*k)) + 2*C2*(-1/12*k**3 + kmax**2/3 - kmin**4/(4*k)) return J_A
if len(self.ystart.shape) == 1: ys = self.ystart[0:3] elif len(self.ystart.shape) == 2: ys = self.ystart[0:3,0]
if self.ystart: if len(self.ystart.shape) == 1: ys = self.ystart[0:3] elif len(self.ystart.shape) == 2: ys = self.ystart[0:3,0] else: ys = self.foystart[0:3,0]
def __init__(self, filename, *args, **kwargs): """Get results from file and instantiate variables. Opens file with handle saved as self._rf. File is closed in __del__""" #Call super class __init__ method super(ModelWrapper, self).__init__(*args, **kwargs) #Check file exists if not os.path.isfile(filename): raise IOErr...
C3 = -4.5 * k / (aH2)
C3 = -4.5 * phidot * k / (aH2)
def sourceterm(self, bgvars, a, potentials, dp1, dp1dot): """Return integrated slow roll source term. The source term before integration is calculated here using the slow roll approximation. This function follows the revised version of Eq (5.8) in Malik 06 (astro-ph/0610864v5). Parameters ---------- bgvars: tuple Tup...
ie = self.fullk, self.fullk, theta
ie = self.k, self.k, theta
def preconvolution_calced(self, dp1_fullk, dp1dot_fullk): """Return calculates solution for pre-convolution terms.""" #Init vars fixture = self.fixture theta = np.linspace(0, np.pi, fixture["nthetas"]) ie = self.fullk, self.fullk, theta tterms = getthetaterms(ie, dp1_fullk, dp1dot_fullk) aterm = tterms[0,0] + tterms[...
C19 = -2 * Q * pdot2 / (aH2*k2)
C19 = -2 * Q * pdot2 / (aH2*k)
def calculate_Cterms(self, bgvars, a, potentials,): """ Calculate the value of the constants needed for source term integration. """ #Unpack variables phi, phidot, H = bgvars k = self.k #Get potentials V, Vp, Vpp, Vppp = potentials #Set ones array with same shape as self.k onekshape = np.ones(self.k.shape) a2 = a**2...
"ystart" : tables.Float64Col(self.ystart.shape), "tstart" : tables.Float64Col(np.shape(self.tstart)),
"ystart" : tables.Float64Col(ystart.shape), "tstart" : tables.Float64Col(),
def main(): ystart = np.zeros((4,1025)) callingparams = {'ainit': 7.8372191345921218e-65, 'classname': 'SOCanonicalThreeStage', 'datetime': '20101022173354', 'dxsav': 0.0, 'eps': 1e-10, 'potential_func': 'msqphisq', 'solver': 'rkdriver_new', 'tend': 81.640000000009962, 'tstart': 0.0, 'tstep_min': 0.00020000000000000001...
aterm = (C1*q**2 + C2*q**4) * dp1 * preaterm
C1k = C1[..., np.newaxis] C2k = C2[..., np.newaxis] aterm = (C1k*q**2 + C2k*q**4) * dp1 * preaterm
def J_A(self, preaterm, dp1, C1, C2): """Solution for J_A which is the integral for A in terms of constants C1 and C2.""" q = self.k aterm = (C1*q**2 + C2*q**4) * dp1 * preaterm J_A = romb(aterm, self.fixture["deltak"]) return J_A
bterm = (C3*q**3 + C4*q**5) * dp1 * prebterm
C3k = C3[..., np.newaxis] C4k = C4[..., np.newaxis] bterm = (C3k*q**3 + C4k*q**5) * dp1 * prebterm
def J_B(self, prebterm, dp1, C3, C4): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" q = self.k bterm = (C3*q**3 + C4*q**5) * dp1 * prebterm J_B = romb(bterm, self.fixture["deltak"]) return J_B
cterm = (C5*q**2) * dp1dot * precterm
C5k = C5[..., np.newaxis] cterm = (C5k*q**2) * dp1dot * precterm
def J_C(self, precterm, dp1dot, C5): """Solution for J_C which is the integral for C in terms of constants C5.""" q = self.k cterm = (C5*q**2) * dp1dot * precterm J_C = romb(cterm, self.fixture["deltak"]) return J_C
dterm = (C6*q + C7*q**3) * dp1dot * predterm
C6k = C6[..., np.newaxis] C7k = C7[..., np.newaxis] dterm = (C6k*q + C7k*q**3) * dp1dot * predterm
def J_D(self, predterm, dp1dot, C6, C7): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" q = self.k dterm = (C6*q + C7*q**3) * dp1dot * predterm J_D = romb(dterm, self.fixture["deltak"]) return J_D
return src, (C1,C2,C3,C4,C5,C6,C7), (J_A,J_B,J_C, J_D), (alpha, beta)
return src, (C1,C2,C3,C4,C5,C6,C7), (J_A,J_B,J_C, J_D), (alpha, beta), (dp1, dp1dot)
def full_source_from_model(self, m, nix): """Calculate full source term from model m at timestep nix.""" try: #Get background values bgvars = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(bgvars)): raise AttributeError("Background values not available for thi...
dphi_tgther, dphidot_tgther = srccython.interpdps2(dpnew, dpdnew, k[0], k[1]-k[0], n, theta, len(q)-1)
dphi_tgther, dphidot_tgther = srccython.interpdps2(dpnew, dpdnew, k[0], k[1]-k[0], n, theta, len(q))
def getthetaterms(integrand_elements, dp1, dp1dot): """Return array of integrated values for specified theta function and dphi function. Parameters ---------- integrand_elements: tuple Contains integrand arrays in order (k, q, theta) dp1: array_like Array of values for dphi1 dp1dot: array_like Array of values for dp...
J_general = 4/3 * C * (k**(n-3)*3/(n*(n-3))
J_general = 4/3 * C * (k**(n-3)*3/(n*(3-n))
def J_general_Ftype(self, k, C, n): kmin = k[0] kmax = k[-1] if n == 3: J_general = 4/3 * C * (1/3 - 1/3 * (kmin/k)**3 + np.log(kmax/k)) else: J_general = 4/3 * C * (k**(n-3)*3/(n*(n-3)) + kmax**(n-3)/(n-3) - kmin**n/(n*k**3)) return J_general
def compare_one_step(m, nix, srcclass=None, analytic_class=None, calced_class=None):
def compare_one_step(m, nix, srcclass=None, analytic_class=None, calced_class=None, fx=None):
def compare_one_step(m, nix, srcclass=None, analytic_class=None, calced_class=None): """ Compare the analytic and calculated solutions for equations from `srclass` using the results from `m` at the timestep `nix`. """ fx = fixtures.fixture_from_model(m) if srcclass is None: srcclass = run_config.srcclass if analytic_...
fx = fixtures.fixture_from_model(m)
if fx is None: fx = fixtures.fixture_from_model(m)
def compare_one_step(m, nix, srcclass=None, analytic_class=None, calced_class=None): """ Compare the analytic and calculated solutions for equations from `srclass` using the results from `m` at the timestep `nix`. """ fx = fixtures.fixture_from_model(m) if srcclass is None: srcclass = run_config.srcclass if analytic_...
C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * k**2 )) C2 = 3.5 * phidot /((a*H)**2) * onekshape C3 = -4.5 * phidot / (a*H**2) * k C4 = -phidot/(a*H**2) / k
C1 = 1/H2 * (Vppp + 3 * phidot * Vpp + 2 * phidot * k2 /a2 ) C2 = 3.5 * phidot /(aH2) * onekshape C3 = -4.5 * phidot * k / (aH2) C4 = -phidot / (aH2 * k)
def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background...
C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * k**2 )) C2 = 3.5 * phidot /((a*H)**2) * onekshape C3 = -4.5 / (a*H**2) * k C4 = -phidot/(a*H**2) / k
C1 = 1/H2 * (Vppp + 3 * phidot * Vpp + 2 * phidot * k2 /a2 ) C2 = 3.5 * phidot /(aH2) * onekshape C3 = -4.5 * phidot * k / (aH2) C4 = -phidot / (aH2 * k)
def get_vars_from_model(self, m, nix): """Find and calculate variables from cosmomodels model.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background values not available for this ...
y[xix] = v.copy()
yarr[xix] = v.copy()
def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ...
self._log.debug("Starting simulation with %s.", self.solver)
if _debug: self._log.debug("Starting simulation with %s.", self.solver)
def run(self, saveresults=True): """Execute a simulation run using the parameters already provided.""" if self.solver not in self.solverlist: raise ModelError("Unknown solver!") #Test whether k exists and if so change init conditions if self.solver in ["rkdriver_withks", "rkdriver_new"]: #set_trace() #Loosely estimate...
self._log.debug("File already exists! Using append data mode.")
if _debug: self._log.debug("File already exists! Using append data mode.")
def saveallresults(self, filename=None, filetype="hf5"): """Tries to save file as a pickled object in directory 'results'.""" now = self.lastparams["datetime"] if not filename: filename = RESULTS_PATH + "run" + now + "." + filetype self._log.info("Filename set to " + filename) if os.path.isdir(os.path.dirname(filenam...
self._log.debug("File does not exist, using write mode.")
if _debug: self._log.debug("File does not exist, using write mode.")
def saveallresults(self, filename=None, filetype="hf5"): """Tries to save file as a pickled object in directory 'results'.""" now = self.lastparams["datetime"] if not filename: filename = RESULTS_PATH + "run" + now + "." + filetype self._log.info("Filename set to " + filename) if os.path.isdir(os.path.dirname(filenam...
self._log.debug("Successfully wrote results to file " + filename)
if _debug: self._log.debug("Successfully wrote results to file " + filename)
def saveresultsinhdf5(self, filename, filemode): """Save simulation results in a HDF5 format file with filename. filename - full path and name of file (should end in hf5 for consistency. filemode - ["w"|"a"]: "w" specifies write to a new file, overwriting existing one "a" specifies append to current file or create if d...
self._log.debug("args: %s", str(kwargs))
if _debug: self._log.debug("args: %s", str(kwargs))
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("t=%f, fo.tresult[tix]=%f, fotix=%f", t, self.second_stage.tresult[fotix], fotix)
if _debug: self._log.debug("t=%f, fo.tresult[tix]=%f, fotix=%f", t, self.second_stage.tresult[fotix], fotix)
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("args: %s", str(kwargs))
if _debug: self._log.debug("args: %s", str(kwargs))
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("tix=%f, t=%f, fo.tresult[tix]=%f", tix, t, self.second_stage.tresult[tix])
if _debug: self._log.debug("tix=%f, t=%f, fo.tresult[tix]=%f", tix, t, self.second_stage.tresult[tix])
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("args: %s", str(kwargs))
if _debug: self._log.debug("args: %s", str(kwargs))
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("tix=%f, t=%f, fo.tresult[tix]=%f", tix, t, self.second_stage.tresult[tix])
if _debug: self._log.debug("tix=%f, t=%f, fo.tresult[tix]=%f", tix, t, self.second_stage.tresult[tix])
def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r...
self._log.debug("Executing getfoystart to get initial conditions.")
if _debug: self._log.debug("Executing getfoystart to get initial conditions.")
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
self._log.debug("Executing getfoystart to get initial conditions.")
if _debug: self._log.debug("Executing getfoystart to get initial conditions.")
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
self._log.debug("Opening file " + filename + " to read results.")
if _debug: self._log.debug("Opening file " + filename + " to read results.")
def __init__(self, filename, *args, **kwargs): """Get results from file and instantiate variables. Opens file with handle saved as self._rf. File is closed in __del__""" #Call super class __init__ method super(ModelWrapper, self).__init__(*args, **kwargs) #Check file exists if not os.path.isfile(filename): raise IOErr...
self._log.debug("First order file does not have a source term.")
if _debug: self._log.debug("First order file does not have a source term.")
def __init__(self, filename, *args, **kwargs): """Get results from file and instantiate variables. Opens file with handle saved as self._rf. File is closed in __del__""" #Call super class __init__ method super(ModelWrapper, self).__init__(*args, **kwargs) #Check file exists if not os.path.isfile(filename): raise IOErr...
self._log.debug("Trying to get background results...")
if _debug: self._log.debug("Trying to get background results...")
def __init__(self, filename, *args, **kwargs): """Get results from file and instantiate variables. Opens file with handle saved as self._rf. File is closed in __del__""" #Call super class __init__ method super(ModelWrapper, self).__init__(*args, **kwargs) #Check file exists if not os.path.isfile(filename): raise IOErr...
self._log.debug("Calculating self.bgepsilon...")
if _debug: self._log.debug("Calculating self.bgepsilon...")
def __init__(self, filename, *args, **kwargs): """Get results from file and instantiate variables. Opens file with handle saved as self._rf. File is closed in __del__""" #Call super class __init__ method super(ModelWrapper, self).__init__(*args, **kwargs) #Check file exists if not os.path.isfile(filename): raise IOErr...
self._log.debug("Trying to close file...")
if _debug: self._log.debug("Trying to close file...")
def __del__(self): """Close file when object destroyed.""" try: self._log.debug("Trying to close file...") self._rf.close() except IOError: raise
self._log.debug("Trying to set source term for second order model...")
if _debug: self._log.debug("Trying to set source term for second order model...")
def __init__(self, *args, **kwargs): """Initialize variables and call super class __init__ method.""" super(SOCanonicalThreeStage, self).__init__(*args, **kwargs) #try to set source term self._log.debug("Trying to set source term for second order model...") self.source = self.second_stage.source[:] if self.source is No...
self._log.debug("Executing getfoystart to get initial conditions.")
if _debug: self._log.debug("Executing getfoystart to get initial conditions.")
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
self._log.debug("Executing getfoystart to get initial conditions.")
if _debug: self._log.debug("Executing getfoystart to get initial conditions.")
def getfoystart(self, ts=None, tsix=None): """Model dependent setting of ystart""" self._log.debug("Executing getfoystart to get initial conditions.") #Set variables in standard case: if ts is None or tsix is None: ts, tsix = self.fotstart, self.fotstartindex #Reset starting conditions at new time foystart = np.zeros(...
J_A = self.J_A(self.k, alpha, C1, C2) J_B = self.J_B(self.k, alpha, C3, C4) J_C = self.J_C(self.k, alpha, beta, C5) J_D = self.J_D(self.k, alpha, beta, C6, C7)
J_A = self.J_A(k, alpha, C1, C2) J_B = self.J_B(k, alpha, C3, C4) J_C = self.J_C(k, alpha, beta, C5) J_D = self.J_D(k, alpha, beta, C6, C7)
def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background...