Changeset 27034
- Timestamp:
- Feb 22, 2010, 4:21:34 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroZeroPoint.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroZeroPoint.c
r26966 r27034 62 62 psVector *dMag = NULL; 63 63 64 float fpaZP = 0.0; // Average zero point 65 int numZP = 0.0; // Number of measurements 66 64 67 // this loop selects the matched stars for all chips 65 68 // XXX optionally measure zero point for entire exposure in a single statistic … … 86 89 psFree (dMag); 87 90 dMag = NULL; 91 92 float zp = psMetadataLookupF32(NULL, header, "ZPT_OBS"); 93 if (isfinite(zp)) { 94 fpaZP += zp; 95 numZP++; 96 } 97 98 88 99 } 89 100 } … … 92 103 93 104 if (byExposure) { 94 psMetadata *header = psMetadataLookupMetadata (&status, fpa->analysis, "PSASTRO.HEADER"); 95 if (!header) { 96 header = psMetadataAlloc (); 97 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", header); 98 psFree (header); 99 } 100 psastroZeroPointAnalysis (header, dMag, zeropt, recipe); 101 psFree (dMag); 102 dMag = NULL; 103 104 float zptObs = psMetadataLookupF32 (&status, header, "ZPT_OBS"); 105 float zptRef = psMetadataLookupF32 (&status, header, "ZPT_REF"); 106 float zptErr = psMetadataLookupF32 (&status, header, "ZPT_ERR"); 107 float zptOff = psMetadataLookupF32 (&status, header, "ZPT_OFF"); 108 109 // copy the zero point metadata from the fpa header to the chip headers 110 for (int i = 0; i < fpa->chips->n; i++) { 111 pmChip *chip = fpa->chips->data[i]; 112 if (!chip) continue; 113 if (!chip->process) continue; 114 if (!chip->file_exists) continue; 115 116 for (int j = 0; j < chip->cells->n; j++) { 117 pmCell *cell = chip->cells->data[j]; 118 if (!cell) continue; 119 if (!cell->process) continue; 120 if (!cell->file_exists) continue; 121 122 for (int k = 0; k < cell->readouts->n; k++) { 123 pmReadout *readout = cell->readouts->data[k]; 124 if (!readout) continue; 125 if (!readout->data_exists) continue; 126 127 // calculate dMag for the matched stars just for this readout (well, chip) 128 psMetadata *header = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 129 130 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_OBS", PS_META_REPLACE, "measured zero point", zptObs); 131 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_REF", PS_META_REPLACE, "reference zero point", zptRef); 132 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_ERR", PS_META_REPLACE, "error on zero point", zptErr); 133 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_OFF", PS_META_REPLACE, "zero point offset", zptOff); 134 } 135 } 136 } 137 } 105 psMetadata *header = psMetadataLookupMetadata (&status, fpa->analysis, "PSASTRO.HEADER"); 106 if (!header) { 107 header = psMetadataAlloc (); 108 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", header); 109 psFree (header); 110 } 111 psastroZeroPointAnalysis (header, dMag, zeropt, recipe); 112 psFree (dMag); 113 dMag = NULL; 114 115 float zptObs = psMetadataLookupF32 (&status, header, "ZPT_OBS"); 116 float zptRef = psMetadataLookupF32 (&status, header, "ZPT_REF"); 117 float zptErr = psMetadataLookupF32 (&status, header, "ZPT_ERR"); 118 float zptOff = psMetadataLookupF32 (&status, header, "ZPT_OFF"); 119 120 fpaZP = zptObs; 121 numZP = 1; 122 123 // copy the zero point metadata from the fpa header to the chip headers 124 for (int i = 0; i < fpa->chips->n; i++) { 125 pmChip *chip = fpa->chips->data[i]; 126 if (!chip) continue; 127 if (!chip->process) continue; 128 if (!chip->file_exists) continue; 129 130 for (int j = 0; j < chip->cells->n; j++) { 131 pmCell *cell = chip->cells->data[j]; 132 if (!cell) continue; 133 if (!cell->process) continue; 134 if (!cell->file_exists) continue; 135 136 for (int k = 0; k < cell->readouts->n; k++) { 137 pmReadout *readout = cell->readouts->data[k]; 138 if (!readout) continue; 139 if (!readout->data_exists) continue; 140 141 // calculate dMag for the matched stars just for this readout (well, chip) 142 psMetadata *header = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 143 144 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_OBS", PS_META_REPLACE, "measured zero point", zptObs); 145 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_REF", PS_META_REPLACE, "reference zero point", zptRef); 146 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_ERR", PS_META_REPLACE, "error on zero point", zptErr); 147 psMetadataAddF32 (header, PS_LIST_TAIL, "ZPT_OFF", PS_META_REPLACE, "zero point offset", zptOff); 148 } 149 } 150 } 151 } 152 138 153 139 154 psMetadataItem *item = psMetadataLookup(fpa->concepts, "FPA.ZP"); 140 item->data.F32 = zeropt;155 item->data.F32 = fpaZP / (float)numZP; 141 156 142 157 psFree (view);
Note:
See TracChangeset
for help on using the changeset viewer.
