-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEFTfunctions.py
79 lines (41 loc) · 1.69 KB
/
EFTfunctions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Michele Mancarella <[email protected]>
#
# All rights reserved. Use of this source code is governed by the
# license that can be found in the LICENSE file.
### Logic for parametrizing EFT functions
import numpy as np
def Gamma(Om, Om0):
return (1-Om)/(1-Om0)
def time_evol(param, Om, Or, Om0, Or0 ): #xx, xin):
return (1-Om-Or)/(1-Om0-Or0)*param
def regulator(vals, tol):
is_scalar=False
if np.isscalar(vals):
is_scalar=True
vals = np.array([vals,])
to_reg = ( np.abs(vals)<=tol)
vals[ to_reg ] = np.zeros(to_reg.sum())
if not is_scalar:
return vals
else:
return vals[0]
#################################################################################
class EFTfunBetaGamma(object):
def __init__(self, alphaM0, alphaB0, betagamma, csign=1, tol=1e-15):
raise NotImplementedError()
################################################################################
#################################################################################
class EFTfunGammac(object):
def __init__(self, alphaM0, alphaB0, gammac0, tol=1e-15):
self.alphaM0 = alphaM0
self.alphaB0 = alphaB0
self.gammac0 = gammac0
self.tol=tol
def alphaM(self, x, Om, Or, Om0, Or0):
return time_evol(self.alphaM0, Om, Or, Om0, Or0)
def alphaB(self, x, Om, Or, Om0, Or0):
return time_evol(self.alphaB0, Om, Or,Om0, Or0)
def gammac(self, x, Om, Or, Om0, Or0):
return time_evol(self.gammac0, Om, Or, Om0, Or0)