IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 13, 2012, 9:42:35 AM (14 years ago)
Author:
Serge CHASTEL
Message:

SEEING is the median of seeing of each skycell

File:
1 edited

Legend:

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

    r34284 r34438  
    3838
    3939  // Get these header words from the first input non null input
     40  // but for SEEING which is the median of the (non-NULL) detections
     41  // seeings
    4042  ppMopsDetections *det = NULL;
    41   for (int d = 0; d < detections->n && det == NULL; d++) {
    42     det = detections->data[d];
     43  int validSeeingCount = 0;
     44  for (int d = 0; d < detections->n; d++) {
     45    if (detections->data[d] != NULL) {
     46      if (det == NULL) {
     47        det = detections->data[d];
     48      }
     49      if (isfinite(detections->data[d]->seeing)) {
     50        validSeeingCount += 1;
     51      }
     52    }
    4353  }
    4454  if (det != NULL) {
     55    //Get the SEEING median
     56    seeingValues = psVectorAlloc(validSeeingCount, PS_TYPE_F32);
     57    psVectorInit(validSeeingCount, NAN);
     58    validSeeingCount = 0;
     59    for (int d = 0; d < detections->n; d++) {
     60      if ( (detections->data[d] != NULL) && (isfinite(detections->data[d]->seeing)) ){
     61        seeingValues->data.F32[validSeeingCount++] = detections->data[d]->seeing;
     62      }
     63    }
     64    psStats *seeingStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
     65    psVectorStats(seeingStats, seeingValues, NULL, NULL, 0);
    4566    psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of exposure midpoint", det->mjd);
    4667    psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight);
     
    5273    psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter);
    5374    psMetadataAddF32(header, PS_LIST_TAIL, "AIRMASS", 0, "Airmass of exposure", det->airmass);
    54     psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", det->seeing);
     75    psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", seeingStats->sampleMedian);
    5576  } else {
    5677    psWarning("no inputs with surviving detections. output header will be incomplete");
Note: See TracChangeset for help on using the changeset viewer.