Esempio n. 1
0
    def evaluate_one_psf(self, psf, background=0, threshold=-1e9, **kwargs):
        stamp = psf - background
        stamp = np.where(stamp > threshold, stamp, 0)

        # get moment matrix
        Mx, My, Mxx, Mxy, Myy, A, rho4, \
            x2, xy, y2, x3, x2y, xy2, y3 \
            = adaptive_moments(stamp, **self.adaptive_moments_kwargs)

        fwhm = np.sqrt(np.sqrt(Mxx * Myy - Mxy * Mxy))
        whisker = np.sqrt(np.sqrt(Mxy * Mxy + 0.25 * np.square(Mxx - Myy)))
        # 2 (1 + a4) = rho4
        a4 = 0.5 * rho4 - 1
        # update return_dict
        return_dict = {
                'Mx': Mx, 'My': My,
                'Mxx': Mxx, 'Mxy': Mxy, 'Myy': Myy,
                'fwhm': fwhm, 'flux': A, 'a4': a4, 'whisker': whisker,
                'x2': x2, 'xy': xy, 'y2': y2,
                'x3': x3, 'x2y': x2y, 'xy2': xy2, 'y3': y3,
                }
        # now get the poles etc
        return_dict = convert_moments(return_dict)
        # this gives us: e0, e1, e2, delta1, delta2, zeta1, zeta2

        return return_dict
Esempio n. 2
0
    def evaluate_one_psf(self, psf):
        # get moment matrix
        Mx, My, Mxx, Mxy, Myy, A, rho4, \
            x2, xy, y2, x3, x2y, xy2, y3 \
            = adaptive_moments(psf, **self.adaptive_moments_kwargs)

        fwhm = np.sqrt(np.sqrt(Mxx * Myy - Mxy * Mxy))
        whisker = np.sqrt(np.sqrt(Mxy * Mxy + 0.25 * np.square(Mxx - Myy)))
        # 2 (1 + a4) = rho4
        a4 = 0.5 * rho4 - 1
        # update return_dict
        # Mx and My are the centroids. Mxx etc are 2x off of x2 if I remember
        # correctly. See centered_moment in the pyx file for why.
        return_dict = {
                'Mx': Mx, 'My': My,
                'Mxx': Mxx, 'Mxy': Mxy, 'Myy': Myy,
                'fwhm': fwhm, 'flux': A, 'a4': a4, 'whisker': whisker,
                'x2': x2, 'xy': xy, 'y2': y2,
                'x3': x3, 'x2y': x2y, 'xy2': xy2, 'y3': y3,
                }
        # now get the poles etc
        return_dict = convert_moments(return_dict)
        # this gives us: e0, e1, e2, delta1, delta2, zeta1, zeta2

        return return_dict
Esempio n. 3
0
    def evaluate_one_psf_moment(self, psf, p, q, background=0, threshold=-1e9,
                                **kwargs):
        stamp = psf - background
        stamp = np.where(stamp > threshold, stamp, 0)

        # get moment matrix
        Mx, My, Mxx, Mxy, Myy, A, rho4, \
            x2, xy, y2, x3, x2y, xy2, y3 \
            = adaptive_moments(stamp, **self.adaptive_moments_kwargs)

        # now do the centered moment
        moment = centered_moment(psf, p, q, Mx, My, Mxx, Mxy, Myy)

        return moment