def eval_speed_of_sound(self, p):
     if isinstance(p, list) or isinstance(p, np.ndarray):
         cs = np.zeros(len(p))
         for i, pres in enumerate(p):
             try:
                 h = lalsim.SimNeutronStarEOSPseudoEnthalpyOfPressure(pres, self.eos)
                 cs[i] = lalsim.SimNeutronStarEOSSpeedOfSound(h, self.eos)
             except:
                 print(pres, "failed to produce a valid sound speed")
                 break
     else:
         cs  = lalsim.SimNeutronStarEOSSpeedOfSound(p, self.eos)
     return cs
Exemplo n.º 2
0
 def is_causal(self):
     p_max = lalsim.SimNeutronStarEOSMaxPressure(self.eos)
     c_s_max = lalsim.SimNeutronStarEOSSpeedOfSound(
         lalsim.SimNeutronStarEOSPseudoEnthalpyOfPressure(p_max, self.eos),
         self.eos)
     return c_s_max < c / 100 * 1.1  # Conversion from cgs to SI (leave some leeway like in 1805.11217)