def plotMOut(config): config_section_name = 'M_OUT' binary_par = {} binary_par["theta_i_deg"]=float(config[config_section_name]['theta_i_deg']) binary_par["EOS"]=config[config_section_name]['EOS'] binary_par["chi_ns"]=float(config[config_section_name]['chi_ns']) binary_par["m_ns"]=float(config[config_section_name]['m_ns']) q_min=float(config[config_section_name]['q_min']) q_max=float(config[config_section_name]['q_max']) q = np.linspace(q_min, q_max, 5*(q_max-q_min+1)) chi_bh_min=float(config[config_section_name]['chi_bh_min']) chi_bh_max=float(config[config_section_name]['chi_bh_max']) chi_bh = np.linspace(chi_bh_min, chi_bh_max, 10*(chi_bh_max-chi_bh_min)+1) binary_par["type"]=config[config_section_name]['type'] plt.rcParams['xtick.top'] = plt.rcParams['xtick.labeltop'] = True plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True for j in range(len(chi_bh)): m_out_arr = [] binary_par['chi_bh'] = chi_bh[j] for k in range(len(q)): binary_par['q'] = q[k] spin_object = sm.Spin_class(binary_par) m_out = spin_object.M_out() m_out_arr.append(m_out) plt.plot(q, m_out_arr, label=r"$\chi_{BH}:$ %.2f" %chi_bh[j]) plt.legend() plt.title(r"$M_{NS}$ = %.2f $M_{\odot}$, EOS = %s, $\theta_i$ = %d$^{\circ}$"%(binary_par["m_ns"], binary_par["EOS"], binary_par["theta_i_deg"]), y=1.08) plt.xlabel(r"$q$") plt.ylabel(r"$M_{b,out}[M_{\odot}]$") plt.show()
def plotChiF_VarTheta(config): config_section_name = 'CHI_F_VARTHETA' binary_par = {} binary_par["chi_bh"]=float(config[config_section_name]['chi_bh']) binary_par["EOS"]=config[config_section_name]['EOS'] binary_par["chi_ns"]=float(config[config_section_name]['chi_ns']) binary_par["m_ns"]=float(config[config_section_name]['m_ns']) q_min=float(config[config_section_name]['q_min']) q_max=float(config[config_section_name]['q_max']) q = np.linspace(q_min, q_max, 5*(q_max-q_min+1)) theta_i_deg_min=float(config[config_section_name]['theta_i_deg_min']) theta_i_deg_max=float(config[config_section_name]['theta_i_deg_max']) theta_i_deg = np.linspace(theta_i_deg_min, theta_i_deg_max, 9) binary_par["type"]=config[config_section_name]['type'] plt.rcParams['xtick.top'] = plt.rcParams['xtick.labeltop'] = True plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True for j in range(len(theta_i_deg)): chi_f_arr = [] binary_par['theta_i_deg'] = theta_i_deg[j] for k in range(len(q)): binary_par['q'] = q[k] spin_object = sm.Spin_class(binary_par) chi_f, theta_f, m_final, m_out = spin_object.FinalPar() chi_f_arr.append(chi_f) plt.plot(q, chi_f_arr, label= r'$\theta_i:$ %d$^{\circ}$' %theta_i_deg[j]) plt.legend() plt.title(r"$M_{NS}$ = %.2f $M_{\odot}$, EOS = %s, $\chi_{BH}$= %.2f "%(binary_par["m_ns"], binary_par["EOS"], binary_par["chi_bh"]), y=1.08) plt.xlabel(r"$q$") plt.ylabel(r"$\chi_f$") plt.show()
def sigmaMF(config): colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k', 'hotpink', 'olivedrab', 'gray' ] sigma_par = {} config_section_name = 'SIGMA_MF' sigma_par['m_ns'] = float(config[config_section_name]['m_ns']) sigma_par['type'] = config[config_section_name]['type'] sigma_par['theta_i_deg'] = float( config[config_section_name]['theta_i_deg']) sigma_par['EOS'] = config[config_section_name]['EOS'] snr = float(config[config_section_name]['snr']) l = float(config[config_section_name]['l']) m = float(config[config_section_name]['m']) n = float(config[config_section_name]['n']) q_min = float(config[config_section_name]['q_min']) q_max = float(config[config_section_name]['q_max']) q_arr = np.linspace(q_min, q_max, 30) chi_bh_min = float(config[config_section_name]['chi_bh_min']) chi_bh_max = float(config[config_section_name]['chi_bh_max']) chi_bh = np.linspace(chi_bh_min, chi_bh_max, 10) qnm = wf.QNM_fit(l, m, n) plt.rcParams['xtick.top'] = plt.rcParams['xtick.labeltop'] = True plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True for i in range(len(chi_bh)): sigma_par['chi_bh'] = chi_bh[i] m_out_arr = [] err_m_f = [] for j in range(len(q_arr)): sigma_par['q'] = q_arr[j] spin_object = sm.Spin_class(sigma_par) chi_f, theta_f, m_f, m_out = spin_object.FinalPar() f_rd = qnm.f(m_f, chi_f) tau_rd = qnm.tau(m_f, chi_f) sigma_m_f = SigmaMF_Fisher(qnm, f_rd, tau_rd, chi_f, m_f, snr) m_out_arr.append(m_out) err_m_f.append(sigma_m_f) plt.plot(q_arr, err_m_f, color=colors[i % 10], label=r"$\sigma_M$, $\chi_{BH}$:%.1f" % chi_bh[i], linestyle='--') plt.plot(q_arr, m_out_arr, colors[i % 10], label=r"$M_{OUT}$,$\chi_{BH}:%.1f$" % chi_bh[i], linestyle='-') #idx = np.argwhere(np.diff(np.sign(np.array(err_m_f) - np.array(m_out_arr))).flatten() #plt.plot(q_arr[idx], m_out_arr[idx], 'ro') plt.title(r"$M_{NS}$=%.2f, EOS= %s, mode = %d%d%d, SNR = %d" % (sigma_par["m_ns"], sigma_par["EOS"], l, m, n, snr), y=1.08) plt.xlabel(r"$q$") plt.ylabel(r"$[M_{\odot}]$") plt.legend() plt.show()
def sigma_freq(snr, mode1, mode2, binary_par): spin_object = sm.Spin_class(binary_par) a_f, theta_f, m_f, m_out = spin_object.FinalPar() if mode1 == mode2: print("non orthogonal mode") else: l1 = int(mode1[0]) m1 = int(mode1[1]) n1 = int(mode1[2]) l2 = int(mode2[0]) m2 = int(mode2[1]) n2 = int(mode2[2]) # Pair of modes qnm1 = wf.QNM_fit(l1, m1, n1) qnm2 = wf.QNM_fit(l2, m2, n2) f1 = qnm1.f(m_f, a_f) f2 = qnm2.f(m_f, a_f) tau1 = qnm1.tau(m_f, a_f) tau2 = qnm2.tau(m_f, a_f) Q1 = np.pi * f1 * tau1 Q2 = np.pi * f2 * tau2 amplitude_object = am.Amplitude_class(binary_par) switch = { "220": amplitude_object.A22220, "210": amplitude_object.A21210, } A1 = switch[mode1](0) A2 = switch[mode2](0) #print(f1,f2,tau1,tau2,A1,A2, m_f, a_f) sigma = 1./(snr*2*2**(1./2))*(f1**3*(3+16*Q1**4)/(A1**2*Q1**7)*\ (A1**2*Q1**3/(f1*(1+4*Q1**2))+\ A2**2*Q2**3/(f2*(1+4*Q2**2))))**(1./2) sigma = 1. / (2**(1. / 2) * np.pi * tau1 * snr) return sigma
def sigma_tau(snr, mode1, mode2, binary_par): spin_object = sm.Spin_class(binary_par) a_f, theta_f, m_f, m_out = spin_object.FinalPar() if mode1 == mode2: print("Error, non orthogonal modes") else: l1 = int(mode1[0]) m1 = int(mode1[1]) n1 = int(mode1[2]) l2 = int(mode2[0]) m2 = int(mode2[1]) n2 = int(mode2[2]) qnm1 = wf.QNM_fit(l1, m1, n1) qnm2 = wf.QNM_fit(l2, m2, n2) f1 = qnm1.f(m_f, a_f) f2 = qnm2.f(m_f, a_f) tau1 = qnm1.tau(m_f, a_f) tau2 = qnm2.tau(m_f, a_f) Q1 = np.pi * f1 * tau1 Q2 = np.pi * f2 * tau2 amplitude_object = am.Amplitude_class(binary_par) switch = { "220": amplitude_object.A22220, "210": amplitude_object.A21210, } A1 = switch[mode1](0) A2 = switch[mode2](0) sigma = 2./(snr*np.pi)*((3+4*Q1**2)/(A1**2*f1*Q1)*\ (A1**2*Q1**3/(f1*(1+4*Q1**2))+\ A2**2*Q2**3/(f2*(1+4*Q2**2))))**(1./2) sigma = 2. * tau1 / snr return sigma
def __init__(self, iterate=()): self.__dict__.update(iterate) # useful quantities self.eta = self.q / (1 + self.q)**2 self.m_bh = self.q * self.m_ns self.M = self.m_ns + self.m_bh #self.G = 6.67*10**(-8) self.G = lal.G_SI #self.c = 3*10**(10) self.c = lal.C_SI #self.m_sol = 2*10**33 self.m_sol = lal.MSUN_SI self.chi_ns = 0 self.winfact = 1. / 2 # ok=1/2, paper=1 # coefficients for PhenomC model self.gamma = self.xi01[6] * self.chi_bh + self.xi02[ 6] * self.chi_bh**2 + self.xi11[ 6] * self.eta * self.chi_bh + self.xi10[ 6] * self.eta + self.xi20[6] * self.eta**2 self.delta1 = self.xi01[7] * self.chi_bh + self.xi02[ 7] * self.chi_bh**2 + self.xi11[ 7] * self.eta * self.chi_bh + self.xi10[ 7] * self.eta + self.xi20[7] * self.eta**2 self.delta2 = self.xi01[8] * self.chi_bh + self.xi02[ 8] * self.chi_bh**2 + self.xi11[ 8] * self.eta * self.chi_bh + self.xi10[ 8] * self.eta + self.xi20[8] * self.eta**2 # spin section binary_par = { "m_ns": self.m_ns, "q": self.q, "theta_i_deg": self.theta_i_deg, "chi_bh": self.chi_bh, "EOS": self.EOS, "type": self.type } spin_object = sm.Spin_class(binary_par) chi_f, theta_f, m_f, m_out = spin_object.FinalPar() self.chi_f = float(chi_f) self.theta_f = float(theta_f) self.m_f = float(m_f) self.m_out = float(m_out) # Ringdown frequency and damping time # From Arxiv:gr-qc/0512160v2 eq. E1, E2 self.f_220_ringdown = (1.5251 - 1.1568 * (1 - self.chi_f)** (0.1292)) / (2 * np.pi * self.m_f * self.m_sol * self.G / self.c**2) * self.c self.Q_220_ringdown = 0.7 + 1.4187 * (1 - self.chi_f)**(-0.4990) self.tau_220_ringdown = self.Q_220_ringdown / self.f_220_ringdown / np.pi # PhenomC for BBH if self.type == "BBH": self.eps_insp = 1 self.k = 1 self.sigma_tid = 0 self.eps_tid = 1 self.f0_pn = 0.98 * self.f_220_ringdown self.f0_pm = 0.98 * self.f_220_ringdown self.f0_rd = 0.98 * self.f_220_ringdown # PhenomMixed if self.type == "BHNS": print("Total mass outside BH at late times: %.3f" % m_out) m_g, m_b, compactness = np.loadtxt("EOS/equil_{}.d".format( self.EOS), unpack=True) C_from_mg = interp1d(m_g, compactness) self.C = float(C_from_mg(self.m_ns)) mb_from_mg = interp1d(m_g, m_b) self.m_ns_b = float(mb_from_mg(self.m_ns)) xi_tid = fsolve(spin_object.XiTidal, 10) r_tid = xi_tid * (self.m_ns * self.m_sol * self.G / self.c**2) / self.C * (1 - 2 * self.C) #r_tid = self.eta**(-1./3)*(self.m_ns*self.m_sol*self.G/self.c**2)/self.C*(1-2*self.C) # frequencies in Hz self.f_tid = float( 1. / (np.pi * (self.chi_f * self.m_f * self.m_sol * self.G / self.c**2 + (r_tid**3 / (self.m_f * self.m_sol * self.G / self.c**2))**(1. / 2))) * self.c) #print("theta_i_deg", self.theta_i_deg) #print("chi_bh", self.chi_bh) #print("chi_f", self.chi_f) self.f_220_tilde = 0.99 * 0.98 * self.f_220_ringdown self.k = 1.25 if self.x_var == "f": plt.axvline(self.f_220_ringdown, 0.9, 1, color="c") plt.axvline(self.f_tid, 0.9, 1, color="r") if self.x_var == "fm": plt.axvline(self.f_220_ringdown * self.G / self.c**3 * self.M * self.m_sol, 0.9, 1, color="c") plt.axvline(self.f_tid * self.G / self.c**3 * self.M * self.m_sol, 0.9, 1, color="r") if self.eta >= 5. / 36: self.alpha = 1 + self.winfact * self.Windowed_function( self.eta, 0.146872, 0.0749456, -1) if self.eta < 5. / 36: self.alpha = 1 + self.winfact * self.Windowed_function( 5. / 36, 0.146872, 0.0749456, -1) self.delta2prime = self.alpha * self.delta2 # Non disruptive if self.f_220_ringdown <= self.f_tid and self.m_out == 0: print("Case: Non disruptive") self.x_nd1 = ( (self.f_tid - self.f_220_tilde) / self.f_220_tilde )**2 - 0.571505 * self.C - 0.00508451 * self.chi_bh self.x_nd2 = ( (self.f_tid - self.f_220_tilde) / self.f_220_tilde )**2 - 0.657424 * self.C - 0.0259977 * self.chi_bh self.eps_tid = self.winfact * 2 * self.Windowed_function( self.x_nd1, -0.0796251, 0.0801192, 1) self.sigma_tid = self.winfact * 2 * self.Windowed_function( self.x_nd2, -0.206465, 0.226844, -1) / (self.G / self.c**3 * self.M * self.m_sol) #self.delta2prime = 1.62496*self.winfact*self.Windowed_function((self.f_tid-self.f_220_tilde)/self.f_220_tilde, 0.0188092, 0.338737, -1) self.f0_pn = self.f_220_tilde self.f0_pm = self.f_220_tilde self.f0_rd = self.f_220_tilde #print("") #print("f0_pn", self.f0_pn) #print("f0_pm", self.f0_pm) #print("f0_rd", self.f0_rd) #print("eps_tid", self.eps_tid) #print("sigma_tid", self.sigma_tid) #print("delta2prime", self.delta2prime) #print("x_nd", self.x_nd1) #print("") # Disruptive if self.f_tid < self.f_220_ringdown and self.m_out > 0: print("Case: Disruptive") self.x_d1 = self.m_out/self.m_ns_b+0.424912*self.C+\ 0.363604*(self.eta)**(1./2)-0.0605591*self.chi_bh self.x_d2 = self.m_out/self.m_ns_b-0.132754*self.C+\ 0.576669*(self.eta)**(1./2)-0.0603749*self.chi_bh-\ 0.0601185*self.chi_bh**2-0.0729134*self.chi_bh**3 self.esp_tid = 0 self.eps_insp = -1.61724 * self.x_d1 + 1.29971 self.sigma_tid = (-0.293237*self.x_d2+0.1377221)/\ (self.G/self.c**3*self.M*self.m_sol) self.f0_pn = self.eps_insp * self.f_tid self.f0_pm = self.f_tid # Mildly disruptive 1 if self.f_tid < self.f_220_ringdown and self.m_out == 0: print("Case: Midly disruptive, no ringdown, no M outside BH") self.x_d1 = self.m_out/self.m_ns_b+0.424912*self.C+\ 0.363604*(self.eta)**(1./2)-0.0605591*self.chi_bh self.x_d2 = self.m_out/self.m_ns_b-0.132754*self.C+\ 0.576669*(self.eta)**(1./2)-0.0603749*self.chi_bh-\ 0.0601185*self.chi_bh**2-0.0729134*self.chi_bh**3 self.x_nd2 = ( (self.f_tid - self.f_220_tilde) / self.f_220_tilde )**2 - 0.657424 * self.C - 0.0259977 * self.chi_bh self.eps_tid = 0 self.eps_insp = -1.61724 * self.x_d1 + 1.29971 self.sigma_tid_d = (-0.293237*self.x_d2+0.1377221)/\ (self.G/self.c**3*self.M*self.m_sol) self.sigma_tid_nd = self.winfact * 2 * self.Windowed_function( self.x_nd2, -0.206465, 0.226844, -1) / (self.G / self.c**3 * self.M * self.m_sol) self.sigma_tid = (self.sigma_tid_d + self.sigma_tid_nd) / 2. self.f0_pn = (1-self.q**(-1))*self.f_220_tilde+\ self.q**(-1)*self.eps_insp*self.f_tid self.f0_pm = (1-self.q**(-1))*self.f_220_tilde+\ self.q**(-1)*self.f_tid # Mildly disruptive 2 if self.f_220_ringdown <= self.f_tid and self.m_out > 0: print("Case: Mildly diruptive, ringdown, M outside BH") self.x_d1 = self.m_out/self.m_ns_b+0.424912*self.C+\ 0.363604*(self.eta)**(1./2)-0.0605591*self.chi_bh self.x_nd1 = ( (self.f_tid - self.f_220_tilde) / self.f_220_tilde )**2 - 0.571505 * self.C - 0.00508451 * self.chi_bh self.x_nd2 = ( (self.f_tid - self.f_220_tilde) / self.f_220_tilde )**2 - 0.657424 * self.C - 0.0259977 * self.chi_bh self.eps_insp = -1.61724 * self.x_d1 + 1.29971 self.eps_tid = self.winfact * 2 * self.Windowed_function( self.x_nd1, -0.0796251, 0.0801192, 1) self.sigma_tid = self.winfact * 2 * self.Windowed_function( self.x_nd2, -0.206465, 0.226844, -1) / (self.G / self.c**3 * self.M * self.m_sol) #self.delta2prime = 1.62496*self.winfact*self.Windowed_function((self.f_tid-self.f_220_tilde)/self.f_220_tilde, 0.0188092, 0.338737, -1) self.f0_pn = self.eps_insp * self.f_220_tilde self.f0_pm = self.f_220_tilde self.f0_rd = self.f_220_tilde print("Tidal frequency %.2f" % self.f_tid) print("Ringdown frequency: %.2f" % self.f_220_tilde) #print("eps_tid", self.eps_tid) #print("eps_insp", self.eps_insp) #print("m_out", self.m_out) #print("f_tidal", self.f_tid) #print("f_220", self.f_220_tilde) #print("f_220_ring", self.f_220_ringdown) self.d_bbh = 0.015 / (self.G / self.c**3 * self.M * self.m_sol) self.d = self.d_bbh + self.sigma_tid
def ParameterZones(config): config_section_name = 'PARAMETER_ZONES' binary_par = {} binary_par["theta_i_deg"]=float(config[config_section_name]['theta_i_deg']) binary_par["EOS"]=config[config_section_name]['EOS'] binary_par["chi_ns"]=float(config[config_section_name]['chi_ns']) m_ns = binary_par["m_ns"]=float(config[config_section_name]['m_ns']) q_min=float(config[config_section_name]['q_min']) q_max=float(config[config_section_name]['q_max']) q = np.linspace(q_min, q_max, 20*(q_max-q_min+1)) chi_bh_min=float(config[config_section_name]['chi_bh_min']) chi_bh_max=float(config[config_section_name]['chi_bh_max']) chi_bh = np.linspace(chi_bh_min, chi_bh_max, 15*(chi_bh_max-chi_bh_min)+1) binary_par["type"]=config[config_section_name]['type'] G = 6.67*10**(-8) c = 3*10**(10) m_sol = 2*10**33 plt.rcParams['xtick.top'] = plt.rcParams['xtick.labeltop'] = True plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True m_out_chi = [] m_out_q = [] f_chi = [] f_q = [] qnm_object = wf.QNM_fit(2,2,0) for j in range(len(chi_bh)): m_out_arr = [] m_out_first_time = 0 f_tid_maj_f_220 = 0 binary_par['chi_bh'] = chi_bh[j] for k in range(len(q)): binary_par['q'] = q[k] spin_object = sm.Spin_class(binary_par) chi_f, theta_f, m_f, m_out = spin_object.FinalPar() m_out_arr.append(m_out) binary_par['q'] = q[k] f_220 = qnm_object.f(m_f,chi_f) xi_tid = fsolve(spin_object.XiTidal,10) r_tid = xi_tid*(m_ns*m_sol*G/c**2)/spin_object.C*(1-2*spin_object.C) f_tid = float(1./(np.pi*(chi_f*m_f*m_sol*G/c**2+(r_tid**3/(m_f*m_sol*G/c**2))**(1./2)))*c) #print("") #print("m_out",m_out) #print("chi",chi_bh[j]) #print("q",q[k]) #print("") if f_tid>=f_220 and f_tid_maj_f_220==0: f_tid_maj_f_220=1 f_chi.append(chi_bh[j]) f_q.append(q[k]) #print("") #print("f_220", f_220) #print("f_tid",f_tid) #print("chi",chi_bh[j]) #print("q",q[k]) #print("") if m_out==0 and m_out_first_time==0: m_out_first_time = 1 m_out_chi.append(chi_bh[j]) #print("") #print(chi_bh[j]) m_out_q.append(q[k]) #print(q[k]) #print("") #plt.plot(q, m_out_arr, label=r"$\chi_{BH}:$ %.2f" %chi_bh[j]) #plt.legend() #plt.title(r"$M_{NS}$ = %.2f $M_{\odot}$, EOS = %s, $\theta_i$ = %d$^{\circ}$" %(binary_par["m_ns"], binary_par["EOS"], binary_par["theta_i_deg"]), y=1.08) plt.plot(f_chi, f_q,label=r'$f_{tid}=f_{220}$') plt.plot(m_out_chi, m_out_q, label=r'$M_{OUT}=0$') plt.xlabel(r'$\chi_{BH}$') plt.ylabel(r'$q$') switch={ "2H":[[0.1,9],[0.5,9],[0.4,6.5],[-0.01,6.0],[-0.01,5.8]], "H": [[0.2,8],[0.65,8],[0.6,4],[-0.05,3.4],[-0.05,3.2]], "HB":[[0.2,7],[0.6,6],[0.6,3.5],[-0.05,3],[-0.05,2.7]], "B": [[0.2,6],[0.65,5],[0.65,2.5],[-0.01,2.5],[-0.01,2.3]] } position = switch[binary_par["EOS"]] plt.text(position[0][0],position[0][1], r'$f_{220}<f_{tid}, M_{OUT}=0$') plt.text(position[1][0],position[1][1], r'$f_{220}<f_{tid}, M_{OUT}>0$') plt.text(position[2][0],position[2][1], r'$f_{tid}<f_{220}, M_{OUT}>0$') plt.text(position[3][0],position[3][1], r'$f_{tid}<f_{220}$') plt.text(position[4][0],position[4][1], r'$M_{OUT}=0$') plt.title(r"$M_{NS}=%.2f, EOS=%s, \theta_i=%d $"%(m_ns, binary_par["EOS"], binary_par["theta_i_deg"]),y=1.08) plt.legend() plt.show()