- Timestamp:
- Mar 29, 2015, 5:55:41 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150112/psphot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150112/psphot
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20150112/psphot/src
- Property svn:ignore
-
old new 27 27 psmakecff 28 28 psphotFullForceSummary 29 psphotVersionDefinitions.h.tmp
-
- Property svn:ignore
-
branches/eam_branches/ipp-20150112/psphot/src/psphotReadoutCleanup.c
r37767 r38057 54 54 psArray *sources = detections ? detections->allSources : NULL; 55 55 // XXX where do we free these, in here (psMetadataRemove?) 56 57 int quality = psMetadataLookupS32 (&status, readout->analysis, "PSPHOT_QUALITY"); 58 if (quality) { 59 // if there is no stats file this will be a no-op 60 psphotStatsFileSetQuality(quality); 61 } 56 62 57 63 // use the psf-model to measure FWHM stats … … 111 117 return true; 112 118 } 119 120 // for now, let's store the detections on the readout->analysis for each readout 121 bool psphotReadoutCleanupMinimal (pmConfig *config, const pmFPAview *view, const char *filerule) 122 { 123 bool status = true; 124 125 // remove internal pmFPAfiles, if created 126 if (psErrorCodeLast() == (psErrorCode) PSPHOT_ERR_DATA) { 127 psErrorStackPrint(stderr, "Error in the psphot readout analysis"); 128 psErrorClear(); 129 } 130 if (psErrorCodeLast() != PS_ERR_NONE) { 131 return false; 132 } 133 134 // select the appropriate recipe information 135 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 136 psAssert (recipe, "missing recipe?"); 137 138 int num = psphotFileruleCount(config, filerule); 139 140 // loop over the available readouts 141 for (int i = 0; i < num; i++) { 142 if (!psphotReadoutCleanupReadoutMinimal (config, view, filerule, i, recipe)) { 143 psError (PSPHOT_ERR_CONFIG, false, "failed on psphotReadoutCleanupMinimal for %s entry %d", filerule, i); 144 return false; 145 } 146 } 147 148 // XXX move this to top of loop? 149 pmKapaClose (); 150 151 return true; 152 } 153 154 // psphotReadoutCleanupMinimal is called on exit from psphotReadoutMinimal. If the last raised error is 155 // not a DATA error, then there was a serious problem. Only in this case, or if the fail 156 // on the stats measurement, do we return false 157 bool psphotReadoutCleanupReadoutMinimal (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 158 159 bool status = true; 160 161 // find the currently selected readout 162 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 163 psAssert (file, "missing file?"); 164 165 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 166 psAssert (readout, "missing readout?"); 167 168 // when psphotReadoutCleanupMinimal is called, these are not necessarily defined 169 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 170 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 171 psArray *sources = detections ? detections->allSources : NULL; 172 // XXX where do we free these, in here (psMetadataRemove?) 173 174 // create an output header with stats results currently saved on readout->analysis 175 psMetadata *header = psphotDefineHeader (readout->analysis); 176 177 // write NSTARS to the image header 178 psphotSetHeaderNstars (header, sources); 179 180 // save the results of the analysis 181 // this should happen way up stream (when needed?) 182 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER", PS_DATA_METADATA | PS_META_REPLACE, "header stats", header); 183 184 if (psf) { 185 // XXX this seems a little silly : we saved the psf on readout->analysis above, but now 186 // we are moving it to chip->analysis. 187 // save the psf for possible output. if there was already an entry, it was loaded from external sources 188 // the new one may have been updated or modified, so replace the existing entry. We 189 // are required to save it on the chip, but this will cause problems if we ever want to 190 // run psphot on an unmosaiced image 191 pmCell *cell = readout->parent; 192 pmChip *chip = cell->parent; 193 psMetadataAdd (chip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE, "psphot psf", psf); 194 } 195 196 if (psErrorCodeLast() != PS_ERR_NONE) { 197 psErrorStackPrint(stderr, "unexpected remaining errors"); 198 abort(); 199 } 200 201 psFree (header); 202 return true; 203 }
Note:
See TracChangeset
for help on using the changeset viewer.
