コード例 #1
0
def stable_final_data_BPSwithPolyCSS(final_data):
    stable_parameter = []
    for i in range(final_data.N):
        eos = EOS_BPSwithPoly(final_data.parameter[i].args[0:7])
        pressure_trans = final_data.parameter[i].args[7]
        det_density = final_data.parameter[i].args[8]
        cs2 = final_data.parameter[i].args[9]
        density_trans = eos.eosDensity(pressure_trans)
        baryondensity_trans = eos.eosBaryonDensity(pressure_trans)
        chempo = (density_trans + pressure_trans) / baryondensity_trans
        if (1 - cs2 - 4. * A0 * ((chempo / m0)**2 - 1)**2.5 /
            (45 * chempo *
             (density_trans + det_density + pressure_trans) / m0) > 0):
            stable_parameter.append(final_data.parameter[i])
    return final_data_BPSwithPolyCSS(stable_parameter)
コード例 #2
0
class EOS_SLY4withRMF(object):
    def __init__(self,init_args,init_sat,args):
        self.baryon_density_sat,self.bd_energy,self.incompressibility,\
        self.m_eff,self.J,self.L,self.self_W,self.mass_args=args
        self.args=args
        self.eos_RMF=EOS_RMF(init_args,init_sat,args)
        self.eos_args=self.eos_RMF.eos_args
        self.init_sat=self.eos_RMF.init_sat
        self.eos_array=self.eos_RMF.eos_array
        self.sol_saturation=toMevfm(np.array(self.eos_RMF.sol_saturation),'mev4')
        fix_crust_baryon_density=np.linspace(0.6,0.3,4)*self.sol_saturation[0]
        self.fix_crust_logic=False
        for fix_crust_baryon_density_i in fix_crust_baryon_density:
            if(self.sol_saturation[2]>1.1*EOS_BPS.eosPressure_frombaryon(fix_crust_baryon_density_i)):
                self.eos_SLY4withPoly=EOS_BPSwithPoly([fix_crust_baryon_density_i,self.sol_saturation[2],self.sol_saturation[0],4*self.sol_saturation[2],2*self.sol_saturation[0],8*self.sol_saturation[2],3*self.sol_saturation[0]])
                self.fix_crust_logic=True
                break
            
        self.stability=self.eos_RMF.stability
        self.positive_pressure=self.eos_RMF.positive_pressure
        self.baryon_density_s=self.eos_RMF.baryon_density_s
        self.pressure_s=self.eos_RMF.pressure_s
        self.density_s=self.eos_RMF.density_s
        self.unit_mass=self.eos_RMF.unit_mass
        self.unit_radius=self.eos_RMF.unit_radius
        self.unit_N=self.eos_RMF.unit_N
    def __getstate__(self):
        state_RMF=self.eos_RMF.__getstate__()
        state = self.__dict__.copy()
        return (state,state_RMF)
    def __setstate__(self, state_):
        state,state_RMF=state_
        self.__dict__.update(state)
        self.eos_RMF.__setstate__(state_RMF)
    def eosDensity(self,pressure):
        return np.where(pressure<self.sol_saturation[2],self.eos_SLY4withPoly.eosDensity(pressure),self.eos_RMF.eosDensity(pressure))
    def eosBaryonDensity(self,pressure):
        return np.where(pressure<self.sol_saturation[2],self.eos_SLY4withPoly.eosBaryonDensity(pressure),self.eos_RMF.eosBaryonDensity(pressure))
    def setMaxmass(self,result_maxmaxmass):
        self.pc_max,self.mass_max,self.cs2_max=result_maxmaxmass
    def eosCs2(self,pressure):
        return 1.0/derivative(self.eosDensity,pressure,dx=pressure*dlnx_cs2)
    def eosChempo(self,pressure):
        return (pressure+self.eosDensity(pressure))/self.eosBaryonDensity(pressure)
