Skip to content
Snippets Groups Projects

Resolve "parameterized eos sampling"

Merged Matthew Carney requested to merge matthew.carney/bilby:369-eos-sampling into master
4 files
+ 51
18
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 12
11
@@ -295,9 +295,17 @@ class TabularEOS(EOS):
plt.show()
def spectral_adiabatic_index(gammas, x):
arg = 0
for i in range(len(gammas)):
arg += gammas[i] * x ** i
return np.exp(arg)
class SpectralDecompositionEOS(TabularEOS):
def __init__(self, gammas, p0, e0, xmax, npts=100):
def __init__(self, gammas, p0=3.01e33, e0=2.03e14, xmax=8, npts=100):
"""
Parameterized EOS using a spectral
decomposition per Lindblom
@@ -311,7 +319,7 @@ class SpectralDecompositionEOS(TabularEOS):
spaces.
priors: See superclass.
p0: float
lowest pressure value in EoS in cgs units.
lowest pressure value in EoS in cgs units. Default is p0 for SLy from Lindblom paper
e0: float
lowest energy density value in EoS. FIXME: the input param is actually e0/c**2
xmax: float
@@ -332,16 +340,9 @@ class SpectralDecompositionEOS(TabularEOS):
self.e_of_p = self.__construct_e_of_p_table()
super().__init__(self.e_of_p, from_array=True)
def adiabatic_index(self, x):
arg = 0
for i in range(len(self.gammas)):
arg += self.gammas[i] * x ** i
return np.exp(arg)
def __mu_integrand(self, x):
return 1. / self.adiabatic_index(x)
return 1. / spectral_adiabatic_index(self.gammas, x)
def mu(self, x):
@@ -349,7 +350,7 @@ class SpectralDecompositionEOS(TabularEOS):
def __eps_integrand(self, x):
return np.exp(x) * self.mu(x) / self.adiabatic_index(x)
return np.exp(x) * self.mu(x) / spectral_adiabatic_index(self.gammas, x)
def energy_density(self, x, eps0):
Loading