- Timestamp:
- Dec 5, 2010, 2:23:08 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20101103/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotMergeSources.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/psphot
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20101103/psphot/src/psphotMergeSources.c
r29904 r29914 163 163 } 164 164 165 // copy the known sources (as external) to the detection list of the given filerule 166 bool psphotAddKnownSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 167 168 bool status = false; 169 170 // select the appropriate recipe information 171 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 172 psAssert (recipe, "missing recipe?"); 173 174 // determine properties (sky, moments) of initial sources 175 float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS"); 176 psAssert (status, "missing SKY_OUTER_RADIUS in recipe?"); 177 178 // XXX this seems like an arbitrary number... 179 OUTER = PS_MAX(OUTER, 20.0); // XXX Guarantee that we can encompass the max moments radius 180 181 // find the currently selected readout 182 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 183 psAssert (file, "missing file?"); 184 185 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 186 psAssert (readout, "missing readout?"); 187 188 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 189 if (!detections) { 190 detections = pmDetectionsAlloc(); 191 detections->newSources = psArrayAllocEmpty (100); 192 // save detections on the readout->analysis 193 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detections", detections)) { 194 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 195 return false; 196 } 197 } else { 198 psMemIncrRefCounter(detections); // so we can free the detections below 199 } 200 201 // copy the sources from inSources to the new detection structure 202 for (int i = 0; i < inSources->n; i++) { 203 pmSource *inSource = inSources->data[i]; 204 205 pmSource *newSource = pmSourceCopy(inSource); 206 newSource->mode |= PM_SOURCE_MODE_EXTERNAL; 207 208 // drop the loaded source modelPSF 209 psFree (newSource->modelPSF); 210 // source->modelPSF = NULL; check this! 211 212 // drop the references to the original image pixels: 213 pmSourceFreePixels (newSource); 214 215 // allocate image, weight, mask for the new image for each peak (square of radius OUTER) 216 pmSourceDefinePixels (newSource, readout, newSource->peak->x, newSource->peak->y, OUTER); 217 218 newSource->imageID = 0; 219 // XXX reset the source ID? raised questions about the meaning of this ID... 220 // P_PM_SOURCE_SET_ID(source, i); 221 222 psArrayAdd (detections->newSources, 100, newSource); 223 } 224 psLogMsg ("psphot", 3, "%ld known sources supplied", detections->newSources->n); 225 226 psFree (detections); 227 return true; 228 } 229 165 230 // extract the input sources corresponding to this readout 166 231 // XXX this function needs to be updated to work with the new context of psphot inputs
Note:
See TracChangeset
for help on using the changeset viewer.
