Esempio n. 1
0
    def test_derivatives(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {
            'theta_E': 1.,
            'ratio_pointmass': 3,
            'ratio_chameleon': 2,
            'w_c1': .5,
            'w_t1': 1.,
            'e11': e1,
            'e21': e2,
            'w_c2': .1,
            'w_t2': .5,
            'e12': e1,
            'e22': e2
        }
        f_x, f_y = doublechameleon.derivatives(x=1, y=1., **kwargs_light)
        npt.assert_almost_equal(f_x, 0.445004064611891, decimal=4)
        npt.assert_almost_equal(f_y, 0.46313862781025106, decimal=4)
Esempio n. 2
0
    def test_hessian(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {
            'theta_E': 1.,
            'ratio_pointmass': 3,
            'ratio_chameleon': 2,
            'w_c1': .5,
            'w_t1': 1.,
            'e11': e1,
            'e21': e2,
            'w_c2': .1,
            'w_t2': .5,
            'e12': e1,
            'e22': e2
        }
        f_xx, f_yy, f_xy = doublechameleon.hessian(x=1, y=1., **kwargs_light)
        npt.assert_almost_equal(f_xx, 0.06174422835961879, decimal=4)
        npt.assert_almost_equal(f_xy, -0.5050946519853545, decimal=4)
        npt.assert_almost_equal(f_yy, 0.04438379467671494, decimal=4)
Esempio n. 3
0
    def test_hessian(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {
            'alpha_1': 1.,
            'ratio_pointmass': 3,
            'ratio_chameleon': 2,
            'w_c1': .5,
            'w_t1': 1.,
            'e11': e1,
            'e21': e2,
            'w_c2': .1,
            'w_t2': .5,
            'e12': e1,
            'e22': e2
        }
        f_xx, f_xy, f_yx, f_yy = doublechameleon.hessian(x=1,
                                                         y=1.,
                                                         **kwargs_light)
        npt.assert_almost_equal(f_xx, 0.0633838122066912, decimal=4)
        npt.assert_almost_equal(f_xy, -0.3986532840628945, decimal=4)
        npt.assert_almost_equal(f_yx, -0.3986532840628945, decimal=4)
        npt.assert_almost_equal(f_yy, 0.04802318253385707, decimal=4)
Esempio n. 4
0
    def test_derivatives(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {
            'alpha_1': 1.,
            'ratio_pointmass': 3,
            'ratio_chameleon': 2,
            'w_c1': .5,
            'w_t1': 1.,
            'e11': e1,
            'e21': e2,
            'w_c2': .1,
            'w_t2': .5,
            'e12': e1,
            'e22': e2
        }
        f_x, f_y = doublechameleon.derivatives(x=1, y=1., **kwargs_light)
        npt.assert_almost_equal(f_x, 0.4348690461571936, decimal=4)
        npt.assert_almost_equal(f_y, 0.4530081649948411, decimal=4)
Esempio n. 5
0
    def test_hessian(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {
            'alpha_1': 1.,
            'ratio_pointmass': 3,
            'ratio_chameleon': 2,
            'w_c1': .5,
            'w_t1': 1.,
            'e11': e1,
            'e21': e2,
            'w_c2': .1,
            'w_t2': .5,
            'e12': e1,
            'e22': e2
        }
        f_xx, f_yy, f_xy = doublechameleon.hessian(x=1, y=1., **kwargs_light)
        npt.assert_almost_equal(f_xx, 0.05544254995059526, decimal=4)
        npt.assert_almost_equal(f_xy, -0.49181674712159473, decimal=4)
        npt.assert_almost_equal(f_yy, 0.03985372092386123, decimal=4)
Esempio n. 6
0
    def test_function(self):
        """

        :return:
        """
        doublechameleon = DoubleChameleonPointMass()

        phi_G, q = 0.3, 0.8
        e1, e2 = param_util.phi_q2_ellipticity(phi_G, q)
        kwargs_light = {'alpha_1': 1., 'ratio_pointmass': 3, 'ratio_chameleon': 2, 'w_c1': .5, 'w_t1': 1., 'e11': e1, 'e21': e2, 'w_c2': .1, 'w_t2': .5, 'e12': e1, 'e22': e2}
        flux = doublechameleon.function(x=1, y=1., **kwargs_light)
        npt.assert_almost_equal(flux, 1.2324939073557235, decimal=4)
Esempio n. 7
0
 def test_param_name(self):
     chameleon = DoubleChameleonPointMass()
     names = chameleon.param_names
     assert names[0] == 'theta_E'