def calc_radius_and_epsilon_c(self, EOS, TOV): if TOV not in ['Monica', 'Wolfgang', 'lalsim']: raise ValueError('You have provided a TOV ' 'for which we have no data ' 'and therefore cannot ' 'calculate the radius.') if EOS not in get_eos_list(TOV): raise ValueError('You have provided a EOS ' 'for which we have no data ' 'and therefore cannot ' 'calculate the radius.') if TOV == 'Monica': import gwemlightcurves.EOS.TOV.Monica.MonotonicSpline as ms import gwemlightcurves.EOS.TOV.Monica.eos_tools as et import numpy as np MassRadiusBaryMassTable = Table.read(find_executable(EOS + '_mr.dat'), format='ascii') radius_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius']) energy_density_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], np.log10(MassRadiusBaryMassTable['rho_c'])) # after obtaining the radius_of_mass constants we now can either take values directly from table or use pre calculated spline to extrapolate the values # also radius is in km in table. need to convert to SI (i.e. meters) self['r1'] = et.values_from_table( self['m1'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 self['r2'] = et.values_from_table( self['m2'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 self['eps01'] = 10**(et.values_from_table( self['m1'], MassRadiusBaryMassTable['mass'], np.log10(MassRadiusBaryMassTable['rho_c']), energy_density_of_mass_const)) self['eps02'] = 10**(et.values_from_table( self['m2'], MassRadiusBaryMassTable['mass'], np.log10(MassRadiusBaryMassTable['rho_c']), energy_density_of_mass_const)) return self
def get_eps(EOS, mass): MassRadiusBaryMassTable = Table.read(find_executable(EOS + '_mr.dat'), format='ascii') energy_density_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], np.log10(MassRadiusBaryMassTable['rho_c'])) eps = 10**(et.values_from_table(mass, MassRadiusBaryMassTable['mass'], np.log10(MassRadiusBaryMassTable['rho_c']), energy_density_of_mass_const)) return eps
def calc_radius(self, EOS, TOV, polytrope=False): """ """ if TOV not in ['Monica', 'Wolfgang', 'lalsim']: raise ValueError('You have provided a TOV ' 'for which we have no data ' 'and therefore cannot ' 'calculate the radius.') if EOS not in get_eos_list(TOV): raise ValueError('You have provided a EOS ' 'for which we have no data ' 'and therefore cannot ' 'calculate the radius.') if TOV == 'Monica': import gwemlightcurves.EOS.TOV.Monica.MonotonicSpline as ms import gwemlightcurves.EOS.TOV.Monica.eos_tools as et MassRadiusBaryMassTable = Table.read(find_executable(EOS + '_mr.dat'), format='ascii') radius_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius']) # after obtaining the radius_of_mass constants we now can either take values directly from table or use pre calculated spline to extrapolate the values # also radius is in km in table. need to convert to SI (i.e. meters) self['r1'] = et.values_from_table( self['m1'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 self['r2'] = et.values_from_table( self['m2'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 elif TOV == 'Wolfgang': import gwemlightcurves.EOS.TOV.Monica.MonotonicSpline as ms import gwemlightcurves.EOS.TOV.Monica.eos_tools as et try: import lal G = lal.G_SI c = lal.C_SI msun = lal.MSUN_SI except: import astropy.units as u import astropy.constants as C G = C.G.value c = C.c.value msun = u.M_sun.to(u.kg) MassRadiusBaryMassTable = Table.read(find_executable(EOS + '.tidal.seq'), format='ascii') radius_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['Circumferential_radius']) unit_conversion = (msun * G / c**2) self['r1'] = et.values_from_table( self['m1'], MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['Circumferential_radius'], radius_of_mass_const) * unit_conversion self['r2'] = et.values_from_table( self['m2'], MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['Circumferential_radius'], radius_of_mass_const) * unit_conversion elif TOV == 'lalsim': import lalsimulation as lalsim if polytrope == True: try: import lal G = lal.G_SI c = lal.C_SI msun = lal.MSUN_SI except: import astropy.units as u import astropy.constants as C G = C.G.value c = C.c.value msun = u.M_sun.to(u.kg) ns_eos, eos_fam = construct_eos_from_polytrope(EOS) self['r1'] = lalsim.SimNeutronStarRadius( self['m1'] * msun, eos_fam) self['r2'] = lalsim.SimNeutronStarRadius( self['m2'] * msun, eos_fam) else: MassRadiusBaryMassTable = Table.read( find_executable(EOS + '_lalsim_mr.dat'), format='ascii') radius_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius']) # after obtaining the radius_of_mass constants we now can either take values directly from table or use pre calculated spline to extrapolate the values # also radius is in km in table. need to convert to SI (i.e. meters) self['r1'] = et.values_from_table( self['m1'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 self['r2'] = et.values_from_table( self['m2'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['radius'], radius_of_mass_const) * 10**3 return self
def calc_baryonic_mass(self, EOS, TOV, fit=False): """ if fit=True then the fit from Equation to relate EOS and neutron star mass to Baryonic mass Eq 8: https://arxiv.org/pdf/1708.07714.pdf """ if fit: self["mb1"] = EOSfit(self["m1"], self["c1"]) self["mb2"] = EOSfit(self["m2"], self["c2"]) return self if TOV not in ['Monica', 'Wolfgang']: raise ValueError('You have provided a TOV ' 'for which we have no data ' 'and therefore cannot ' 'calculate the Baryonic mass.') if EOS not in get_eos_list(TOV): raise ValueError('You have provided a EOS ' 'for which we have no data ' 'and therefore cannot ' 'calculate the Baryonic mass.') if TOV == 'Monica': import gwemlightcurves.EOS.TOV.Monica.MonotonicSpline as ms import gwemlightcurves.EOS.TOV.Monica.eos_tools as et MassRadiusBaryMassTable = Table.read(find_executable(EOS + '_mr.dat'), format='ascii') baryonic_mass_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['mb']) # after obtaining the baryonic_mass_of_mass constants we now can either take values directly from table or use pre calculated spline to extrapolate the values self['mb1'] = et.values_from_table(self['m1'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['mb'], baryonic_mass_of_mass_const) self['mb2'] = et.values_from_table(self['m2'], MassRadiusBaryMassTable['mass'], MassRadiusBaryMassTable['mb'], baryonic_mass_of_mass_const) if TOV == 'Wolfgang': import gwemlightcurves.EOS.TOV.Monica.MonotonicSpline as ms import gwemlightcurves.EOS.TOV.Monica.eos_tools as et MassRadiusBaryMassTable = Table.read(find_executable(EOS + '.tidal.seq'), format='ascii') baryonic_mass_of_mass_const = ms.interpolate( MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['baryonic_mass']) # after obtaining the baryonic_mass_of_mass constants we now can either take values directly from table or use pre calculated spline to extrapolate the values self['mb1'] = et.values_from_table( self['m1'], MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['baryonic_mass'], baryonic_mass_of_mass_const) self['mb2'] = et.values_from_table( self['m2'], MassRadiusBaryMassTable['grav_mass'], MassRadiusBaryMassTable['baryonic_mass'], baryonic_mass_of_mass_const) return self