def check_g_RA_dec(detectors): """ Create a figure to plot the RA dec component of the amplitude-maximized amplitude-averaged metric. """ dRA = 2 * pi / 200 ddec = pi / 200 RA, dec = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] A, B, C, D = metric.maximum_likelihood_matrix(RA, dec, detectors) z0 = [] z1 = [] z2 = [] z3 = [] Fderivs = True for detector1 in detectors: I_n1 = detector1.I_n fp1 = metric.Fp(RA, dec, detector1) fx1 = metric.Fx(RA, dec, detector1) if Fderivs: dfp_dRA1 = metric.dFp_dRA(RA, dec, detector1) dfx_dRA1 = metric.dFx_dRA(RA, dec, detector1) dfp_ddec1 = metric.dFp_ddec(RA, dec, detector1) dfx_ddec1 = metric.dFx_ddec(RA, dec, detector1) drn_dRA1 = metric.drn_dRA(RA, dec, detector1) drn_ddec1 = metric.drn_ddec(RA, dec, detector1) z0.append((B * fp1 * fp1 + A * fx1 * fx1 - 2 * C * fp1 * fx1) / D * I_n1['-1'] * (-2 * pi * drn_dRA1) * (-2 * pi * drn_ddec1)) if Fderivs: z1.append((B*dfp_dRA1*dfp_ddec1+A*dfx_dRA1*dfx_ddec1-C*dfp_dRA1*dfx_ddec1-C*dfx_dRA1*dfp_ddec1)/D \ *I_n1['-7']) z2.append([]) z3.append([]) for detector2 in detectors: I_n2 = detector2.I_n fp2 = metric.Fp(RA, dec, detector2) fx2 = metric.Fx(RA, dec, detector2) if Fderivs: dfp_ddec2 = metric.dFp_ddec(RA, dec, detector2) dfx_ddec2 = metric.dFx_ddec(RA, dec, detector2) drn_ddec2 = metric.drn_ddec(RA, dec, detector2) pre = B * fp1 * fp2 + A * fx1 * fx2 - C * fp1 * fx2 - C * fx1 * fp2 z2[-1].append(pre*(B*fp1*fp2+A*fx1*fx2-C*fp1*fx2-C*fx1*fp2)/D**2 \ *I_n1['-4']*I_n2['-4']*(-2*pi*drn_dRA1)*(-2*pi*drn_ddec2)) if Fderivs: z3[-1].append(pre*(B*dfp_dRA1*dfp_ddec2+A*dfx_dRA1*dfx_ddec2-C*dfp_dRA1*dfx_ddec2-C*dfx_dRA1*dfp_ddec2)/D**2 \ *I_n1['-7']*I_n2['-7']) plot_metric_component_pieces(RA, dec, z0, z1, z2, z3)
def check_g_RA_dec(detectors): """ Create a figure to plot the RA dec component of the amplitude-maximized amplitude-averaged metric. """ dRA = 2*pi/200 ddec = pi/200 RA,dec = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] A,B,C,D = metric.maximum_likelihood_matrix(RA, dec, detectors) z0 = [] z1 = [] z2 = [] z3 = [] Fderivs = True for detector1 in detectors: I_n1 = detector1.I_n fp1 = metric.Fp(RA, dec, detector1) fx1 = metric.Fx(RA, dec, detector1) if Fderivs: dfp_dRA1 = metric.dFp_dRA(RA, dec, detector1) dfx_dRA1 = metric.dFx_dRA(RA, dec, detector1) dfp_ddec1 = metric.dFp_ddec(RA, dec, detector1) dfx_ddec1 = metric.dFx_ddec(RA, dec, detector1) drn_dRA1 = metric.drn_dRA(RA, dec, detector1) drn_ddec1 = metric.drn_ddec(RA, dec, detector1) z0.append((B*fp1*fp1+A*fx1*fx1-2*C*fp1*fx1)/D*I_n1['-1']*(-2*pi*drn_dRA1)*(-2*pi*drn_ddec1)) if Fderivs: z1.append((B*dfp_dRA1*dfp_ddec1+A*dfx_dRA1*dfx_ddec1-C*dfp_dRA1*dfx_ddec1-C*dfx_dRA1*dfp_ddec1)/D \ *I_n1['-7']) z2.append([]) z3.append([]) for detector2 in detectors: I_n2 = detector2.I_n fp2 = metric.Fp(RA, dec, detector2) fx2 = metric.Fx(RA, dec, detector2) if Fderivs: dfp_ddec2 = metric.dFp_ddec(RA, dec, detector2) dfx_ddec2 = metric.dFx_ddec(RA, dec, detector2) drn_ddec2 = metric.drn_ddec(RA, dec, detector2) pre = B*fp1*fp2+A*fx1*fx2-C*fp1*fx2-C*fx1*fp2 z2[-1].append(pre*(B*fp1*fp2+A*fx1*fx2-C*fp1*fx2-C*fx1*fp2)/D**2 \ *I_n1['-4']*I_n2['-4']*(-2*pi*drn_dRA1)*(-2*pi*drn_ddec2)) if Fderivs: z3[-1].append(pre*(B*dfp_dRA1*dfp_ddec2+A*dfx_dRA1*dfx_ddec2-C*dfp_dRA1*dfx_ddec2-C*dfx_dRA1*dfp_ddec2)/D**2 \ *I_n1['-7']*I_n2['-7']) plot_metric_component_pieces(RA, dec, z0, z1, z2, z3)
def check_dec_derivatives(detector): """ Create a plot to check the dec directional derivatives. """ pylab.figure() dRA = 2 * pi / 100 ddec = pi / 100 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2 + ddec:pi / 2:ddec] RA0 = pi / 3 ax = pylab.subplot(231) z = metric.Fp(RAs, decs, detector) levels = 100 CF = ax.contourf(RAs, decs, z, levels) CS = ax.contour(RAs, decs, z, levels) decs = scipy.linspace(-pi / 2, pi / 2, 100) RAs = RA0 * scipy.ones(len(decs)) CF = ax.plot(RAs, decs, 'k') ax.set_title(r'$F_+$') ax = pylab.subplot(232) z = metric.Fp(RAs, decs, detector) CF = ax.plot(decs, z) ax.set_title(r'$F_+$') ax = pylab.subplot(233) z = metric.dx_n2(z, decs[1] - decs[0]) CF = ax.plot(decs, z, 'r') z = metric.dFp_ddec(RAs, decs, detector) CF = ax.plot(decs, z, 'b') ax.set_title(r'$\partial_\delta F_+$') RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2 + ddec:pi / 2:ddec] ax = pylab.subplot(234) z = metric.Fx(RAs, decs, detector) levels = 100 CF = ax.contourf(RAs, decs, z, levels) CS = ax.contour(RAs, decs, z, levels) decs = scipy.linspace(-pi / 2, pi / 2, 100) RAs = RA0 * scipy.ones(len(decs)) CF = ax.plot(RAs, decs, 'k') ax.set_title(r'$F_\times$') ax = pylab.subplot(235) z = metric.Fx(RAs, decs, detector) CF = ax.plot(decs, z) ax.set_title(r'$F_\times$') ax = pylab.subplot(236) z = metric.dx_n2(z, decs[1] - decs[0]) CF = ax.plot(decs, z, 'r') z = metric.dFx_ddec(RAs, decs, detector) CF = ax.plot(decs, z, 'b') ax.set_title(r'$\partial_\delta F_\times$')
def check_dec_derivatives(detector): """ Create a plot to check the dec directional derivatives. """ pylab.figure() dRA = 2*pi/100 ddec = pi/100 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2+ddec:pi/2:ddec] RA0 = pi/3 ax = pylab.subplot(231) z = metric.Fp(RAs, decs, detector) levels = 100 CF = ax.contourf(RAs, decs, z, levels) CS = ax.contour(RAs, decs, z, levels) decs = scipy.linspace(-pi/2,pi/2,100) RAs = RA0*scipy.ones(len(decs)) CF = ax.plot(RAs,decs,'k') ax.set_title(r'$F_+$') ax = pylab.subplot(232) z = metric.Fp(RAs, decs, detector) CF = ax.plot(decs, z) ax.set_title(r'$F_+$') ax = pylab.subplot(233) z = metric.dx_n2(z,decs[1]-decs[0]) CF = ax.plot(decs, z, 'r') z = metric.dFp_ddec(RAs, decs, detector) CF = ax.plot(decs, z, 'b') ax.set_title(r'$\partial_\delta F_+$') RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2+ddec:pi/2:ddec] ax = pylab.subplot(234) z = metric.Fx(RAs, decs, detector) levels = 100 CF = ax.contourf(RAs, decs, z, levels) CS = ax.contour(RAs, decs, z, levels) decs = scipy.linspace(-pi/2,pi/2,100) RAs = RA0*scipy.ones(len(decs)) CF = ax.plot(RAs,decs,'k') ax.set_title(r'$F_\times$') ax = pylab.subplot(235) z = metric.Fx(RAs, decs, detector) CF = ax.plot(decs, z) ax.set_title(r'$F_\times$') ax = pylab.subplot(236) z = metric.dx_n2(z,decs[1]-decs[0]) CF = ax.plot(decs, z, 'r') z = metric.dFx_ddec(RAs, decs, detector) CF = ax.plot(decs, z, 'b') ax.set_title(r'$\partial_\delta F_\times$')
def plot_detector(detector): """ Plot different detector antenna responses in a new figure. """ fig = pylab.figure() ax = fig.add_axes(boundingbox(3, 1, 1, 1)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.Fp(RAs, decs, detector)**2 z += metric.Fx(RAs, decs, detector)**2 z = z**.5 levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(detector.name) ax = fig.add_axes(boundingbox(3, 3, 2, 1)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.Fp(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$F_+$') ax = fig.add_axes(boundingbox(3, 3, 2, 2)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.dFp_dRA(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$\partial_\alpha F_+$') ax = fig.add_axes(boundingbox(3, 3, 2, 3)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.dFp_ddec(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$\partial_\delta F_+$') ax = fig.add_axes(boundingbox(3, 3, 3, 1)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.Fx(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$F_\times$') ax = fig.add_axes(boundingbox(3, 3, 3, 2)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.dFx_dRA(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$\partial_\alpha F_\times$') ax = fig.add_axes(boundingbox(3, 3, 3, 3)) m = mollwiede_map(ax) dRA = 2 * pi / 200 ddec = pi / 200 RAs, decs = scipy.mgrid[-pi + dRA:pi:dRA, -pi / 2:pi / 2 + ddec:ddec] z = metric.dFx_ddec(RAs, decs, detector) levels = scipy.linspace(min(0, min(z.flatten())), max(z.flatten()), 20) x, y = m(RAs * 180. / pi, decs * 180. / pi) CS = m.contour(x, y, z, levels) plot_arms(m, [detector]) ax.set_title(r'$\partial_\delta F_\times$')
def plot_detector(detector): """ Plot different detector antenna responses in a new figure. """ fig = pylab.figure() ax = fig.add_axes(boundingbox(3,1,1,1)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.Fp(RAs, decs, detector)**2 z += metric.Fx(RAs, decs, detector)**2 z = z**.5 levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(detector.name) ax = fig.add_axes(boundingbox(3,3,2,1)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.Fp(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$F_+$') ax = fig.add_axes(boundingbox(3,3,2,2)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.dFp_dRA(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$\partial_\alpha F_+$') ax = fig.add_axes(boundingbox(3,3,2,3)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.dFp_ddec(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$\partial_\delta F_+$') ax = fig.add_axes(boundingbox(3,3,3,1)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.Fx(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$F_\times$') ax = fig.add_axes(boundingbox(3,3,3,2)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.dFx_dRA(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$\partial_\alpha F_\times$') ax = fig.add_axes(boundingbox(3,3,3,3)) m = mollwiede_map(ax) dRA = 2*pi/200 ddec = pi/200 RAs,decs = scipy.mgrid[-pi+dRA:pi:dRA, -pi/2:pi/2+ddec:ddec] z = metric.dFx_ddec(RAs, decs, detector) levels = scipy.linspace(min(0,min(z.flatten())),max(z.flatten()),20) x, y = m(RAs*180./pi, decs*180./pi) CS = m.contour(x, y, z, levels) plot_arms(m,[detector]) ax.set_title(r'$\partial_\delta F_\times$')