Esempio n. 1
0
    def test_b_circular(self):
        """Impact parameter mapping test for circular orbits.
        
        Test impact parameter mapping to ensure that b == z(t0) for circular orbits.
        """
        Is = o.i_from_ba(self.bs, self.a)

        zs = np.concatenate(
            [of.z_circular(self.t, self.t0, self.p, self.a, i, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([
            of.z_eccentric_newton(self.t, self.t0, self.p, self.a, i, 0, 0, 1)
            for i in Is
        ])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([
            of.z_eccentric_iter(self.t, self.t0, self.p, self.a, i, 0, 0, 1)
            for i in Is
        ])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([
            of.z_eccentric_ps3(self.t, self.t0, self.p, self.a, i, 0, 0, 1)
            for i in Is
        ])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([
            of.z_eccentric_ps5(self.t, self.t0, self.p, self.a, i, 0, 0, 1)
            for i in Is
        ])
        npt.assert_array_almost_equal(self.bs, zs)
Esempio n. 2
0
 def test_newton(self):
     for (i, t0), w in product(enumerate(self.t0s), self.ws):
         z = of.z_eccentric_newton(self.t,
                                   t0,
                                   self.p,
                                   self.a,
                                   self.i,
                                   0,
                                   w,
                                   nth=1)
         npt.assert_array_almost_equal(z, self.ref_zs[i], decimal=3)
Esempio n. 3
0
    def test_b_ecc_newton(self):
        """Impact parameter mapping test for z_eccentric_newton.

        Test impact parameter mapping to ensure that b == z(t0) for eccentric orbits
        using the Newton's method.
        """
        
        es = uniform(0, 0.75, 50)
        Is = o.i_from_baew(self.bs, self.a, es, self.ws)
        zs = np.concatenate([of.z_eccentric_newton(self.t, self.t0, self.p, self.a, i, e, w, 1) for i,e,w in zip(Is, es, self.ws)])
        npt.assert_array_almost_equal(self.bs, zs)
Esempio n. 4
0
    def test_b_ecc_newton(self):
        """Impact parameter mapping test for z_eccentric_newton.

        Test impact parameter mapping to ensure that b == z(t0) for eccentric orbits
        using the Newton's method.
        """

        es = uniform(0, 0.75, 50)
        Is = o.i_from_baew(self.bs, self.a, es, self.ws)
        zs = np.concatenate([
            of.z_eccentric_newton(self.t, self.t0, self.p, self.a, i, e, w, 1)
            for i, e, w in zip(Is, es, self.ws)
        ])
        npt.assert_array_almost_equal(self.bs, zs)
Esempio n. 5
0
    def setUp(self):
        self.p = 1
        self.a = 5
        self.i = 0.5 * np.pi
        self.t = [-0.2, 0.0, 0.125, 0.25, 0.375, 0.5, 0.675, 0.75, 1.0]
        self.t0s = [0.01, 0.213, 0.5456, 1000.945]
        self.es = [0.05, 0.15, 0.35, 0.5, 0.75]
        self.ws = [0, 0.5 * pi, pi, 1.5 * pi, 2 * pi, 0.012, 0.24, -0.53]

        ## Note: We assume that the routine using the Newton's method is bug free...
        self.ref_zs = [
            of.z_eccentric_newton(self.t, t0, self.p, self.a, self.i, e, w, nth=1)
            for t0, e, w in product(self.t0s, self.es, self.ws)
        ]
Esempio n. 6
0
    def test_b_circular(self):
        """Impact parameter mapping test for circular orbits.
        
        Test impact parameter mapping to ensure that b == z(t0) for circular orbits.
        """
        Is = o.i_from_ba(self.bs, self.a)

        zs = np.concatenate([of.z_circular(self.t, self.t0, self.p, self.a, i, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([of.z_eccentric_newton(self.t, self.t0, self.p, self.a, i, 0, 0, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([of.z_eccentric_iter(self.t, self.t0, self.p, self.a, i, 0, 0, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([of.z_eccentric_ps3(self.t, self.t0, self.p, self.a, i, 0, 0, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)

        zs = np.concatenate([of.z_eccentric_ps5(self.t, self.t0, self.p, self.a, i, 0, 0, 1) for i in Is])
        npt.assert_array_almost_equal(self.bs, zs)
    def setUp(self):
        self.p = 1
        self.a = 5
        self.i = 0.5 * np.pi
        self.t = [-0.2, 0.0, 0.125, 0.25, 0.375, 0.5, 0.675, 0.75, 1.0]
        self.t0s = [0.01, 0.213, 0.5456, 1000.945]
        self.es = [0.05, 0.15, 0.35, 0.5, 0.75]
        self.ws = [0, 0.5 * pi, pi, 1.5 * pi, 2 * pi, 0.012, 0.24, -0.53]

        ## Note: We assume that the routine using the Newton's method is bug free...
        self.ref_zs = [
            of.z_eccentric_newton(self.t,
                                  t0,
                                  self.p,
                                  self.a,
                                  self.i,
                                  e,
                                  w,
                                  nth=1)
            for t0, e, w in product(self.t0s, self.es, self.ws)
        ]
Esempio n. 8
0
 def test_newton(self):
     for (i,t0), w in product(enumerate(self.t0s), self.ws):
         z = of.z_eccentric_newton(self.t, t0, self.p, self.a, self.i, 0, w, nth=1)
         npt.assert_array_almost_equal(z, self.ref_zs[i], decimal=3)