Commit 09b222c0 authored by Marcus Haberland's avatar Marcus Haberland
Browse files

looked for positional dependance of face-on binaries

parent b377f9a3
......@@ -144,8 +144,8 @@ def strain_ig():
for i, add in enumerate(np.linspace(0,10,10)*yr):
hour = np.linspace(0,5*60,1000) + add
plt.figure(dpi=300)
CwP = ig_binary(dist=1e3,freq=10e-3,mP=1,P=10,theta_P=pi/2,phi_P=pi/2)
CwoP = ig_binary(dist=1e3,freq=10e-3,mP=0,P=10,theta_P=0,phi_P=0)
CwP = ig_binary(dist=1e3,theta_S_Ec=pi/2+1e-6,phi_S_Ec=0,freq=10e-3,mP=1,P=10,theta_P=pi/2,phi_P=pi/2)
CwoP = ig_binary(dist=1e3,theta_S_Ec=pi,phi_S_Ec=0,freq=10e-3,mP=0,P=10,theta_P=0,phi_P=0)
plt.plot(hour - add,[CwP.strain(t) for t in hour],'-')
plt.plot(hour - add,[CwoP.strain(t) for t in hour],':')
plt.legend(['$y_2$ w/ exoplanet','$y_2$ w/o exoplanet'])
......@@ -365,6 +365,54 @@ def look_at_unc():
for json in binaries['m']:
look_at_binary(json['binary'])
plt.show()
def sin_fit(b,plot=True):
t = np.linspace(0,100/b.f_GW,1000)
s = np.array([b.strain(t0)*1e40 for t0 in t])
fit = lambda y: np.array([y[0]*1e40*np.cos(y[1]*t0+y[2]) for t0 in t]) - s
x0 = [b.a0,2*pi*b.f_GW,pi]
res = optimize.leastsq(fit,x0,ftol=1e-8)[0]
if plot:
plt.plot(t,s,label='strain')
#plt.plot(t,[x0[0]*1e40*np.cos(x0[1]*t0+x0[2]) for t0 in t],label='x0')
plt.plot(t,[res[0]*1e40*np.cos(res[1]*t0+res[2]) for t0 in t],':',label='fit')
plt.title('mu,A,f={:.2f},{:.2e},{:.2e}'.format(b.kn,res[0],res[1]))
plt.legend()
plt.show()
return res
def mu_dependence_ig(n=10,plot=True):
mus = np.linspace(-1,1,n)
phis = np.linspace(0,2*pi,n)
amplitude = np.zeros((n,n))
mu = np.zeros((n,n))
for i, theta in enumerate(np.arcsin(mus)+pi/2):
for j, phi in enumerate(phis+pi):
b = ig_binary(theta_S_Ec=theta,phi_S_Ec=phi,theta_L=0,phi_L=0)
if np.abs(b.kn) == 1:
amplitude[i,j] = 0.
else:
amplitude[i,j] = integrate.quad(lambda t: b.strain(t)**2,0,40*24*60*60,epsrel=1.49e-2,epsabs=0)[0]
print(i,j)
mu[i,j] = b.kn
plt.figure(dpi=300)
plt.imshow(amplitude,extent=[-pi,pi,pi,0])
plt.colorbar()
plt.xlabel(r'$\phi_S$')
plt.ylabel(r'$\theta_S$ uniform in sin$(\theta_S)$')
plt.title(r'$\int_0^{40 d}y^2 dt$ for face-on binaries')
plt.savefig(fig+'pos_dependance_ig_2.png')
plt.show()
plt.figure(dpi=300)
plt.plot(mu.flatten(),amplitude.flatten(),'.')
plt.xlabel(r'$\mu$')
plt.ylabel(r'$\int_0^{40 d}y^2 dt$')
plt.savefig(fig+'mu_dependace_ig_2.png')
plt.show()
return [amplitude,mu,mus,phis]
#test2()
#uncs = test(20)
......@@ -380,4 +428,6 @@ def look_at_unc():
#plot_all_Tamanini()
#look_at_unc()
#strain_ig()
#hr_d_strain()
\ No newline at end of file
#hr_d_strain()
#sin_fit(ig_binary())
A = mu_dependence_ig(20,True)
\ No newline at end of file
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