Esempio n. 1
0
def bound_lower(m1, m2, pressure1, ofmaxmass):
    pressure2 = 100  #trivial parameter
    pressure_trans = pressure1
    gamma1 = np.log(pressure1 / pressure0) / np.log(
        baryon_density1 / baryon_density0)
    pressure_s = pressure1 * (baryon_density_s / baryon_density1)**gamma1
    pressure_trans = pressure_s
    det_density = 0
    eos_args = [
        baryon_density0, pressure1, baryon_density1, pressure2,
        baryon_density2, pressure3, baryon_density3, pressure_trans
    ]
    cs2 = cs2_ofmaxmass(ofmaxmass, 0.25, 1., Maxmass, Preset_Pressure_final,
                        Preset_rtol, eos_args)
    args = [
        baryon_density0, pressure1, baryon_density1, pressure2,
        baryon_density2, pressure3, baryon_density3, pressure_trans,
        det_density, cs2
    ]
    a = EOS_BPSwithPolyCSS(args)
    tidal1 = Properity_ofmass(
        m1, pressure_trans + 1,
        Maxmass(Preset_Pressure_final, Preset_rtol, a)[1],
        MassRadius_transition, Preset_Pressure_final, Preset_rtol, 1, a)[7]
    tidal2 = Properity_ofmass(
        m2, pressure_trans + 1,
        Maxmass(Preset_Pressure_final, Preset_rtol, a)[1],
        MassRadius_transition, Preset_Pressure_final, Preset_rtol, 1, a)[7]
    return tidal1, tidal2, args
Esempio n. 2
0
def get_bound_lower(m1, m2, eos_lower_bound):
    tidal1 = Properity_ofmass(m1, 10., 1000., MassRadius,
                              Preset_Pressure_final, Preset_rtol, 1,
                              eos_lower_bound)[7]
    tidal2 = Properity_ofmass(m2, 10., 1000., MassRadius,
                              Preset_Pressure_final, Preset_rtol, 1,
                              eos_lower_bound)[7]
    return tidal1, tidal2, eos_lower_bound.args
Esempio n. 3
0
def Calculation_one(eos_i):
    try:
        Properity_one = Properity_ofmass(1.0, 10., eos_i.pc_max, MassRadius,
                                         Preset_Pressure_final, Preset_rtol, 1,
                                         eos_i)
    except:
        Properity_one = Properity_ofmass(1.0, 1., eos_i.pc_max, MassRadius,
                                         Preset_Pressure_final, Preset_rtol, 1,
                                         eos_i)
    return Properity_one
Esempio n. 4
0
def bound_lower_with_args(m1, m2, pressure1, args):
    gamma1 = np.log(pressure1 / pressure0) / np.log(
        baryon_density1 / baryon_density0)
    pressure_s = pressure1 * (baryon_density_s / baryon_density1)**gamma1
    pressure_trans = pressure_s
    a = EOS_BPSwithPolyCSS(args)
    tidal1 = Properity_ofmass(
        m1, pressure_trans + 1,
        Maxmass(Preset_Pressure_final, Preset_rtol, a)[1],
        MassRadius_transition, Preset_Pressure_final, Preset_rtol, 1, a)[7]
    tidal2 = Properity_ofmass(
        m2, pressure_trans + 1,
        Maxmass(Preset_Pressure_final, Preset_rtol, a)[1],
        MassRadius_transition, Preset_Pressure_final, Preset_rtol, 1, a)[7]
    return tidal1, tidal2, args
Esempio n. 5
0
def Calculation_onepointfour(args_list, i):
    eos = args_list[:, 0]
    maxmass_result = args_list[:, 1]
    Properity_onepointfour = Properity_ofmass(1.4, 10, maxmass_result[i][0],
                                              MassRadius,
                                              Preset_Pressure_final,
                                              Preset_rtol, 1, eos[i])
    return Properity_onepointfour
Esempio n. 6
0
def bound_upper(pressure1, m1, m2):
    #pressure2,pressure3,pressure_center_maxmass = p2p3_ofmaxmass(ofmaxmass,105,Maxmass,Preset_Pressure_final,Preset_rtol,pressure1)
    pressure2 = func(pressure1, *fit_result_p2[0])
    pressure3 = func(pressure1, *fit_result_p3[0])
    #pressure_center_maxmass=func(pressure1,*fit_result_pc_maxmass[0])
    args = [
        baryon_density0, pressure1, baryon_density1, pressure2,
        baryon_density2, pressure3, baryon_density3
    ]
    a = EOS_BPSwithPoly(args)
    print pressure1, pressure3, m1, m2
    tidal1 = Properity_ofmass(m1, 0.5 * pressure1, pressure3, MassRadius,
                              Preset_Pressure_final, Preset_rtol, 1, a)[7]
    tidal2 = Properity_ofmass(m2, 0.5 * pressure1, pressure3, MassRadius,
                              Preset_Pressure_final, Preset_rtol, 1, a)[7]
    print pressure1, tidal1 / tidal2
    return tidal1 / tidal2, tidal1, tidal2, args
