コード例 #1
0
def check_g_RA_RA(detectors):
    """
	Create a figure to plot the RA RA component of the amplitude maximized
	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)
        drn_dRA1 = metric.drn_dRA(RA, dec, detector1)
        z0.append((B * fp1 * fp1 + A * fx1 * fx1 - 2 * C * fp1 * fx1) *
                  (-2 * pi * drn_dRA1)**2 * I_n1['-1'] / D)
        if Fderivs:
            z1.append((B * dfp_dRA1 * dfp_dRA1 + A * dfx_dRA1 * dfx_dRA1 -
                       C * dfp_dRA1 * dfx_dRA1 - C * dfx_dRA1 * dfp_dRA1) *
                      I_n1['-7'] / D)
        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_dRA2 = metric.dFp_dRA(RA, dec, detector2)
                dfx_dRA2 = metric.dFx_dRA(RA, dec, detector2)
            drn_dRA2 = metric.drn_dRA(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_dRA2))
            if Fderivs:
                z3[-1].append(pre*(B*dfp_dRA1*dfp_dRA2+A*dfx_dRA1*dfx_dRA2-C*dfp_dRA1*dfx_dRA2-C*dfx_dRA1*dfp_dRA2)/D**2 \
                 *I_n1['-7']*I_n2['-7'])

    plot_metric_component_pieces(RA, dec, z0, z1, z2, z3)
コード例 #2
0
def check_g_RA_RA(detectors):
	"""
	Create a figure to plot the RA RA component of the amplitude maximized
	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)
		drn_dRA1 = metric.drn_dRA(RA, dec, detector1)
		z0.append((B*fp1*fp1+A*fx1*fx1-2*C*fp1*fx1)*(-2*pi*drn_dRA1)**2*I_n1['-1']/D)
		if Fderivs:
			z1.append((B*dfp_dRA1*dfp_dRA1+A*dfx_dRA1*dfx_dRA1-C*dfp_dRA1*dfx_dRA1-C*dfx_dRA1*dfp_dRA1)*I_n1['-7']/D)
		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_dRA2 = metric.dFp_dRA(RA, dec, detector2)
				dfx_dRA2 = metric.dFx_dRA(RA, dec, detector2)
			drn_dRA2 = metric.drn_dRA(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_dRA2))
			if Fderivs:
				z3[-1].append(pre*(B*dfp_dRA1*dfp_dRA2+A*dfx_dRA1*dfx_dRA2-C*dfp_dRA1*dfx_dRA2-C*dfx_dRA1*dfp_dRA2)/D**2 \
					*I_n1['-7']*I_n2['-7'])

	plot_metric_component_pieces(RA, dec, z0, z1, z2, z3)
コード例 #3
0
def check_RA_derivatives(detector):
    """
	Create a plot to check the RA 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]
    dec0 = 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)
    RAs = scipy.linspace(-pi, pi, 100)
    decs = dec0 * scipy.ones(len(RAs))
    CF = ax.plot(RAs, decs, 'k')
    ax.set_title(r'$F_+$')

    ax = pylab.subplot(232)
    z = metric.Fp(RAs, decs, detector)
    CF = ax.plot(RAs, z)
    ax.set_title(r'$F_+$')

    ax = pylab.subplot(233)
    z = metric.dx_n2(z, RAs[1] - RAs[0])
    CF = ax.plot(RAs, z, 'r')
    z = metric.dFp_dRA(RAs, decs, detector)
    CF = ax.plot(RAs, z, 'b')
    ax.set_title(r'$\partial_\alpha 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)
    RAs = scipy.linspace(-pi, pi, 100)
    decs = dec0 * scipy.ones(len(RAs))
    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(RAs, z)
    ax.set_title(r'$F_\times$')

    ax = pylab.subplot(236)
    z = metric.dx_n2(z, RAs[1] - RAs[0])
    CF = ax.plot(RAs, z, 'r')
    z = metric.dFx_dRA(RAs, decs, detector)
    CF = ax.plot(RAs, z, 'b')
    ax.set_title(r'$\partial_\alpha F_\times$')
コード例 #4
0
def check_RA_derivatives(detector):
	"""
	Create a plot to check the RA 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]
	dec0 = 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)
	RAs = scipy.linspace(-pi,pi,100)
	decs = dec0*scipy.ones(len(RAs))
	CF = ax.plot(RAs,decs,'k')
	ax.set_title(r'$F_+$')

	ax = pylab.subplot(232)
	z = metric.Fp(RAs, decs, detector)
	CF = ax.plot(RAs, z)
	ax.set_title(r'$F_+$')

	ax = pylab.subplot(233)
	z = metric.dx_n2(z,RAs[1]-RAs[0])
	CF = ax.plot(RAs, z, 'r')
	z = metric.dFp_dRA(RAs, decs, detector)
	CF = ax.plot(RAs, z, 'b')
	ax.set_title(r'$\partial_\alpha 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)
	RAs = scipy.linspace(-pi,pi,100)
	decs = dec0*scipy.ones(len(RAs))
	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(RAs, z)
	ax.set_title(r'$F_\times$')

	ax = pylab.subplot(236)
	z = metric.dx_n2(z,RAs[1]-RAs[0])
	CF = ax.plot(RAs, z, 'r')
	z = metric.dFx_dRA(RAs, decs, detector)
	CF = ax.plot(RAs, z, 'b')
	ax.set_title(r'$\partial_\alpha F_\times$')
コード例 #5
0
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$')
コード例 #6
0
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$')