code: def add_poisson(image, exp_time):
      
      """
      adds a poison (or Gaussian) distributed noise with mean given by surface brightness
      """
      if isinstance(exp_time, int) or isinstance(exp_time, float):
          if exp_time <= 0:
              exp_time = 1
      else:
          mean_exp_time = np.mean(exp_time)
          exp_time[exp_time < mean_exp_time/10] = mean_exp_time/10
      sigma = np.sqrt(np.abs(image)/exp_time) # Gaussian approximation for Poisson distribution, normalized to exposure time
      nx, ny = np.shape(image)
      poisson = np.random.randn(nx, ny) * sigma
      return poisson
docs: adds a poison (or Gaussian) distributed noise with mean given by surface brightness
      :param image: pixel values (photon counts per unit exposure time)
      :param exp_time: exposure time
      :return: Poisson noise realization of input image