def test_sis_travel_time_new(self): z_source = 1.5 z_lens = 0.5 lens_model_list = ['SIS', 'SIS'] redshift_list = [z_lens, 0.2] 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 }, { 'theta_E': 0., 'center_x': 0, 'center_y': 0 }] dt = lensModelMutli.arrival_time(1., 0., kwargs_lens) Dt = lensModelMutli._multi_plane_base._cosmo_bkg.ddt(z_lens=z_lens, z_source=z_source) fermat_pot = lensModel.fermat_potential(1, 0., kwargs_lens) dt_simple = const.delay_arcsec2days(fermat_pot, Dt) print(dt, dt_simple) npt.assert_almost_equal(dt, dt_simple, decimal=8)
def logL_delay(self, kwargs_lens, kwargs_cosmo): """ routine to compute the log likelihood of the time delay distance :param args: :return: """ delay_arcsec = self.Multiband.fermat_potential(kwargs_lens, kwargs_cosmo) D_dt_model = kwargs_cosmo['delay_dist'] delay_days = const.delay_arcsec2days(delay_arcsec, D_dt_model) logL = self._logL_delays(delay_days, self.delays_measured, self.delays_errors) return logL
def _lensing_potential2time_delay(self, potential, z_lens, z_source): """ transforms the lensing potential (in units arcsec^2) to a gravitational time-delay as measured at z=0 :param potential: lensing potential :param z_lens: redshift of the deflector :param z_source: redshift of source for the definition of the lensing quantities :return: gravitational time-delay in units of days """ D_dt = self._cosmo_bkg.D_dt(z_lens, z_source) delay_days = const.delay_arcsec2days(potential, D_dt) return delay_days
def logL(self, kwargs_lens, kwargs_ps, kwargs_cosmo): """ routine to compute the log likelihood of the time delay distance :param kwargs_lens: lens model kwargs list :param kwargs_ps: point source kwargs list :param kwargs_cosmo: cosmology and other kwargs :return: log likelihood of the model given the time delay data """ x_pos, y_pos = self._pointSource.image_position(kwargs_ps=kwargs_ps, kwargs_lens=kwargs_lens, original_position=True) x_pos, y_pos = x_pos[0], y_pos[0] delay_arcsec = self._lensModel.fermat_potential(x_pos, y_pos, kwargs_lens) D_dt_model = kwargs_cosmo['D_dt'] delay_days = const.delay_arcsec2days(delay_arcsec, D_dt_model) logL = self._logL_delays(delay_days, self._delays_measured, self._delays_errors) return logL
def logL_delay(self, kwargs_lens, kwargs_ps, kwargs_cosmo): """ routine to compute the log likelihood of the time delay distance :param args: :return: """ x_pos, y_pos = self.imSim.image_positions(kwargs_ps=kwargs_ps, kwargs_lens=kwargs_lens) x_pos, y_pos = self.param.real_image_positions(x_pos[0], y_pos[0], kwargs_cosmo) x_source, y_source = self.imSim.LensModel.ray_shooting( x_pos, y_pos, kwargs_lens) delay_arcsec = self.imSim.LensModel.fermat_potential( x_pos, y_pos, x_source, y_source, kwargs_lens) D_dt_model = kwargs_cosmo['D_dt'] delay_days = const.delay_arcsec2days(delay_arcsec, D_dt_model) logL = self._logL_delays(delay_days, self._delays_measured, self._delays_errors) return logL
def logL(self, kwargs_lens, kwargs_ps, kwargs_cosmo): """ routine to compute the log likelihood of the time delay distance :param kwargs_lens: lens model kwargs list :param kwargs_ps: point source kwargs list :param kwargs_cosmo: cosmology and other kwargs :return: log likelihood of the model given the time delay data """ x_pos, y_pos = self._pointSource.image_position(kwargs_ps=kwargs_ps, kwargs_lens=kwargs_lens, original_position=True) x_pos, y_pos = x_pos[0], y_pos[0] if len(self._delays_measured) != (len(y_pos) - 1): return -np.inf if self.sort_images_by_dec: increasing_dec_i = np.argsort(y_pos) x_pos = x_pos[increasing_dec_i][self._abcd_ordering_i] y_pos = y_pos[increasing_dec_i][self._abcd_ordering_i] delay_arcsec = self._lensModel.fermat_potential(x_pos, y_pos, kwargs_lens) D_dt_model = kwargs_cosmo['D_dt'] delay_days = const.delay_arcsec2days(delay_arcsec, D_dt_model) logL = self._logL_delays(delay_days, self._delays_measured, self._delays_errors) return logL