Exemplo n.º 1
0
    def test_update_source_redshift(self):
        z_source = 1.5
        lens_model_list = ['SIS']
        kwargs_lens = [{'theta_E': 1}]
        redshift_list = [0.5]
        lensModelMutli = MultiPlane(z_source=z_source,
                                    lens_model_list=lens_model_list,
                                    lens_redshift_list=redshift_list,
                                    z_interp_stop=3,
                                    cosmo_interp=True)
        alpha_x, alpha_y = lensModelMutli.alpha(1, 0, kwargs_lens=kwargs_lens)
        lensModelMutli.update_source_redshift(z_source=z_source)
        alpha_x_new, alpha_y_new = lensModelMutli.alpha(
            1, 0, kwargs_lens=kwargs_lens)
        npt.assert_almost_equal(alpha_x / alpha_x_new, 1., decimal=8)

        lensModelMutli.update_source_redshift(z_source=1.)
        alpha_x_new, alpha_y_new = lensModelMutli.alpha(
            1, 0, kwargs_lens=kwargs_lens)
        assert alpha_x / alpha_x_new > 1

        lensModelMutli.update_source_redshift(z_source=2.)
        alpha_x_new, alpha_y_new = lensModelMutli.alpha(
            1, 0, kwargs_lens=kwargs_lens)
        assert alpha_x / alpha_x_new < 1
Exemplo n.º 2
0
 def test_sis_alpha(self):
     z_source = 1.5
     lens_model_list = ['SIS']
     redshift_list = [0.5]
     lensModelMutli = MultiPlane(z_source=z_source,
                                 lens_model_list=lens_model_list,
                                 lens_redshift_list=redshift_list)
     lensModel = LensModel(lens_model_list=lens_model_list)
     kwargs_lens = [{'theta_E': 1, 'center_x': 0, 'center_y': 0}]
     alpha_x_simple, alpha_y_simple = lensModel.alpha(1, 0, kwargs_lens)
     alpha_x_multi, alpha_y_multi = lensModelMutli.alpha(1, 0, kwargs_lens)
     npt.assert_almost_equal(alpha_x_simple, alpha_x_multi, decimal=8)
     npt.assert_almost_equal(alpha_y_simple, alpha_y_multi, decimal=8)
     sum_partial = np.sum(lensModelMutli._multi_plane_base._T_ij_list
                          ) + lensModelMutli._T_ij_stop
     T_z_true = lensModelMutli._T_z_source
     npt.assert_almost_equal(sum_partial, T_z_true, decimal=5)