IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2006, 10:50:09 AM (20 years ago)
Author:
eugene
Message:

added breakpoints, better exit handling on psphotReadout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotChoosePSF.c

    r6964 r7758  
    2929
    3030    stars = psArrayAlloc (sources->n);
    31     // DROP stars->n = 0;
    3231
    3332    // select the candidate PSF stars (pointers to original sources)
     
    105104    psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid);
    106105
    107     char *breakPt = psMetadataLookupStr (&status, recipe, "BREAK_POINT");
    108     if (!strcasecmp (breakPt, "PSFFIT")) exit (0);
    109 
    110106    return (psf);
    111107}
     
    151147    return true;
    152148}
     149
     150bool psphotMomentsStats (pmReadout *readout, psMetadata *recipe, psArray *sources) {
     151
     152    // without the PSF model, we can only rely on the source->moments
     153    // as a measure of the FWHM values
     154
     155    double FWHM_X, FWHM_Y, FWHM_T;
     156    int FWHM_N;
     157
     158    psEllipseMoments moments;
     159    psEllipseAxes axes;
     160
     161    FWHM_N = 0;
     162    FWHM_X = FWHM_Y = 0.0;
     163
     164    for (int i = 0; i < sources->n; i++) {
     165        pmSource *source = sources->data[i];
     166        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     167       
     168        // moments->Sx,Sy are roughly sigma_x,y
     169        moments.x2 = PS_SQR(source->moments->Sx);
     170        moments.y2 = PS_SQR(source->moments->Sy);
     171        moments.xy = source->moments->Sxy;
     172
     173        axes = psEllipseMomentsToAxes (moments);
     174
     175        FWHM_X += axes.major * 2.35;
     176        FWHM_Y += axes.minor * 2.35;
     177        FWHM_T += axes.theta;
     178        FWHM_N ++;
     179    }
     180
     181    FWHM_X /= FWHM_N;
     182    FWHM_Y /= FWHM_N;
     183    FWHM_T /= FWHM_N;
     184
     185    psMetadataAdd (recipe, PS_LIST_TAIL, "FWHM_X", PS_DATA_F32 | PS_META_REPLACE, "PSF FWHM Major axis", FWHM_X);
     186    psMetadataAdd (recipe, PS_LIST_TAIL, "FWHM_Y", PS_DATA_F32 | PS_META_REPLACE, "PSF FWHM Minor axis", FWHM_Y);
     187    psMetadataAdd (recipe, PS_LIST_TAIL, "ANGLE",  PS_DATA_F32 | PS_META_REPLACE, "PSF angle",           FWHM_T);
     188   
     189    return true;
     190}
Note: See TracChangeset for help on using the changeset viewer.