コード例 #3
0
    def __init__(self, parameter):
        self.parameter = parameter
        self.N = np.size(parameter)
        args_matrix = list()
        properity_matrix = list()
        stars_type0 = list()
        stars_type1 = list()
        stars_type2 = list()
        stars_type3 = list()
        binaries_matrix = list()
        tidal_binary_matrix = list()
        density_trans = list()
        baryondensity_trans = list()
        gamma2 = list()
        for i in range(self.N):
            eos = EOS_BPSwithPoly(parameter[i].args[0:7])
            gamma2.append(eos.eosPiecewisePoly.gamma2)
            if (len(parameter[0].args) > 7):
                density_trans.append(eos.eosDensity(parameter[i].args[7]))
                baryondensity_trans.append(
                    eos.eosBaryonDensity(parameter[i].args[7]))
            else:
                density_trans = []
                baryondensity_trans = []
            tidal_binary_matrix.append([
                parameter[i].stars[0][-1], parameter[i].stars[1][-1],
                parameter[i].stars[2][-1], parameter[i].stars[3][-1],
                parameter[i].stars[4][-1]
            ])
            args_matrix.append(parameter[i].args)
            properity_matrix.append(parameter[i].properity)
            for j in range(np.size(parameter[i].stars) / 9 - 5):
                if (parameter[i].stars[j + 5][0] == 0):
                    stars_type0.append(parameter[i].stars[j + 5])
                if (parameter[i].stars[j + 5][0] == 1):
                    stars_type1.append(parameter[i].stars[j + 5])
                if (parameter[i].stars[j + 5][0] == 2):
                    stars_type2.append(parameter[i].stars[j + 5])
                if (parameter[i].stars[j + 5][0] == 3):
                    stars_type3.append(parameter[i].stars[j + 5])
            binaries_matrix += parameter[i].binaries

        args_matrix = np.array(args_matrix)
        self.args_matrix = args_matrix.transpose()
        properity_matrix = np.array(properity_matrix)
        self.properity_matrix = properity_matrix.transpose()
        binaries_matrix = np.array(binaries_matrix)
        self.binaries_matrix = binaries_matrix.transpose()

        stars_type0 = np.array(stars_type0)
        self.stars_type0 = stars_type0.transpose()
        stars_type1 = np.array(stars_type1)
        self.stars_type1 = stars_type1.transpose()
        stars_type2 = np.array(stars_type2)
        self.stars_type2 = stars_type2.transpose()
        stars_type3 = np.array(stars_type3)
        self.stars_type3 = stars_type3.transpose()

        tidal_binary_matrix = np.array(tidal_binary_matrix)
        tidal_binary_matrix = tidal_binary_matrix.transpose()
        self.density_trans = np.array(density_trans)
        self.baryondensity_trans = np.array(baryondensity_trans)
        self.gamma2 = np.array(gamma2)
        if (self.N > 0):
            self.tidal_binary1 = tidal_binary(1.364653646, 1.364653646,
                                              tidal_binary_matrix[2],
                                              tidal_binary_matrix[2])
            self.tidal_binary2 = tidal_binary(1.243697915, 1.5,
                                              tidal_binary_matrix[1],
                                              tidal_binary_matrix[3])
            self.tidal_binary3 = tidal_binary(1.049578992, 1.8,
                                              tidal_binary_matrix[0],
                                              tidal_binary_matrix[4])
            tidal_binay123 = np.array(
                [self.tidal_binary1, self.tidal_binary2, self.tidal_binary3])
            self.tidal_binary_max = tidal_binay123.max(0)
            self.tidal_binary_min = tidal_binay123.min(0)
            self.pressure2 = self.args_matrix[3]
            self.Maximum_mass = self.properity_matrix[2]
            if (len(parameter[0].args) > 7):
                self.pressure_trans = self.args_matrix[7]
                self.det_density = self.args_matrix[8]
                [
                    self.R_opf_quark, self.beta_opf_quark,
                    self.M_binding_opf_quark, self.momentofinertia_opf_quark,
                    self.yR_opf_quark, self.tidal_opf_quark
                ] = self.properity_matrix[13:19]
            else:
                self.pressure_trans = []
                self.det_density = []
                [
                    self.R_opf_quark, self.beta_opf_quark,
                    self.M_binding_opf_quark, self.momentofinertia_opf_quark,
                    self.yR_opf_quark, self.tidal_opf_quark
                ] = [[], [], [], [], [], []]
                [
                    self.R_opf_quark, self.beta_opf_quark,
                    self.M_binding_opf_quark, self.momentofinertia_opf_quark,
                    self.yR_opf_quark, self.tidal_opf_quark
                ] = [[], [], [], [], [], []]

        else:
            self.tidal_binary1 = []
            self.tidal_binary2 = []
            self.tidal_binary3 = []
            self.tidal_binary_max = []
            self.tidal_binary_min = []
            self.pressure2 = []
            self.pressure_trans = []
            self.det_density = []
            self.Maximum_mass = []
            [
                self.R_opf, self.beta_opf, self.M_binding_opf,
                self.momentofinertia_opf, self.yR_opf, self.tidal_opf
            ] = [[], [], [], [], [], []]
            [
                self.R_opf_quark, self.beta_opf_quark,
                self.M_binding_opf_quark, self.momentofinertia_opf_quark,
                self.yR_opf_quark, self.tidal_opf_quark
            ] = [[], [], [], [], [], []]