Ejemplo n.º 1
0
    def test_fastelldefl(self):
        x1 = np.array([1,2,3])
        x2 = np.array([3,2,1])
        q = 0.9
        gam = 0.5
        arat = 0.9
        s = 0.01
        alpha1, alpha2 = fastell4py.fastelldefl(x1, x2, q, gam, arat, s)
        print alpha1, alpha2, 'alpha1, alpha2'
        assert alpha1[0] == 0.49802187030058409
        assert alpha2[0] == 1.604771432322617

        x1 = 1.
        x2 = 3.
        alpha1_new, alpha2_new = fastell4py.fastelldefl(x1, x2, q, gam, arat, s)
        assert alpha1_new == alpha1[0]
        assert alpha2_new == alpha2[0]
Ejemplo n.º 2
0
    def test_fastelldefl(self):
        x1 = np.array([1, 2, 3])
        x2 = np.array([3, 2, 1])
        q = 0.9
        gam = 0.5
        arat = 0.9
        s = 0.01
        alpha1, alpha2 = fastell4py.fastelldefl(x1, x2, q, gam, arat, s)
        print(alpha1, alpha2, 'alpha1, alpha2')
        assert alpha1[0] == 0.49802187030058409
        assert alpha2[0] == 1.604771432322617

        x1 = 1.
        x2 = 3.
        alpha1_new, alpha2_new = fastell4py.fastelldefl(
            x1, x2, q, gam, arat, s)
        assert alpha1_new == alpha1[0]
        assert alpha2_new == alpha2[0]
Ejemplo n.º 3
0
    def derivatives(self, x, y, phi_E, gamma, e1, e2, center_x=0, center_y=0):
        phi_G, q = util.ellipticity2phi_q(e1, e2)
        if gamma < 1.0:
            gamma = 1.0
        if gamma > 2.9:
            gamma = 2.9
        if q < 0.3:
            q = 0.3
        if q > 1:
            q = 1.
        x_shift = x - center_x
        y_shift = y - center_y
        q_fastell, gam = self.convert_params(phi_E, gamma, q)
        cos_phi = np.cos(phi_G)
        sin_phi = np.sin(phi_G)

        x1 = cos_phi*x_shift+sin_phi*y_shift
        x2 = -sin_phi*x_shift+cos_phi*y_shift

        f_x_prim, f_y_prim = fastell4py.fastelldefl(x1, x2, q_fastell, gam, arat=q, s2=self.s2)
        f_x = cos_phi*f_x_prim - sin_phi*f_y_prim
        f_y = sin_phi*f_x_prim + cos_phi*f_y_prim
        return f_x, f_y