def __init__(self, lens_model_list, kwargs_lens, xpos, ypos, constrain_params): assert lens_model_list[0] in ['PEMD', 'SPEP', 'SPEMD'] assert lens_model_list[1] == 'SHEAR' assert constrain_params is not None assert 'shear' in constrain_params.keys() self._Ntovary = 2 self._k_start = 2 self._kwargs_lens = kwargs_lens self._theta_E_start = approx_theta_E(xpos, ypos) self._tovary_indicies = [0, 1] self.param_names = [[ 'theta_E', 'center_x', 'center_y', 'e1', 'e2', 'gamma' ], ['shear_magnitude', 'shear_PA']] self.fixed_names = [['gamma'], ['shear_magnitude']] self.fixed_values = [{ 'gamma': kwargs_lens[0]['gamma'] }, { 'shear_magnitude': constrain_params['shear'] }] self.params_to_vary = [ 'theta_E', 'center_x', 'center_y', 'e1', 'e2', 'shear_theta' ] self._constrain_params = constrain_params
def test_estimate_theta_E(): x = np.array([-0.45328229, 0.57461556, 0.53757501, -0.42312438]) y = np.array([0.69582971, -0.51226356, 0.37577509, -0.40245467]) approx = util.approx_theta_E(x, y) npt.assert_array_less(approx - 1, 0.2)
def __init__(self, lens_model_list, kwargs_lens, xpos, ypos): assert lens_model_list[0] in ['SPEMD', 'SPEP'] assert lens_model_list[1] == 'SHEAR' self._Ntovary = 2 self._k_start = 2 self._kwargs_lens = kwargs_lens self._theta_E_start = approx_theta_E(xpos, ypos) self._tovary_indicies = [0, 1] self.param_names = [[ 'theta_E', 'center_x', 'center_y', 'e1', 'e2', 'gamma' ], ['e1', 'e2']] self.fixed_names = [['gamma'], []] self.fixed_values = [{'gamma': kwargs_lens[0]['gamma']}, {}] self.params_to_vary = [ 'theta_E', 'center_x', 'center_y', 'e1', 'e2', 'shear_e1', 'shear_e2' ]