- Timestamp:
- Sep 5, 2012, 3:54:44 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20120805/psModules
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
src/objects/pmSource.c (modified) (4 diffs)
-
src/objects/pmSource.h (modified) (1 diff)
-
src/objects/pmSourceIO_CMF.c.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120805/psModules
- Property svn:mergeinfo changed
/trunk/psModules (added) merged: 34315,34318,34362
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20120805/psModules/src/objects/pmSource.c
r34375 r34396 263 263 PS_ASSERT_INT_POSITIVE(Radius, false); 264 264 265 psRegion s rcRegion;265 psRegion sourceRegion; 266 266 267 267 // Grab a subimage of the original image of size (2 * outerRadius). 268 s rcRegion = psRegionForSquare (x, y, Radius);269 s rcRegion = psRegionForImage (readout->image, srcRegion);268 sourceRegion = psRegionForSquare (x, y, Radius); 269 sourceRegion = psRegionForImage (readout->image, sourceRegion); 270 270 271 271 // these images are subset images of the equivalent parents 272 mySource->pixels = psImageSubset(readout->image, s rcRegion);272 mySource->pixels = psImageSubset(readout->image, sourceRegion); 273 273 if (readout->variance) { 274 mySource->variance = psImageSubset(readout->variance, s rcRegion);274 mySource->variance = psImageSubset(readout->variance, sourceRegion); 275 275 } 276 276 if (readout->mask) { 277 mySource->maskView = psImageSubset(readout->mask, s rcRegion);277 mySource->maskView = psImageSubset(readout->mask, sourceRegion); 278 278 // the object mask is a copy, and used to define the source pixels 279 279 mySource->maskObj = psImageCopy(NULL, mySource->maskView, PS_TYPE_IMAGE_MASK); 280 280 } 281 mySource->region = s rcRegion;281 mySource->region = sourceRegion; 282 282 mySource->windowRadius = Radius; 283 283 … … 417 417 int nValid = 0; // Number of valid sources 418 418 for (int i = 0; i < sources->n; i++) { 419 pmSource *s rc= sources->data[i]; // Source of interest420 if (!s rc || !src->moments) {419 pmSource *source = sources->data[i]; // Source of interest 420 if (!source || !source->moments) { 421 421 continue; 422 422 } 423 423 424 424 if (region) { 425 int x = s rc->peak->x, y = src->peak->y; // Coordinates of peak425 int x = source->peak->x, y = source->peak->y; // Coordinates of peak 426 426 if (x < region->x0 || x > region->x1 || y < region->y0 || y > region->y1) { 427 427 continue; … … 429 429 } 430 430 431 if (s rc->mode & PM_SOURCE_MODE_BLEND) {432 continue; 433 } 434 435 if (!s rc->moments->nPixels) continue;436 437 if (s rc->moments->SN < PSF_SN_LIM) {431 if (source->mode & PM_SOURCE_MODE_BLEND) { 432 continue; 433 } 434 435 if (!source->moments->nPixels) continue; 436 437 if (source->moments->SN < PSF_SN_LIM) { 438 438 psTrace("psModules.objects", 10, "Rejecting source from clump because of low S/N (%f)\n", 439 s rc->moments->SN);440 continue; 441 } 442 443 float Mxx = s rc->moments->Mxx, Myy = src->moments->Myy; // Second moments439 source->moments->SN); 440 continue; 441 } 442 443 float Mxx = source->moments->Mxx, Myy = source->moments->Myy; // Second moments 444 444 float ar = Mxx / Myy; // Radius 445 445 … … 1508 1508 return NULL; 1509 1509 } 1510 1511 // Function to estimate the memory consumed by a source. 1512 #define IMAGE_BYTES(_im, _pix_size) (_im ? (sizeof(psImage) + (_im->numRows * sizeof(void*)) + (_im->numRows * _im->numCols * _pix_size * (_im->parent ? 0 : 1))) : 0) 1513 1514 #define VECTOR_BYTES(_v, _elem_size) (_v ? (sizeof(psVector) + (_v->n * _elem_size)) : 0) 1515 1516 // estimate the memory consumed by this source. 1517 // It doesn't count everything (a couple of psArrays), the big stuff is counted 1518 psU64 pmSourceMemoryUse (pmSource *source) { 1519 psU64 bytes = sizeof(pmSource) + sizeof(pmPeak) + sizeof(pmMoments); 1520 1521 bytes += IMAGE_BYTES(source->pixels, 4); 1522 bytes += IMAGE_BYTES(source->variance, 4); 1523 bytes += IMAGE_BYTES(source->modelVar, 4); 1524 bytes += IMAGE_BYTES(source->maskObj, 2); 1525 bytes += IMAGE_BYTES(source->maskView, 2); 1526 bytes += IMAGE_BYTES(source->modelFlux, 4); 1527 bytes += IMAGE_BYTES(source->psfImage, 4); 1528 1529 if (source->modelFits) { 1530 for (int i = 0; i < source->modelFits->n; i++) { 1531 pmModel *model = source->modelFits->data[i]; 1532 if (!model) continue; 1533 bytes += sizeof(pmModel); 1534 bytes += IMAGE_BYTES(model->covar, 4); 1535 bytes += VECTOR_BYTES(model->params, 4); 1536 bytes += VECTOR_BYTES(model->dparams, 4); 1537 if (model->residuals) { 1538 bytes += sizeof(pmResiduals); 1539 bytes += IMAGE_BYTES(model->residuals->Ro, 4); 1540 bytes += IMAGE_BYTES(model->residuals->Rx, 4); 1541 bytes += IMAGE_BYTES(model->residuals->Ry, 4); 1542 bytes += IMAGE_BYTES(model->residuals->variance, 4); 1543 bytes += IMAGE_BYTES(model->residuals->mask, 2); 1544 } 1545 } 1546 } 1547 if (source->radialAper) { 1548 for (int i = 0; i < source->radialAper->n; i++) { 1549 pmSourceRadialApertures *radialAper = source->radialAper->data[i]; 1550 if (radialAper) { 1551 bytes += sizeof(pmSourceRadialApertures); 1552 bytes += VECTOR_BYTES(radialAper->flux, 4); 1553 bytes += VECTOR_BYTES(radialAper->fluxStdev, 4); 1554 bytes += VECTOR_BYTES(radialAper->fluxErr, 4); 1555 bytes += VECTOR_BYTES(radialAper->fill, 4); 1556 } 1557 } 1558 } 1559 1560 return bytes; 1561 } -
branches/eam_branches/ipp-20120805/psModules/src/objects/pmSource.h
r34375 r34396 324 324 char *pmSourceModeToString (const pmSourceMode mode); 325 325 326 psU64 pmSourceMemoryUse(pmSource *source); 327 326 328 /// @} 327 329 # endif /* PM_SOURCE_H */ -
branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO_CMF.c.in
r34383 r34396 399 399 @PS1_DV?@ } 400 400 401 @ALL@ source->mode = psMetadataLookupU32 (&status, row, "FLAGS"); 402 @>PS1_V2,PS1_SV?,>PS1_DV1@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2"); 401 @ALL@ source->mode = psMetadataLookupU32 (&status, row, "FLAGS"); 402 @>PS1_V2,PS1_SV?,>PS1_DV1@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2"); 403 @ALL@ source->nFrames = psMetadataLookupU16 (&status, row, "N_FRAMES"); 403 404 assert (status); 404 405
Note:
See TracChangeset
for help on using the changeset viewer.
