Changeset 34438 for trunk/ppTranslate/src/ppMopsWrite.c
- Timestamp:
- Sep 13, 2012, 9:42:35 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/ppTranslate/src/ppMopsWrite.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppTranslate/src/ppMopsWrite.c
r34284 r34438 38 38 39 39 // 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 40 42 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 } 43 53 } 44 54 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); 45 66 psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of exposure midpoint", det->mjd); 46 67 psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight); … … 52 73 psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter); 53 74 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); 55 76 } else { 56 77 psWarning("no inputs with surviving detections. output header will be incomplete");
Note:
See TracChangeset
for help on using the changeset viewer.
