Changeset 34486 for trunk/ppTranslate/src/ppMopsWrite.c
- Timestamp:
- Sep 27, 2012, 2:27:19 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ppTranslate/src/ppMopsWrite.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppTranslate/src/ppMopsWrite.c
r34474 r34486 41 41 // seeings 42 42 ppMopsDetections *det = NULL; 43 int validSeeingCount = 0;44 43 for (int d = 0; d < detections->n; d++) { 45 44 if (detections->data[d] != NULL) { … … 47 46 det = detections->data[d]; 48 47 } 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; 54 60 if (det != NULL) { 55 //Get the SEEING median56 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);66 61 psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of exposure midpoint", det->mjd); 67 62 psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight); … … 73 68 psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter); 74 69 psMetadataAddF32(header, PS_LIST_TAIL, "AIRMASS", 0, "Airmass of exposure", det->airmass); 75 psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", seeing Stats->sampleMedian);70 psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", seeing); 76 71 //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); 78 73 } else { 79 74 psWarning("no inputs with surviving detections. output header will be incomplete");
Note:
See TracChangeset
for help on using the changeset viewer.
