IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2005, 8:41:28 PM (21 years ago)
Author:
eugene
Message:

using source masks to select PSF stars

File:
1 edited

Legend:

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

    r4115 r4116  
    453453                            const psVector* dz)
    454454{
     455    PS_VECTOR_CHECK_NULL(mask, NULL);
     456    PS_VECTOR_CHECK_NULL(x, NULL);
     457    PS_VECTOR_CHECK_NULL(y, NULL);
     458    PS_VECTOR_CHECK_NULL(z, NULL);
     459    PS_VECTOR_CHECK_NULL(dz, NULL);
     460
    455461    psVector *zFit   = NULL;
    456     psVector *zResid = NULL;
    457     psStats  *stats  = NULL;
     462    psVector *zResid = psVectorAlloc (x->n, PS_TYPE_F64);
     463    psStats  *stats  = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
    458464
    459465    for (int N = 0; N < 3; N++) {
    460466        poly   = VectorFitPolynomial2DOrd_EAM (poly, mask, x, y, z, dz);
    461467        zFit   = Polynomial2DEvalVectorD (poly, x, y);
    462         zResid = (psVector *) psBinaryOp (NULL, (void *) z, "-", (void *) zFit);
    463 
    464         stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     468        zResid = (psVector *) psBinaryOp (zResid, (void *) z, "-", (void *) zFit);
     469
    465470        stats  = psVectorStats (stats, zResid, NULL, mask, 1);
    466         psTrace (".psphot.RobustFit", 4, "residual stats for robust fit:  %g +/- %g (%d pts)\n",
    467                  stats->clippedMean, stats->clippedStdev, stats->clippedNvalues);
     471        psTrace (".psphot.RobustFit", 4, "residual stats for robust fit:  %g +/- %g\n",
     472                 stats->sampleMean, stats->sampleStdev);
    468473
    469474        // set mask if pts are not valid
    470         int n = 0;
     475        // we are masking out any point which is out of range
     476        // recovery is not allowed with this scheme
    471477        for (int i = 0; i < zResid->n; i++) {
    472             if (fabs(zResid->data.F64[i] - stats->clippedMean) > 3*stats->clippedStdev) {
    473               mask->data.U8[i] = 1;
    474               continue;
    475             } else {
    476               mask->data.U8[i] = 0;
    477             }         
    478             n++;
    479         }
    480     }
     478          if (mask->data.U8[i]) continue;
     479          if (fabs(zResid->data.F64[i] - stats->sampleMean) > 3*stats->sampleStdev) {
     480            mask->data.U8[i] = 1;
     481            continue;
     482          }       
     483        }
     484        psFree (zFit);
     485    }
     486    psFree (zResid);
     487    psFree (stats);
    481488    return (poly);
    482489}
Note: See TracChangeset for help on using the changeset viewer.