IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 24, 2012, 3:52:04 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120905/ppTranslate/src/ppMopsWrite.c

    r34466 r34566  
    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;
     56      totalGood += 1;
     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);
     71    //MOPS want the name FWHM for SEEING
     72    psMetadataAddF32(header, PS_LIST_TAIL, "FWHM", 0, "Mean seeing", seeing);
    7673  } else {
    7774    psWarning("no inputs with surviving detections. output header will be incomplete");
     
    7976  psMetadataAddStr(header, PS_LIST_TAIL, "OBSCODE", 0, "IAU Observatory code", OBSERVATORY_CODE);
    8077  psMetadataAddF32(header, PS_LIST_TAIL, "MAGZP", 0, "Magnitude zero point", args->zp);
     78  //MOPS want the name ZEROPOINT for MAGZP
     79  psMetadataAddF32(header, PS_LIST_TAIL, "ZEROPOINT", 0, "Magnitude zero point", args->zp);
    8180  psMetadataAddF32(header, PS_LIST_TAIL, "MAGZPERR", 0, "Error in magnitude zero point", args->zpErr);
    8281  psMetadataAddF32(header, PS_LIST_TAIL, "ASTRORMS", 0, "RMS of astrometric fit", args->rmsAstrom);
     82  psMetadataAddStr(header, PS_LIST_TAIL, "COMMENT", 0, "Exposure comment", args->comment);
     83  psMetadataAddStr(header, PS_LIST_TAIL, "OBS_MODE", 0, "Exposure observation mode", args->obsMode);
     84  psMetadataAddStr(header, PS_LIST_TAIL, "DIFFTYPE", 0, "WW: Warp-Warp diff / WS: Warp-Stack diff / SW: Stack-Warp diff", args->difftype);
     85  psMetadataAddF32(header, PS_LIST_TAIL, "SKY", 0, "Exposure avg sky background", args->sky);
     86  psMetadataAddStr(header, PS_LIST_TAIL, "SHUTOUTC", 0, "Camera exposure shutter open (UTC)", args->shutoutc);
    8387
    8488  //field in header that tells about the CMF version
     
    187191                     0);
    188192      if (args->version == 3) {
    189         // TODO: Write data of version 3 (see ICD)
     193        // Write data of version 3 (see ICD)
     194        psMetadataAdd (row, PS_LIST_TAIL, "RA_EXT",         PS_DATA_F32, "Fitted centroid RA",
     195                       0);
     196        psMetadataAdd (row, PS_LIST_TAIL, "RA_EXT_SIGMA",   PS_DATA_F32, "Fitted RA sigma",
     197                       0);
     198        psMetadataAdd (row, PS_LIST_TAIL, "DEC_EXT",        PS_DATA_F32, "Fitted centroid DEC",
     199                       0);
     200        psMetadataAdd (row, PS_LIST_TAIL, "DEC_EXT_SIGMA",  PS_DATA_F32, "Fitted DEC sigma",
     201                       0);
     202        psMetadataAdd (row, PS_LIST_TAIL, "POSANG_EXT",     PS_DATA_F32, "Fitted position angle",
     203                       0);
     204        psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE_EXT",   PS_DATA_F32, "Plate scale at centroid",
     205                       0);
     206        psMetadataAdd (row, PS_LIST_TAIL, "EXT_FLUX",       PS_DATA_F32, "Fitted flux",
     207                       0);
     208        psMetadataAdd (row, PS_LIST_TAIL, "EXT_CAL_MAG",    PS_DATA_F32, "Calibrated mag",
     209                       0);
     210        psMetadataAdd (row, PS_LIST_TAIL, "EXT_MAG_SIG",    PS_DATA_F32, "Mag sigma",
     211                       0);
     212        psMetadataAdd (row, PS_LIST_TAIL, "EXT_CHISQ",      PS_DATA_F32, "Chi^2 of fit",
     213                       0);
     214        psMetadataAdd (row, PS_LIST_TAIL, "EXT_NDOF",       PS_DATA_F32, "Fit degrees of freedom",
     215                       0);
    190216      }
    191217    }
     
    276302      addColumn("EXT_THETA_ERR", NULL, 0);
    277303    }
     304    if (args->version >= 3) {
     305      addColumn("RA_EXT", NULL, 0);
     306      addColumn("RA_EXT_SIGMA", NULL, 0);
     307      addColumn("DEC_EXT", NULL, 0);
     308      addColumn("DEC_EXT_SIGMA", NULL, 0);
     309      addColumn("POSANG_EXT", NULL, 0);
     310      addColumn("PLTSCALE_EXT", NULL, 0);
     311      addColumn("EXT_FLUX", NULL, 0);
     312      addColumn("EXT_CAL_MAG", NULL, 0);
     313      addColumn("EXT_MAG_SIG", NULL, 0);
     314      addColumn("EXT_CHISQ", NULL, 0);
     315      addColumn("EXT_NDOF", NULL, 0);
     316    }
     317
    278318    if (!psFitsWriteTableAllColumns(fits, header, table, OUT_EXTNAME)) {
    279319      psError(psErrorCodeLast(), false, "Unable to write table");
Note: See TracChangeset for help on using the changeset viewer.