IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34486


Ignore:
Timestamp:
Sep 27, 2012, 2:27:19 PM (14 years ago)
Author:
Serge CHASTEL
Message:

MOPS want the SEEING value to be the mean of the seeings in each skycell weighted by the number of (valid) detections

Location:
trunk/ppTranslate/src
Files:
3 edited

Legend:

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

    r34279 r34486  
    301301                                                vector->n, newLength);
    302302            }
    303                
    304         }
     303        }
    305304        // XXX IS this safe? Perhaps save in numGood?
    306305        det->num = newLength;
  • trunk/ppTranslate/src/ppMopsRead.c

    r34472 r34486  
    248248    }
    249249    det->seeing *= ((float) plateScale) / ((float) numGood);
    250 
    251     // Are we using numGood for anything outside of this function?
    252250    det->numGood = numGood;
    253251
  • trunk/ppTranslate/src/ppMopsWrite.c

    r34474 r34486  
    4141  // seeings
    4242  ppMopsDetections *det = NULL;
    43   int validSeeingCount = 0;
    4443  for (int d = 0; d < detections->n; d++) {
    4544    if (detections->data[d] != NULL) {
     
    4746        det = detections->data[d];
    4847      }
    49       if (isfinite(((ppMopsDetections*) detections->data[d])->seeing)) {
    50         validSeeingCount += 1;
    51       }
    52     }
    53   }
     48    }
     49  }
     50  //Get the SEEING weighted mean
     51  float seeing = 0.;
     52  int totalGood = 0;
     53  for (int d = 0; d < detections->n; d++) {
     54    if ( (detections->data[d] != NULL) && (isfinite(((ppMopsDetections*) detections->data[d])->seeing)) ) {
     55      seeing += (((ppMopsDetections*) detections->data[d])->seeing)*((float) (((ppMopsDetections*) detections->data[d])->numGood));
     56      totalGood += (((ppMopsDetections*) detections->data[d])->numGood);
     57    }
     58  }
     59  seeing /= (float) totalGood;
    5460  if (det != NULL) {
    55     //Get the SEEING median
    56     psVector* seeingValues = psVectorAlloc(validSeeingCount, PS_TYPE_F32);
    57     psVectorInit(seeingValues, NAN);
    58     validSeeingCount = 0;
    59     for (int d = 0; d < detections->n; d++) {
    60       if ( (detections->data[d] != NULL) && (isfinite(((ppMopsDetections*) detections->data[d])->seeing)) ){
    61         seeingValues->data.F32[validSeeingCount++] = ((ppMopsDetections*) detections->data[d])->seeing;
    62       }
    63     }
    64     psStats *seeingStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
    65     psVectorStats(seeingStats, seeingValues, NULL, NULL, 0);
    6661    psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of exposure midpoint", det->mjd);
    6762    psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight);
     
    7368    psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter);
    7469    psMetadataAddF32(header, PS_LIST_TAIL, "AIRMASS", 0, "Airmass of exposure", det->airmass);
    75     psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", seeingStats->sampleMedian);
     70    psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", seeing);
    7671    //MOPS want the name FWHM for SEEING
    77     psMetadataAddF32(header, PS_LIST_TAIL, "FWHM", 0, "Mean seeing", det->seeing);
     72    psMetadataAddF32(header, PS_LIST_TAIL, "FWHM", 0, "Mean seeing", seeing);
    7873  } else {
    7974    psWarning("no inputs with surviving detections. output header will be incomplete");
Note: See TracChangeset for help on using the changeset viewer.