Esempio n. 7
0
def beta6lambda_ofmass(p1,ofmass):
    eos=EOS_BPSwithPoly([baryon_density0,
      p1,
      baryon_density1,
      func(p1,*fit_result_p2[0]),
      baryon_density2,
      func(p1,*fit_result_p3[0]),
      baryon_density3])
    ofmass_result=Properity_ofmass(ofmass,p1,func(p1,*fit_result_pc_maxmass[0]),MassRadius,Preset_Pressure_final,Preset_rtol,1.0,eos)
    print p1,(ofmass_result[3])**6*ofmass_result[7]
    return (ofmass_result[3])**6*ofmass_result[7]
Esempio n. 8
0
def Calculation(x):
    eos=config.eos_config(parameter[x].args)
    warnings.filterwarnings('error')
    MaximumMass_pressure_center=parameter[x].properity[1]
    if(Calculation_mode=='hybrid'):
        for i in range(np.size(ofmass_array)):
            try:
                if(parameter[x].properity[35]==0):
                    processOutput_ofmass=Properity_ofmass(ofmass_array[i],config.Preset_pressure_center_low,MaximumMass_pressure_center,config.eos_MassRadius,config.Preset_Pressure_final,Preset_rtol,config.Preset_Pressure_final_index,eos)
                    if(processOutput_ofmass[0]<parameter[x].args[7]):
                        parameter[x].add_star([0]+processOutput_ofmass)
                    else:
                        parameter[x].add_star([1]+processOutput_ofmass)
                else:
                    processOutput_ofmass,processOutput_ofmass_quark = Properity_ofmass_two_peak(ofmass_array[i],config.Preset_pressure_center_low,parameter[x].properity[19],parameter[x].properity[35],parameter[x].properity[27],config.eos_MassRadius,config.Preset_Pressure_final,Preset_rtol,config.Preset_Pressure_final_index,eos,f_log_name)
                    if(processOutput_ofmass_quark[0]==0):
                        if(processOutput_ofmass[0]<parameter[x].args[7]):
                            parameter[x].add_star([0]+processOutput_ofmass)
                        else:
                            parameter[x].add_star([1]+processOutput_ofmass)
                    else:
                        parameter[x].add_star([3]+processOutput_ofmass_quark)
    
            except RuntimeWarning:
                print('Runtimewarning happens at OfMass: '+str(ofmass_array[i]))
                print('parameter[%d]'%x)
                print(parameter[x].args)
                print(parameter[x].properity[19],parameter[x].properity[35],parameter[x].properity[27])
    elif(Calculation_mode=='hadronic'):
        for i in range(np.size(ofmass_array)):
            try:
                processOutput_ofmass=Properity_ofmass(ofmass_array[i],config.Preset_pressure_center_low,MaximumMass_pressure_center,config.eos_MassRadius,config.Preset_Pressure_final,Preset_rtol,config.Preset_Pressure_final_index,eos)
                print processOutput_ofmass
                parameter[x].add_star([0]+processOutput_ofmass)
            except RuntimeWarning:
                print('Runtimewarning happens at OfMass: '+str(ofmass_array[i]))
                print('parameter[%d]'%x)
                print(parameter[x].args)
    return parameter[x]
Esempio n. 9
0
def bound_upper(m1, m2, pressure1, ofmaxmass):
    cs2 = 1.
    pressure_trans, tidal2, pressure2 = np.array(
        Properity_ofmass_at_transition(m2, 1, 1000, MassRadius,
                                       Preset_Pressure_final, Preset_rtol,
                                       1))[[0, 7, 8]]
    eos_args = [
        baryon_density0, pressure1, baryon_density1, pressure2,
        baryon_density2, pressure3, baryon_density3, pressure_trans
    ]
    det_density = det_density_ofmaxmass(ofmaxmass, 0, 1000, Maxmass,
                                        Preset_Pressure_final, Preset_rtol,
                                        eos_args)
    args = [
        baryon_density0, pressure1, baryon_density1, pressure2,
        baryon_density2, pressure3, baryon_density3, pressure_trans,
        det_density, cs2
    ]
    a = EOS_BPSwithPolyCSS(args)
    tidal1 = Properity_ofmass(
        m1, pressure_trans + 1,
        Maxmass(Preset_Pressure_final, Preset_rtol, a)[1],
        MassRadius_transition, Preset_Pressure_final, Preset_rtol, 1, a)[7]
    return tidal1, tidal2, args
