IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 12, 2012, 11:07:45 AM (14 years ago)
Author:
Serge CHASTEL
Message:

Bug fix for SEEING value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppTranslate/src/ppMopsRead.c

    r34285 r34435  
    2222  long num = inNames->n;                   // Number of inputs
    2323  psArray *detections = psArrayAlloc(num); // Array of detections, to return
     24  double plateScale = 0.0;        // Plate scale
     25  long numGood = 0;               // Number of good rows
    2426  for (int i = 0; i < num; i++) {
    2527    const char *name = inNames->data[i];
     
    9698    det->mjd = psMetadataLookupF64(NULL, header, "MJD-OBS") + det->exptime / 2.0 / 3600 / 24;
    9799
     100    //It's recomputed
    98101    det->seeing = (float) 0.5 * (psMetadataLookupF32(NULL, header, "FWHM_MAJ") +
    99102                                 psMetadataLookupF32(NULL, header, "FWHM_MIN"));
     
    189192    psVector *angleV = psMetadataLookupVector(NULL, table, "POSANGLE");
    190193    psVector *flagsV = psMetadataLookupVector(NULL, table, "FLAGS");
    191 
    192     double plateScale = 0.0;        // Plate scale
    193     long numGood = 0;               // Number of good rows
     194    long localNumGood = 0;               // Number of good rows in the current skycell
    194195    for (long row = 0; row < size; row++) {
    195196
     
    233234      plateScale += scale;
    234235      numGood++;
    235     }
    236     det->seeing *= ((float) plateScale) / ((float) numGood);
    237 
    238     // Are we using numGood for anything outside of this function?
    239     det->numGood = numGood;
    240 
     236      localNumGood++;
     237    }
    241238    if (isfinite(args->zp) && numGood > 0) {
    242239      psBinaryOp(mag, mag, "+", psScalarAlloc(args->zp, PS_TYPE_F32));
    243240    }
    244241
    245     psTrace("ppMops.read", 2, "Read %ld good rows from %s\n", numGood, (const char*)name);
     242    psTrace("ppMops.read", 2, "Read %ld good rows from %s\n", localNumGood, (const char*)name);
    246243  }
     244  //The seeing is the product of the mean of FWHM_MIN and FWHM_MAJ by
     245  //the mean of the scale values of all "good" detections.
     246  if (numGood > 0) {
     247    //Avoid dividing by 0
     248    det->seeing *= ((float) plateScale) / ((float) numGood);
     249  } else {
     250    det->seeing = NAN;
     251  }
     252  // Are we using numGood for anything outside of this function?
     253  det->numGood = numGood;
    247254
    248255  psTrace("ppMops.read", 1, "Done reading input detections\n");
Note: See TracChangeset for help on using the changeset viewer.