code: def logL(self, args):
          
          #extract parameters
          kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo = self.param.args2kwargs(args)
          #generate image and computes likelihood
          self._reset_point_source_cache(bool=True)
          logL = 0
          if self._check_bounds is True:
              penalty, bound_hit = self.check_bounds(args, self._lower_limit, self._upper_limit)
              logL -= penalty
              if bound_hit:
                  return logL, None
          if self._image_likelihood is True:
              logL += self.image_likelihood.logL(kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps)
          if self._time_delay_likelihood is True:
              logL += self.time_delay_likelihood.logL(kwargs_lens, kwargs_ps, kwargs_cosmo)
          if self._check_positive_flux is True:
              bool = self.param.check_positive_flux(kwargs_source, kwargs_lens_light, kwargs_ps)
              if bool is False:
                  logL -= 10**10
          if self._flux_ratio_likelihood is True:
              logL += self.flux_ratio_likelihood.logL(kwargs_lens, kwargs_ps, kwargs_cosmo)
          logL += self._position_likelihood.logL(kwargs_lens, kwargs_ps, kwargs_cosmo)
          logL += self._prior_likelihood.logL(kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo)
          self._reset_point_source_cache(bool=False)
          return logL, None
docs: routine to compute X2 given variable parameters for a MCMC/PSO chain