#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

# include "psphot.h"

// 2006.02.02 : no leaks
bool psphotRoughClass (psArray *sources, psMetadata *recipe) {

    pmPSFClump   psfClump;

    psfClump = pmSourcePSFClump (sources, recipe);
    psLogMsg ("psphot", 3, "psf clump  X,  Y: %f, %f\n", psfClump.X, psfClump.Y);
    psLogMsg ("psphot", 3, "psf clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY);

    // did we find a valid psfClump?
    if (!psfClump.X || !psfClump.Y) {
	psError(PSPHOT_ERR_PSF, true, "Failed to find a valid PSF clump");
	return false;
    }

    // group into STAR, COSMIC, EXTENDED, SATURATED, etc.
    pmSourceRoughClass (sources, recipe, psfClump);

    // optional printout of source moments only
    psphotDumpMoments (recipe, sources);

    return true;
}
