def displace_psf(self, x, y): """ :param x: x-coordinate of light ray :param y: y-coordinate of light ray :return: x', y' displaced by the two dimensional PSF distribution function """ return util.displace_PSF_gaussian(x, y, self._fwhm)
def test_sample_gaussian(self): np.random.seed(41) n = 1000 FWHM = 1 pos_x, pos_y = [], [] for i in range(n): x, y = velocity_util.displace_PSF_gaussian(0, 0, FWHM) pos_x.append(x) pos_y.append(y) sigma = FWHM / (2 * np.sqrt(2 * np.log(2))) sigma_x = np.std(pos_x) npt.assert_almost_equal(sigma, sigma_x, decimal=1)