Esempio n. 10
0
lower_bound_pc_maxmass=[891.94617460746917,823.54374309717764,764.7251041526473,721.2344048234047,690.03631320222746]
for i in range(5):
    f=open('./hadronic_upper_bound_p1_p2p3pc_fit_result_2.%d.dat'%i,'rb')
    fit_result_p2,fit_result_p3,fit_result_pc_maxmass=pickle.load(f)
    f.close()
    minimize_result=opt.minimize(beta6lambda_ofmass,20.,args=(1.6,),tol=1e-03,method='Nelder-Mead')
    lower_bound_p1.append(minimize_result.x[0])
    lower_bound_p2.append(func(minimize_result.x[0],*fit_result_p2[0]))
    lower_bound_p3.append(func(minimize_result.x[0],*fit_result_p3[0]))
    lower_bound_pc_maxmass.append(func(minimize_result.x[0],*fit_result_pc_maxmass[0]))
    
lower_bound_beta_one_point_four=[]
eos_lower_bound=[]
for i in range(len(lower_bound_p1)):
    eos_lower_bound.append(EOS_BPSwithPoly([baryon_density0,lower_bound_p1[i],baryon_density1,lower_bound_p2[i],baryon_density2,lower_bound_p3[i],baryon_density3]))
    ofmass_result=Properity_ofmass(1.4,lower_bound_p1[i],lower_bound_pc_maxmass[i],MassRadius,Preset_Pressure_final,Preset_rtol,1.0,eos_lower_bound[i])
    lower_bound_beta_one_point_four.append(ofmass_result[3])

upper_bound_p1=[3.74,4.06,7.51,8.4,12.49,30.]
upper_bound_p2=[141.46621614222298,144.76149521439103,174.46951849156656,181.0373156703981,208.09475251740099,298.98747443548757]
upper_bound_p3=[958.1,978.46880147527577,1161.897025044974,1203.2,1368.7681496008929,1949.2]
upper_bound_pc_maxmass=[826.751708984375,819.36279296875,764.66796875,753.30078125,717.2314453125,597.7783203125]
upper_bound_beta_one_point_four=[]
eos_upper_bound=[]
for i in range(len(upper_bound_p1)):
    eos_upper_bound.append(EOS_BPSwithPoly([baryon_density0,upper_bound_p1[i],baryon_density1,upper_bound_p2[i],baryon_density2,upper_bound_p3[i],baryon_density3]))
    ofmass_result=Properity_ofmass(1.4,upper_bound_p1[i],upper_bound_pc_maxmass[i],MassRadius,Preset_Pressure_final,Preset_rtol,1.0,eos_upper_bound[i])
    upper_bound_beta_one_point_four.append(ofmass_result[3])

pc_list=10**np.linspace(0,-1.5,20)
beta=[]
Esempio n. 11
0
File: CompOSE.py Progetto: sotzee/ns
#     print(abcd)
#     plt.plot(eos[i].eos_array[1,logic],eos[i].eos_array[2,logic])
#     plt.plot(eos[i].eos_array[1,logic],fitting_f(*([eos[i].eos_array[1,logic]]+list(popt))))
# =============================================================================

from FindMaxmass import Maxmass
from MassRadius_hadronic import MassRadius
from Find_OfMass import Properity_ofmass
MRBIT_LIST=[]
eos_properity=[]
for eos_i in eos:
    #print len(MRBIT_LIST)
    MRBIT_LIST.append([])
    pc_max,maxmass=Maxmass(1e-8,1e-5,eos_i)[1:3]
    print(pc_max,maxmass)
    onepointfour_result=Properity_ofmass(1.4,10,pc_max,MassRadius,1e-8,1e-5,1,eos_i)
    pc_min=Properity_ofmass(1.0,10,pc_max,MassRadius,1e-8,1e-5,1,eos_i)[0]
    pc_min=10
    pc=pc_min*np.exp(np.linspace(0,np.log(pc_max/pc_min),50))
    eos_properity.append([pc_max,maxmass,onepointfour_result[0],onepointfour_result[2],onepointfour_result[7]])
    for pc_i in pc:
        MRBIT_LIST[-1].append(MassRadius(pc_i,1e-8,1e-5,'MRBIT',eos_i))
MRBIT_LIST=np.array(MRBIT_LIST)
eos_properity=np.array(eos_properity)
for i in range(len(eos)):
    plt.plot(MRBIT_LIST[i,:,1],MRBIT_LIST[i,:,0],'.')
    np.savetxt(path+EOS_LIST[i]+'_TOV_result',MRBIT_LIST[i])
    np.savetxt(path+EOS_LIST[i]+'_EOS_data',eos[i].eos_array.transpose())
plt.xlabel('radius(km)')
plt.ylabel('mass($M_\odot$)')