Commit 6a8142fc authored by Marcus Haberland's avatar Marcus Haberland
Browse files

Update binary.py

Small changes - trying to get better precision with scipy.integrate
parent 1cf15046
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 12 14:36:02 2021
......@@ -239,15 +238,19 @@ class binary:
funcA = self.h_i(i,diff)
funcB = self.h_i(j,diff)
return integrate.quad(lambda t: funcA(t)*funcB(t),0,self.T_obs,limit=int(self.T_obs*self.f_GW*20))[0]
return integrate.quad(lambda t: funcA(t)*funcB(t),0,self.T_obs,limit=int(self.T_obs*self.f_GW*20),epsabs=1.49e-16)[0]
def h_i(self,i,diff=1e-6):
B = None
if i == 5:
if self.theta_S_Ec+diff > pi:
diff *= -1
B = binary(self.theta_S_Ec+diff,self.phi_S_Ec,self.dist/pc,self.theta_L,self.phi_L,self.m1/M_S,self.m2/M_S,self.f_GW,self.mP/M_J,self.P/yr,self.theta_P,self.phi_0,self.T_obs/yr,self.key)
elif i == 6:
B = binary(self.theta_S_Ec,self.phi_S_Ec+diff,self.dist/pc,self.theta_L,self.phi_L,self.m1/M_S,self.m2/M_S,self.f_GW,self.mP/M_J,self.P/yr,self.theta_P,self.phi_0,self.T_obs/yr,self.key)
elif i == 7:
if self.theta_L+diff > pi:
diff *= -1
B = binary(self.theta_S_Ec,self.phi_S_Ec,self.dist/pc,self.theta_L+diff,self.phi_L,self.m1/M_S,self.m2/M_S,self.f_GW,self.mP/M_J,self.P/yr,self.theta_P,self.phi_0,self.T_obs/yr,self.key)
elif i == 8:
B = binary(self.theta_S_Ec,self.phi_S_Ec,self.dist/pc,self.theta_L,self.phi_L+diff,self.m1/M_S,self.m2/M_S,self.f_GW,self.mP/M_J,self.P/yr,self.theta_P,self.phi_0,self.T_obs/yr,self.key)
......@@ -288,4 +291,4 @@ class binary:
return res
def signal_to_noise(self):
return np.sqrt(2*self.hxh()/self.S_n())
\ No newline at end of file
return np.sqrt(2*self.hxh()/self.S_n())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment