Changeset 25383
- Timestamp:
- Sep 15, 2009, 12:45:01 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 35 edited
- 3 copied
-
. (modified) (1 prop)
-
archive/ducttape (modified) (1 prop)
-
catalyst (modified) (1 prop)
-
catalyst/2007.0-specs (modified) (1 prop)
-
catalyst/2008.0-specs (modified) (1 prop)
-
catalyst/2008.0-specs/hardened (modified) (1 prop)
-
doc/misc/docgen.pl (modified) (1 prop)
-
hardware (modified) (1 prop)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (1 prop)
-
ippTests/tap (modified) (1 prop)
-
ippconfig/gpc1/camera.config (modified) (1 diff)
-
ippconfig/recipes/psphot.config (modified) (1 diff)
-
psLib/src/fits/psFits.c (modified) (4 diffs)
-
psLib/src/fits/psFits.h (modified) (1 diff)
-
psLib/src/imageops/psImageConvolve.c (modified) (4 diffs)
-
psLib/src/imageops/psImageConvolve.h (modified) (1 diff)
-
psLib/src/types/psMetadata.c (modified) (4 diffs)
-
psLib/src/types/psMetadata.h (modified) (1 diff)
-
psModules/src/camera/pmFPAMosaic.c (modified) (13 diffs)
-
psModules/src/camera/pmReadoutFake.c (modified) (2 diffs, 1 prop)
-
psModules/src/camera/pmReadoutFake.h (modified) (1 diff)
-
psModules/src/objects/Makefile.am (modified) (2 diffs)
-
psModules/src/objects/pmDetEff.c (copied) (copied from branches/pap/psModules/src/objects/pmDetEff.c )
-
psModules/src/objects/pmDetEff.h (copied) (copied from branches/pap/psModules/src/objects/pmDetEff.h )
-
psModules/src/objects/pmSourceIO.c (modified) (8 diffs)
-
psModules/src/psmodules.h (modified) (1 diff)
-
psphot/doc/efficiency.txt (modified) (1 prop)
-
psphot/src/Makefile.am (modified) (1 diff)
-
psphot/src/psphot.h (modified) (4 diffs)
-
psphot/src/psphotAddNoise.c (modified) (3 diffs)
-
psphot/src/psphotEfficiency.c (copied) (copied from branches/pap/psphot/src/psphotEfficiency.c )
-
psphot/src/psphotFake.c (modified) (1 prop)
-
psphot/src/psphotFitSourcesLinear.c (modified) (1 diff)
-
psphot/src/psphotMagnitudes.c (modified) (2 diffs)
-
psphot/src/psphotReadout.c (modified) (2 diffs)
-
psphot/src/psphotReadoutMinimal.c (modified) (1 diff)
-
psphot/src/psphotReplaceUnfit.c (modified) (1 diff)
-
psphot/src/psphotSignificanceImage.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/pap (added) merged: 25238,25241-25243,25246,25258-25267,25278,25302,25309-25312,25326-25329,25331-25339
- Property svn:mergeinfo changed
-
trunk/archive/ducttape
- Property svn:mergeinfo changed
/trunk/archive/ducttape (added) merged: 2-25002
- Property svn:mergeinfo changed
-
trunk/catalyst
- Property svn:mergeinfo changed
/trunk/catalyst (added) merged: 2-25035
- Property svn:mergeinfo changed
-
trunk/catalyst/2007.0-specs
- Property svn:mergeinfo changed
/trunk/catalyst/2007.0-specs (added) merged: 2-25038
- Property svn:mergeinfo changed
-
trunk/catalyst/2008.0-specs
- Property svn:mergeinfo changed
/trunk/catalyst/2008.0-specs (added) merged: 2-25037
- Property svn:mergeinfo changed
-
trunk/catalyst/2008.0-specs/hardened
- Property svn:mergeinfo changed
/trunk/catalyst/2008.0-specs/hardened (added) merged: 2-25039
- Property svn:mergeinfo changed
-
trunk/doc/misc/docgen.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/hardware
- Property svn:mergeinfo changed
/trunk/hardware (added) merged: 2-25098
- Property svn:mergeinfo changed
-
trunk/ippScripts/scripts/magic_destreak_revert.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ippTests/tap
- Property svn:mergeinfo changed
/trunk/ippTests/tap (added) merged: 2-25040
- Property svn:mergeinfo changed
-
trunk/ippconfig/gpc1/camera.config
r23820 r25383 132 132 CMF.XSRC STR {CHIP.NAME}.xsrc # use .PSF and .EXT? 133 133 CMF.XFIT STR {CHIP.NAME}.xfit # use .PSF and .EXT? 134 CMF.DETEFF STR {CHIP.NAME}.deteff 134 135 135 136 PSF.HEAD STR {CHIP.NAME}.hdr -
trunk/ippconfig/recipes/psphot.config
r24879 r25383 265 265 PSPHOT.CR.NSIGMA.SOFTEN F32 0.0025 # Softening parameter for weights 266 266 267 # Detection efficiency 268 EFF.NUM S32 500 # Number of fake sources per bin 269 @EFF.MAG F32 -2.0 -1.0 -0.5 -0.25 -0.1 -0.05 0.0 0.05 0.1 0.25 0.5 1.0 2.0 # Magnitude of fake sources relative to limit 267 270 268 271 # Recipe overrides for CHIP -
trunk/psLib/src/fits/psFits.c
r25049 r25383 344 344 // Therefore, we implement our own version of moving to an extension specified by name. The pure cfitsio 345 345 // version is used if "conventions.compression" handling is turned off in the psFits structure. 346 bool psFitsMoveExtName(const psFits* fits, 347 const char* extname) 346 static bool fitsMoveExtName(const psFits* fits, // FITS file 347 const char* extname, // Extension name 348 bool errors // Generate errors? 349 ) 348 350 { 349 351 PS_ASSERT_FITS_NON_NULL(fits, false); … … 356 358 // User wants to use cfitsio. Good luck to them! 357 359 if (fits_movnam_hdu(fits->fd, ANY_HDU, (char*)extname, 0, &status) != 0) { 358 psFitsError(status, true, _("Could not find HDU '%s'"), extname); 360 if (errors) { 361 psFitsError(status, true, _("Could not find HDU '%s'"), extname); 362 } 359 363 return false; 360 364 } … … 378 382 if (fits_movabs_hdu(fits->fd, i, &hdutype, &status)) { 379 383 // We've run off the end 380 psFitsError(status, true, _("Could not find HDU with %s = '%s'"), extword, extname); 384 if (errors) { 385 psFitsError(status, true, _("Could not find HDU with %s = '%s'"), extword, extname); 386 } 381 387 return false; 382 388 } … … 406 412 } 407 413 psAbort("Should never reach here."); 414 } 415 416 417 bool psFitsMoveExtName(const psFits* fits, const char* extname) 418 { 419 return fitsMoveExtName(fits, extname, true); 420 } 421 422 bool psFitsMoveExtNameClean(const psFits* fits, const char* extname) 423 { 424 return fitsMoveExtName(fits, extname, false); 408 425 } 409 426 -
trunk/psLib/src/fits/psFits.h
r19035 r25383 245 245 ); 246 246 247 /** Moves the FITS HDU to the specified extension name without generating errors. 248 * 249 * @return bool TRUE if the extension name was found and move was 250 * successful, otherwise FALSE 251 */ 252 bool psFitsMoveExtNameClean( 253 const psFits* fits, ///< the psFits object to move 254 const char* extname ///< the extension name 255 ); 256 247 257 /** Moves the FITS HDU to the specified extension number 248 258 * -
trunk/psLib/src/imageops/psImageConvolve.c
r24272 r25383 678 678 } 679 679 680 static bool imageSmoothMaskPixels(psVector *out, const psImage *image, const psImage *mask, 681 psImageMaskType maskVal, const psVector *x, const psVector *y, 682 const psVector *gaussNorm, float minGauss, int size, int start, int stop) 683 { 684 const psF32 *gauss = &gaussNorm->data.F32[size]; // Gaussian convolution kernel 685 int numCols = image->numCols, numRows = image->numRows; // Size of image 686 int xLast = numCols - 1, yLast = numRows - 1; // Last index 687 for (int i = start; i < stop; i++) { 688 int xPix = x->data.S32[i], yPix = y->data.S32[i]; // Pixel coordinates for smoothing 689 690 int yMin = PS_MAX(yPix - size, 0); 691 int yMax = PS_MIN(yPix + size, yLast); 692 int xMin = PS_MAX(xPix - size, 0); 693 int xMax = PS_MIN(xPix + size, xLast); 694 695 const float *yGauss = &gauss[yMin - yPix]; 696 697 double ySumIG = 0.0, ySumG = 0.0; 698 for (int v = yMin; v <= yMax; v++, yGauss++) { 699 const float *xGauss = &gauss[xMin - xPix]; 700 double xSumIG = 0.0, xSumG = 0.0; 701 const psImageMaskType *maskData = &mask->data.PS_TYPE_IMAGE_MASK_DATA[v][xMin]; 702 const psF32 *imageData = &image->data.F32[v][xMin]; 703 for (int u = xMin; u <= xMax; u++, xGauss++, imageData++, maskData++) { 704 if (*maskData & maskVal) { 705 continue; 706 } 707 xSumIG += *imageData * *xGauss; 708 xSumG += *xGauss; 709 } 710 if (xSumG > minGauss) { 711 ySumIG += xSumIG * *yGauss; 712 ySumG += xSumG * *yGauss; 713 } 714 } 715 716 out->data.F32[i] = ySumG > minGauss ? ySumIG / ySumG : NAN; 717 } 718 719 return true; 720 } 721 722 static bool psImageSmoothMaskPixelsThread(psThreadJob *job) 723 { 724 PS_ASSERT_THREAD_JOB_NON_NULL(job, false); 725 psAssert(job->args, "programming error: no job arguments"); 726 psAssert(job->args->n == 11, "programming error: wrong number of job arguments"); 727 728 psVector *out = job->args->data[0]; // Output vector 729 const psImage *image = job->args->data[1]; // Input image 730 const psImage *mask = job->args->data[2]; // Input mask 731 psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[3], PS_TYPE_IMAGE_MASK_DATA); 732 const psVector *x = job->args->data[4]; 733 const psVector *y = job->args->data[5]; 734 const psVector *gaussNorm = job->args->data[6]; 735 float minGauss = PS_SCALAR_VALUE(job->args->data[7], F32); 736 int size = PS_SCALAR_VALUE(job->args->data[8], S32); 737 int start = PS_SCALAR_VALUE(job->args->data[9], S32); 738 int stop = PS_SCALAR_VALUE(job->args->data[10], S32); 739 return imageSmoothMaskPixels(out, image, mask, maskVal, x, y, gaussNorm, 740 minGauss, size, start, stop); 741 } 742 743 744 psVector *psImageSmoothMaskPixels(const psImage *image, const psImage *mask, psImageMaskType maskVal, 745 const psVector *x, const psVector *y, 746 float sigma, float numSigma, float minGauss) 747 { 748 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 749 PS_ASSERT_IMAGE_NON_NULL(mask, NULL); 750 PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_IMAGE_MASK, NULL); 751 PS_ASSERT_IMAGES_SIZE_EQUAL(image, mask, NULL); 752 PS_ASSERT_VECTOR_NON_NULL(x, NULL); 753 PS_ASSERT_VECTOR_TYPE(x, PS_TYPE_S32, NULL); 754 PS_ASSERT_VECTOR_NON_NULL(y, NULL); 755 PS_ASSERT_VECTOR_TYPE(y, PS_TYPE_S32, NULL); 756 PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL); 757 758 int size = sigma * numSigma + 0.5; // Half-size of kernel 759 760 int num = x->n; // Number of pixels to smooth 761 psVector *out = psVectorAlloc(num, PS_TYPE_F32); // Output results 762 763 // Generate normalized gaussian 764 IMAGE_SMOOTH_GAUSS(gaussNorm, size, sigma, F32); 765 766 // Columns 767 if (threaded) { 768 int numThreads = psThreadPoolSize(); // Number of threads 769 int delta = (numThreads) ? num / numThreads + 1 : num; // Block of cols to do at once 770 for (int start = 0; start < num; start += delta) { 771 int stop = PS_MIN(start + delta, num); // End of block 772 773 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_SMOOTHMASK_PIXELS"); 774 psArrayAdd(job->args, 1, out); 775 psArrayAdd(job->args, 1, (psImage*)image); 776 psArrayAdd(job->args, 1, (psImage*)mask); 777 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 778 psArrayAdd(job->args, 1, (psVector*)x); 779 psArrayAdd(job->args, 1, (psVector*)y); 780 psArrayAdd(job->args, 1, gaussNorm); 781 PS_ARRAY_ADD_SCALAR(job->args, minGauss, PS_TYPE_F32); 782 PS_ARRAY_ADD_SCALAR(job->args, size, PS_TYPE_S32); 783 PS_ARRAY_ADD_SCALAR(job->args, start, PS_TYPE_S32); 784 PS_ARRAY_ADD_SCALAR(job->args, stop, PS_TYPE_S32); 785 if (!psThreadJobAddPending(job)) { 786 psFree(job); 787 psFree(gaussNorm); 788 psFree(out); 789 return NULL; 790 } 791 psFree(job); 792 } 793 } else if (!imageSmoothMaskPixels(out, image, mask, maskVal, x, y, 794 gaussNorm, minGauss, size, 0, num)) { 795 psError(PS_ERR_UNKNOWN, false, "Unable to smooth pixels."); 796 psFree(gaussNorm); 797 psFree(out); 798 return NULL; 799 } 800 801 if (threaded && !psThreadPoolWait(true)) { 802 psError(PS_ERR_UNKNOWN, false, "Error waiting for threads."); 803 psFree(gaussNorm); 804 psFree(out); 805 return NULL; 806 } 807 808 psFree(gaussNorm); 809 return out; 810 } 811 812 680 813 // Smooth an image with masked pixels 681 814 // The calculation and calcMask images are *deliberately* backwards (row,col instead of col,row or … … 1325 1458 if (threaded) { 1326 1459 int numThreads = psThreadPoolSize(); // Number of threads 1327 int deltaRows = (numThreads) ? numRows / numThreads : numRows; // Block of rows to do at once1460 int deltaRows = (numThreads) ? numRows / numThreads + 1 : numRows; // Block of rows to do at once 1328 1461 for (int start = 0; start < numRows; start += deltaRows) { 1329 int stop = PS_MIN (start + deltaRows, numRows); // end of row block1462 int stop = PS_MIN(start + deltaRows, numRows); // end of row block 1330 1463 1331 1464 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_CONVOLVE_MASK"); … … 1363 1496 if (threaded) { 1364 1497 int numThreads = psThreadPoolSize(); // Number of threads 1365 int deltaCols = (numThreads) ? numCols / numThreads : numCols; // Block of cols to do at once1498 int deltaCols = (numThreads) ? numCols / numThreads + 1 : numCols; // Block of cols to do at once 1366 1499 for (int start = 0; start < numCols; start += deltaCols) { 1367 int stop = PS_MIN (start + deltaCols, numCols); // end of col block1500 int stop = PS_MIN(start + deltaCols, numCols); // end of col block 1368 1501 1369 1502 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_CONVOLVE_MASK"); … … 1486 1619 psFree(task); 1487 1620 } 1621 { 1622 psThreadTask *task = psThreadTaskAlloc("PSLIB_IMAGE_SMOOTHMASK_PIXELS", 9); 1623 task->function = &psImageSmoothMaskPixelsThread; 1624 psThreadTaskAdd(task); 1625 psFree(task); 1626 } 1488 1627 } else if (!set && threaded) { 1489 1628 psThreadTaskRemove("PSLIB_IMAGE_CONVOLVE_MASK"); -
trunk/psLib/src/imageops/psImageConvolve.h
r24272 r25383 222 222 ); 223 223 224 /// Smooth particular pixels on an image, allowing for masked pixels 225 /// 226 /// Applies a circularly symmetric Gaussian smoothing first in x and then in y 227 /// directions with just a vector. This process is 2N faster than 2D convolutions (in general). 228 psVector *psImageSmoothMaskPixels( 229 const psImage *image, ///< Input image (F32) 230 const psImage *mask, ///< Mask image 231 psImageMaskType maskVal, ///< Value to mask 232 const psVector *x, ///< x coordinates 233 const psVector *y, ///< y coordinates 234 float sigma, ///< Width of the smoothing kernel (pixels) 235 float numSigma, ///< Size of the smoothing box (sigma) 236 float minGauss ///< Minimum fraction of Gaussian to accept 237 ); 224 238 225 239 psImage *psImageSmoothMask_Threaded(psImage *output, -
trunk/psLib/src/types/psMetadata.c
r21183 r25383 996 996 if (metadataItem->type == PS_DATA_METADATA_MULTI) { 997 997 // if multiple keys found, use the first. 998 // metadataItem = (psMetadataItem*)((metadataItem->data.list)->head);999 998 metadataItem = (psMetadataItem*)(metadataItem->data.list->head->data); 1000 999 if (status) { … … 1082 1081 } \ 1083 1082 \ 1084 /* psFree(metadataItem); currently, the lookup doesn't increment the ref count */ \1085 1083 return value; \ 1086 1084 } … … 1101 1099 psMetadataLookupNumTYPE(VectorMaskType,VectorMask) 1102 1100 psMetadataLookupNumTYPE(ImageMaskType,ImageMask) 1101 1102 #define psMetadataLookupPtrTYPE(TYPENAME,NAME,TYPE,VAL) \ 1103 TYPENAME psMetadataLookup##NAME(bool *status, const psMetadata *md, const char *key) \ 1104 { \ 1105 PS_ASSERT_METADATA_NON_NULL(md, NULL); \ 1106 PS_ASSERT_STRING_NON_EMPTY(key, NULL); \ 1107 psMetadataItem *item = psMetadataLookup((psMetadata*)md, key); /* The item of interest */ \ 1108 if (!item) { \ 1109 if (status) { \ 1110 *status = false; \ 1111 } else { \ 1112 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n", key); \ 1113 } \ 1114 return NULL; \ 1115 } \ 1116 \ 1117 if (item->type == PS_DATA_METADATA_MULTI) { \ 1118 /* if multiple keys found, use the first. */ \ 1119 item = item->data.list->head->data; \ 1120 } \ 1121 if (item->type != TYPE) { \ 1122 if (status) { \ 1123 *status = false; \ 1124 } else { \ 1125 psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_META, as expected.\n", key); \ 1126 } \ 1127 return NULL; \ 1128 } \ 1129 \ 1130 if (status) { \ 1131 *status = true; \ 1132 } \ 1133 return item->data.VAL; \ 1134 } 1135 1136 psMetadataLookupPtrTYPE(psMetadata*, Metadata, PS_DATA_METADATA, md) 1137 psMetadataLookupPtrTYPE(psString, Str, PS_DATA_STRING, str) 1138 psMetadataLookupPtrTYPE(psTime*, Time, PS_DATA_TIME, V) 1139 psMetadataLookupPtrTYPE(psVector*, Vector, PS_DATA_VECTOR, V) 1140 1103 1141 1104 1142 psMetadataItem* psMetadataGet(const psMetadata *md, … … 1257 1295 } 1258 1296 1259 psMetadata *psMetadataLookupMetadata(bool *status, 1260 const psMetadata *md, 1261 const char *key) 1262 { 1263 PS_ASSERT_METADATA_NON_NULL(md,NULL); 1264 psMetadataItem *item = psMetadataLookup((psMetadata*)md, key); // The metadata with instruments 1265 psMetadata *value = NULL; // The value to return 1266 if (!item) { 1267 // The given key isn't in the metadata 1268 if (status) { 1269 *status = false; 1270 } else { 1271 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n", key); 1272 } 1273 } else if (item->type != PS_DATA_METADATA) { 1274 // The value at the key isn't metadata 1275 if (status) { 1276 *status = false; 1277 } else { 1278 psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_META, as expected.\n", key); 1279 } 1280 // value = NULL; 1281 } else { 1282 // We have the requested metadata 1283 if (status) { 1284 *status = true; 1285 } 1286 value = item->data.md; // The requested metadata 1287 } 1288 return value; 1289 } 1290 1291 psTime *psMetadataLookupTime(bool *status, 1292 const psMetadata *md, 1293 const char *key) 1294 { 1295 PS_ASSERT_METADATA_NON_NULL(md,NULL); 1296 1297 psMetadataItem *item = psMetadataLookup((psMetadata*)md, key); 1298 if (!item) { 1299 // The given key isn't in the metadata 1300 if (status) { 1301 *status = false; 1302 } else { 1303 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n", key); 1304 } 1305 return NULL; 1306 } 1307 1308 if (item->type != PS_DATA_TIME) { 1309 // The value at the key isn't metadata 1310 if (status) { 1311 *status = false; 1312 } else { 1313 psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_TIME, as expected.\n", key); 1314 } 1315 return NULL; 1316 } 1317 1318 // We have the requested metadata 1319 if (status) { 1320 *status = true; 1321 } 1322 1323 return item->data.V; 1324 } 1325 1326 1327 psString psMetadataLookupStr(bool *status, 1328 const psMetadata *md, 1329 const char *key) 1330 { 1331 PS_ASSERT_METADATA_NON_NULL(md,NULL); 1332 1333 psMetadataItem *item = psMetadataLookup((psMetadata*)md, key); // The metadata with instruments 1334 // char *value = NULL; // The value to return 1335 psString value = NULL; 1336 if (!item) { 1337 // The given key isn't in the metadata 1338 if (status) { 1339 *status = false; 1340 } else { 1341 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n", key); 1342 } 1343 } else if (item->type != PS_DATA_STRING) { 1344 // The value at the key isn't of the desired type 1345 if (status) { 1346 *status = false; 1347 } else { 1348 psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_STRING, as expected.\n", key); 1349 } 1350 // value = NULL; 1351 } else { 1352 // We have the requested metadata 1353 if (status) { 1354 *status = true; 1355 } 1356 value = item->data.V; 1357 } 1358 return value; 1359 } 1297 1298 1299 1360 1300 1361 1301 psList *psMetadataKeys(psMetadata *md) -
trunk/psLib/src/types/psMetadata.h
r23148 r25383 717 717 PS_METADATA_LOOKUP_TYPE_DECL(Ptr, psPtr); 718 718 PS_METADATA_LOOKUP_TYPE_DECL(Str, psString); 719 PS_METADATA_LOOKUP_TYPE_DECL(Vector, psVector*); 719 720 PS_METADATA_LOOKUP_TYPE_DECL(Metadata, psMetadata*); 720 721 PS_METADATA_LOOKUP_TYPE_DECL(Time, psTime*); -
trunk/psModules/src/camera/pmFPAMosaic.c
r21363 r25383 740 740 static bool chipMosaic(psImage **mosaicImage, // The mosaic image, to be returned 741 741 psImage **mosaicMask, // The mosaic mask, to be returned 742 psImage **mosaicVariance s, // The mosaic variances, to be returned742 psImage **mosaicVariance, // The mosaic variance, to be returned 743 743 int *xBinChip, int *yBinChip, // The binning in x and y, to be returned 744 744 const pmChip *chip, // Chip to mosaic … … 749 749 assert(mosaicImage); 750 750 assert(mosaicMask); 751 assert(mosaicVariance s);751 assert(mosaicVariance); 752 752 assert(xBinChip); 753 753 assert(yBinChip); … … 826 826 if (allGood) { 827 827 *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE); 828 *mosaicVariance s= imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);828 *mosaicVariance = imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE); 829 829 *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, blank); 830 830 } … … 847 847 static bool fpaMosaic(psImage **mosaicImage, // The mosaic image, to be returned 848 848 psImage **mosaicMask, // The mosaic mask, to be returned 849 psImage **mosaicVariance s, // The mosaic variances, to be returned849 psImage **mosaicVariance, // The mosaic variance, to be returned 850 850 int *xBinFPA, int *yBinFPA, // The binning in x and y, to be returned 851 851 const pmFPA *fpa, // FPA to mosaic … … 857 857 assert(mosaicImage); 858 858 assert(mosaicMask); 859 assert(mosaicVariance s);859 assert(mosaicVariance); 860 860 assert(xBinFPA); 861 861 assert(yBinFPA); … … 960 960 if (allGood) { 961 961 *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE); 962 *mosaicVariance s= imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);962 *mosaicVariance = imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE); 963 963 *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, blank); 964 964 } … … 1025 1025 psImage *mosaicImage = NULL; // The mosaic image 1026 1026 psImage *mosaicMask = NULL; // The mosaic mask 1027 psImage *mosaicVariance s= NULL; // The mosaic variances1027 psImage *mosaicVariance = NULL; // The mosaic variances 1028 1028 1029 1029 // Find the HDU … … 1052 1052 } 1053 1053 if (hdu->variances) { 1054 mosaicVariance s= psImageSubset(hdu->variances->data[0], bounds);1055 if (!mosaicVariance s) {1054 mosaicVariance = psImageSubset(hdu->variances->data[0], bounds); 1055 if (!mosaicVariance) { 1056 1056 psError(PS_ERR_UNKNOWN, false, "Unable to select variance pixels.\n"); 1057 1057 return false; … … 1061 1061 // Case 2 --- we need to mosaic by cut and paste 1062 1062 psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n"); 1063 if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicVariance s, &xBin, &yBin, source, targetCell, blank)) {1063 if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicVariance, &xBin, &yBin, source, targetCell, blank)) { 1064 1064 psError(PS_ERR_UNKNOWN, false, "Unable to mosaic cells.\n"); 1065 1065 return false; … … 1069 1069 } 1070 1070 psTrace("psModules.camera", 1, "xBin,yBin: %d,%d\n", xBin, yBin); 1071 1071 1072 1072 1073 // Set the concepts for the target cell … … 1090 1091 target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts); // FPA lvl 1091 1092 1093 // Average the covariances 1094 psList *covariances = psListAlloc(NULL); // Input covariance matrices 1095 for (int i = 0; i < source->cells->n; i++) { 1096 pmCell *cell = source->cells->data[i]; // Cell of interest 1097 if (!cell || !cell->data_exists) { 1098 continue; 1099 } 1100 pmReadout *ro = cell->readouts->data[0]; // Readout of interest 1101 if (!ro || !ro->covariance) { 1102 continue; 1103 } 1104 psListAdd(covariances, PS_LIST_TAIL, ro->covariance); 1105 } 1106 psKernel *mosaicCovariance = NULL; // Covariance for mosaic 1107 if (psListLength(covariances) > 0) { 1108 psArray *covarArray = psListToArray(covariances); // Array with covariances 1109 mosaicCovariance = psImageCovarianceAverage(covarArray); 1110 psFree(covarArray); 1111 } 1112 psFree(covariances); 1113 1092 1114 // Now make a new readout to go in the target cell 1093 1115 pmReadout *newReadout = pmReadoutAlloc(targetCell); // New readout 1094 1116 newReadout->image = mosaicImage; 1095 1117 newReadout->mask = mosaicMask; 1096 newReadout->variance = mosaicVariances; 1118 newReadout->variance = mosaicVariance; 1119 newReadout->covariance = mosaicCovariance; 1097 1120 psFree(newReadout); // Drop reference 1098 1121 … … 1334 1357 target->concepts = psMetadataCopy(target->concepts, source->concepts); 1335 1358 1359 // Average the covariances 1360 psList *covariances = psListAlloc(NULL); // Input covariance matrices 1361 for (int i = 0; i < covariances->n; i++) { 1362 pmChip *chip = chips->data[i]; // Chip of interest 1363 if (!chip || !chip->data_exists) { 1364 continue; 1365 } 1366 psArray *cells = chip->cells; // Cells in chip 1367 for (long j = 0; j < cells->n; j++) { 1368 pmCell *cell = cells->data[i]; // Cell of interest 1369 if (!cell || !cell->data_exists) { 1370 continue; 1371 } 1372 pmReadout *ro = cell->readouts->data[0]; // Readout of interest 1373 if (!ro || !ro->covariance) { 1374 continue; 1375 } 1376 psListAdd(covariances, PS_LIST_TAIL, ro->covariance); 1377 } 1378 } 1379 psKernel *mosaicCovariances = NULL; // Covariance for mosaic 1380 if (psListLength(covariances) > 0) { 1381 psArray *covarArray = psListToArray(covariances); // Array with covariances 1382 mosaicCovariances = psImageCovarianceAverage(covarArray); 1383 psFree(covarArray); 1384 } 1385 psFree(covariances); 1386 1336 1387 // Now make a new readout to go in the new cell 1337 1388 pmReadout *newReadout = pmReadoutAlloc(targetCell); // New readout … … 1339 1390 newReadout->mask = mosaicMask; 1340 1391 newReadout->variance = mosaicVariances; 1392 newReadout->covariance = mosaicCovariances; 1341 1393 psFree(newReadout); // Drop reference 1342 1394 -
trunk/psModules/src/camera/pmReadoutFake.c
- Property svn:mergeinfo changed
/branches/pap/psModules/src/camera/pmReadoutFake.c merged: 25243,25310
r25324 r25383 82 82 } 83 83 PS_ASSERT_PTR_NON_NULL(psf, false); 84 if (radius > 0 && isfinite(minFlux) && minFlux > 0.0) {85 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Cannot define both minimum flux and fixed radius.");86 return false;87 }88 84 89 85 readout->image = psImageRecycle(readout->image, numCols, numRows, PS_TYPE_F32); … … 128 124 pmSource *fakeSource = pmSourceAlloc(); // Fake source to generate 129 125 fakeSource->peak = pmPeakAlloc(xSrc, ySrc, fakeModel->params->data.F32[PM_PAR_I0], PM_PEAK_LONE); 130 float fakeRadius = radius > 0 ? radius : 131 PS_MAX(1.0, fakeModel->modelRadius(fakeModel->params, minFlux)); // Radius of fake source 126 float fakeRadius = 1.0; // Radius of fake source 127 if (isfinite(minFlux)) { 128 fakeRadius = PS_MAX(fakeRadius, fakeModel->modelRadius(fakeModel->params, minFlux)); 129 } 130 if (radius > 0) { 131 fakeRadius = PS_MAX(fakeRadius, radius); 132 } 132 133 133 134 if (xOffset) { - Property svn:mergeinfo changed
-
trunk/psModules/src/camera/pmReadoutFake.h
r25313 r25383 13 13 #include <pmSourceMasks.h> 14 14 15 /// Generate a fake readout from vectors 16 bool pmReadoutFakeFromVectors(pmReadout *readout, ///< Output readout 17 int numCols, int numRows, ///< Dimension of image 18 const psVector *x, const psVector *y, ///< Source coordinates 19 const psVector *mag, ///< Source magnitudes 20 const psVector *xOffset, ///< x offsets for sources (source -> img), or NULL 21 const psVector *yOffset, ///< y offsets for sources (source -> img), or NULL 22 const pmPSF *psf, ///< PSF for sources 23 float minFlux, ///< Minimum flux to bother about; for setting source radius 24 int radius, ///< Fixed radius for sources 25 bool circularise, ///< Circularise PSF model? 26 bool normalisePeak ///< Normalise the peak value? 27 ); 28 15 29 /// Generate a fake readout from an array of sources 16 bool pmReadoutFakeFromSources(pmReadout *readout, ///< Output readout , or NULL30 bool pmReadoutFakeFromSources(pmReadout *readout, ///< Output readout 17 31 int numCols, int numRows, ///< Dimension of image 18 32 const psArray *sources, ///< Array of pmSource -
trunk/psModules/src/objects/Makefile.am
r24875 r25383 53 53 pmGrowthCurveGenerate.c \ 54 54 pmGrowthCurve.c \ 55 pmSourceMatch.c 55 pmSourceMatch.c \ 56 pmDetEff.c 56 57 57 58 EXTRA_DIST = \ … … 90 91 pmTrend2D.h \ 91 92 pmGrowthCurve.h \ 92 pmSourceMatch.h 93 pmSourceMatch.h \ 94 pmDetEff.h 93 95 94 96 CLEANFILES = *~ -
trunk/psModules/src/objects/pmSourceIO.c
r24694 r25383 42 42 #include "pmSource.h" 43 43 #include "pmModelClass.h" 44 #include "pmDetEff.h" 44 45 #include "pmSourceIO.h" 45 46 46 47 #define BLANK_HEADERS "BLANK.HEADERS" // Name of metadata in camera configuration containing header names 47 48 // for putting values into a blank PHU 49 50 // lookup the EXTNAME values used for table data and image header segments 51 static bool sourceExtensions(psString *headname, // Extension name for header 52 psString *dataname, // Extension name for data 53 psString *deteffname, // Extension name for detection efficiency 54 psString *xsrcname, // Extension name for extended sources 55 psString *xfitname, // Extension name for extended fits 56 const pmFPAfile *file, // File of interest 57 const pmFPAview *view // View to level of interest 58 ) 59 { 60 bool status; // Status of MD lookup 61 62 // Menu of EXTNAME rules 63 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 64 if (!menu) { 65 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 66 return false; 67 } 68 69 // EXTNAME for image header 70 if (headname) { 71 const char *rule = psMetadataLookupStr(&status, menu, "CMF.HEAD"); 72 if (!rule) { 73 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config"); 74 return false; 75 } 76 *headname = pmFPAfileNameFromRule(rule, file, view); 77 } 78 79 // EXTNAME for table data 80 if (dataname) { 81 const char *rule = psMetadataLookupStr(&status, menu, "CMF.DATA"); 82 if (!rule) { 83 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config"); 84 return false; 85 } 86 *dataname = pmFPAfileNameFromRule(rule, file, view); 87 } 88 89 // EXTNAME for detection efficiency 90 if (deteffname) { 91 const char *rule = psMetadataLookupStr(&status, menu, "CMF.DETEFF"); 92 if (!rule) { 93 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DETEFF in EXTNAME.RULES in camera.config"); 94 return false; 95 } 96 *deteffname = pmFPAfileNameFromRule(rule, file, view); 97 } 98 99 // EXTNAME for extended source data table 100 if (xsrcname) { 101 const char *rule = psMetadataLookupStr(&status, menu, "CMF.XSRC"); 102 if (!rule) { 103 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XSRC in EXTNAME.RULES in camera.config"); 104 return false; 105 } 106 *xsrcname = pmFPAfileNameFromRule (rule, file, view); 107 } 108 109 if (xfitname) { 110 // EXTNAME for extended source data table 111 const char *rule = psMetadataLookupStr(&status, menu, "CMF.XFIT"); 112 if (!rule) { 113 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XFIT in EXTNAME.RULES in camera.config"); 114 return false; 115 } 116 *xfitname = pmFPAfileNameFromRule (rule, file, view); 117 } 118 119 return true; 120 } 121 48 122 49 123 // translations between psphot object types and dophot object types … … 271 345 272 346 char *exttype = NULL; 273 char *dataname = NULL;274 char *xsrcname = NULL;275 char *xfitname = NULL;276 char *headname = NULL;277 347 278 348 // if sources is NULL, write out an empty table … … 354 424 355 425 // define the EXTNAME values for the different data segments: 356 { 357 // lookup the EXTNAME values used for table data and image header segments 358 char *rule = NULL; 359 360 // Menu of EXTNAME rules 361 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 362 if (!menu) { 363 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 364 return false; 365 } 366 367 // EXTNAME for image header 368 rule = psMetadataLookupStr(&status, menu, "CMF.HEAD"); 369 if (!rule) { 370 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config"); 371 return false; 372 } 373 headname = pmFPAfileNameFromRule (rule, file, view); 374 375 // EXTNAME for table data 376 rule = psMetadataLookupStr(&status, menu, "CMF.DATA"); 377 if (!rule) { 378 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config"); 379 return false; 380 } 381 dataname = pmFPAfileNameFromRule (rule, file, view); 382 383 if (XSRC_OUTPUT) { 384 // EXTNAME for extended source data table 385 rule = psMetadataLookupStr(&status, menu, "CMF.XSRC"); 386 if (!rule) { 387 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XSRC in EXTNAME.RULES in camera.config"); 388 return false; 389 } 390 xsrcname = pmFPAfileNameFromRule (rule, file, view); 391 } 392 if (XFIT_OUTPUT) { 393 // EXTNAME for extended source data table 394 rule = psMetadataLookupStr(&status, menu, "CMF.XFIT"); 395 if (!rule) { 396 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XFIT in EXTNAME.RULES in camera.config"); 397 return false; 398 } 399 xfitname = pmFPAfileNameFromRule (rule, file, view); 400 } 426 psString headname = NULL; 427 psString dataname = NULL; 428 psString deteffname = NULL; 429 psString xsrcname = NULL; 430 psString xfitname = NULL; 431 if (!sourceExtensions(&headname, &dataname, &deteffname, XSRC_OUTPUT ? &xsrcname : NULL, 432 XFIT_OUTPUT ? &xfitname : NULL, file, view)) { 433 return false; 401 434 } 402 435 … … 480 513 481 514 // XXX these are case-sensitive since the EXTYPE is case-sensitive 482 status = false;515 status = true; 483 516 if (!strcmp (exttype, "SMPDATA")) { 484 status = pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname);517 status &= pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname); 485 518 } 486 519 if (!strcmp (exttype, "PS1_DEV_0")) { 487 status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname);520 status &= pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname); 488 521 } 489 522 if (!strcmp (exttype, "PS1_DEV_1")) { 490 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname);523 status &= pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname); 491 524 } 492 525 if (!strcmp (exttype, "PS1_CAL_0")) { 493 status = pmSourcesWrite_PS1_CAL_0 (file->fits, readout, sources, file->header, outhead, dataname);526 status &= pmSourcesWrite_PS1_CAL_0 (file->fits, readout, sources, file->header, outhead, dataname); 494 527 } 495 528 if (!strcmp (exttype, "PS1_V1")) { 496 status = pmSourcesWrite_CMF_PS1_V1 (file->fits, readout, sources, file->header, outhead, dataname);529 status &= pmSourcesWrite_CMF_PS1_V1 (file->fits, readout, sources, file->header, outhead, dataname); 497 530 } 498 531 if (!strcmp (exttype, "PS1_V2")) { 499 status = pmSourcesWrite_CMF_PS1_V2 (file->fits, readout, sources, file->header, outhead, dataname); 500 } 532 status &= pmSourcesWrite_CMF_PS1_V2 (file->fits, readout, sources, file->header, outhead, dataname); 533 } 534 535 if (deteffname) { 536 status &= pmReadoutWriteDetEff(file->fits, readout, outhead, deteffname); 537 } 538 501 539 if (xsrcname) { 502 540 if (!strcmp (exttype, "PS1_DEV_1")) { 503 status = pmSourcesWrite_PS1_DEV_1_XSRC (file->fits, sources, xsrcname, recipe);541 status &= pmSourcesWrite_PS1_DEV_1_XSRC (file->fits, sources, xsrcname, recipe); 504 542 } 505 543 if (!strcmp (exttype, "PS1_CAL_0")) { 506 status = pmSourcesWrite_PS1_CAL_0_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe);544 status &= pmSourcesWrite_PS1_CAL_0_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 507 545 } 508 546 if (!strcmp (exttype, "PS1_V1")) { 509 status = pmSourcesWrite_CMF_PS1_V1_XSRC (file->fits, sources, xsrcname, recipe);547 status &= pmSourcesWrite_CMF_PS1_V1_XSRC (file->fits, sources, xsrcname, recipe); 510 548 } 511 549 if (!strcmp (exttype, "PS1_V2")) { 512 status = pmSourcesWrite_CMF_PS1_V2_XSRC (file->fits, sources, xsrcname, recipe);550 status &= pmSourcesWrite_CMF_PS1_V2_XSRC (file->fits, sources, xsrcname, recipe); 513 551 } 514 552 } 515 553 if (xfitname) { 516 554 if (!strcmp (exttype, "PS1_DEV_1")) { 517 status = pmSourcesWrite_PS1_DEV_1_XFIT (file->fits, sources, xfitname);555 status &= pmSourcesWrite_PS1_DEV_1_XFIT (file->fits, sources, xfitname); 518 556 } 519 557 if (!strcmp (exttype, "PS1_CAL_0")) { 520 status = pmSourcesWrite_PS1_CAL_0_XFIT (file->fits, readout, sources, file->header, xfitname);558 status &= pmSourcesWrite_PS1_CAL_0_XFIT (file->fits, readout, sources, file->header, xfitname); 521 559 } 522 560 if (!strcmp (exttype, "PS1_V1")) { 523 status = pmSourcesWrite_CMF_PS1_V1_XFIT (file->fits, sources, xfitname);561 status &= pmSourcesWrite_CMF_PS1_V1_XFIT (file->fits, sources, xfitname); 524 562 } 525 563 if (!strcmp (exttype, "PS1_V2")) { 526 status = pmSourcesWrite_CMF_PS1_V2_XFIT (file->fits, sources, xfitname);564 status &= pmSourcesWrite_CMF_PS1_V2_XFIT (file->fits, sources, xfitname); 527 565 } 528 566 } … … 572 610 // not needed if only one chip 573 611 if (file->fpa->chips->n == 1) { 574 pmSourceIO_WriteMatchedRefs (file->fits, file->fpa, config);575 return true;612 pmSourceIO_WriteMatchedRefs (file->fits, file->fpa, config); 613 return true; 576 614 } 577 615 … … 885 923 hdu = pmFPAviewThisHDU (view, file->fpa); 886 924 887 // lookup the EXTNAME values used for table data and image header segments 888 char *rule = NULL; 889 // Menu of EXTNAME rules 890 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 891 if (!menu) { 892 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 893 return false; 894 } 895 // EXTNAME for image header 896 rule = psMetadataLookupStr(&status, menu, "CMF.HEAD"); 897 if (!rule) { 898 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config"); 899 return false; 900 } 901 char *headname = pmFPAfileNameFromRule (rule, file, view); 902 // EXTNAME for table data 903 rule = psMetadataLookupStr(&status, menu, "CMF.DATA"); 904 if (!rule) { 905 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config"); 906 return false; 907 } 908 char *dataname = pmFPAfileNameFromRule (rule, file, view); 925 // define the EXTNAME values for the different data segments: 926 psString headname = NULL; 927 psString dataname = NULL; 928 psString deteffname = NULL; 929 if (!sourceExtensions(&headname, &dataname, &deteffname, NULL, NULL, file, view)) { 930 return false; 931 } 909 932 910 933 // advance to the IMAGE HEADER extension … … 958 981 sources = pmSourcesRead_CMF_PS1_V2 (file->fits, hdu->header); 959 982 } 983 984 if (!pmReadoutReadDetEff(file->fits, readout, deteffname)) { 985 psError(PS_ERR_IO, false, "Unable to read detection efficiency"); 986 return false; 987 } 960 988 } 961 989 … … 1070 1098 } 1071 1099 1072 1100 -
trunk/psModules/src/psmodules.h
r24891 r25383 133 133 #include <pmSourceVisual.h> 134 134 #include <pmSourceMatch.h> 135 #include <pmDetEff.h> 135 136 136 137 // The following headers are from random locations, here because they cross bounds -
trunk/psphot/doc/efficiency.txt
- Property svn:mergeinfo changed
/trunk/psphot/doc/efficiency.txt merged: 25137-25229
- Property svn:mergeinfo changed
-
trunk/psphot/src/Makefile.am
r24586 r25383 128 128 psphotCheckStarDistribution.c \ 129 129 psphotThreadTools.c \ 130 psphotAddNoise.c 130 psphotAddNoise.c \ 131 psphotEfficiency.c 131 132 132 133 # dropped? psphotGrowthCurve.c -
trunk/psphot/src/psphot.h
r24890 r25383 49 49 bool psphotPSFstats (pmReadout *readout, psMetadata *recipe, pmPSF *psf); 50 50 bool psphotMomentsStats (pmReadout *readout, psMetadata *recipe, psArray *sources); 51 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, psMetadata *recipe,pmPSF *psf, bool final);51 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, const psMetadata *recipe, const pmPSF *psf, bool final); 52 52 bool psphotReplaceUnfitSources (psArray *sources, psImageMaskType maskVal); 53 53 54 54 bool psphotReplaceAllSources (psArray *sources, psMetadata *recipe); 55 bool psphotRemoveAllSources ( psArray *sources,psMetadata *recipe);55 bool psphotRemoveAllSources (const psArray *sources, const psMetadata *recipe); 56 56 57 57 bool psphotBlendFit (pmConfig *config, pmReadout *readout, psArray *sources, pmPSF *psf); … … 64 64 bool psphotGuessModel_Threaded (psThreadJob *job); 65 65 66 bool psphotMagnitudes (pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, pmPSF *psf);66 bool psphotMagnitudes (pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, const pmPSF *psf); 67 67 bool psphotMagnitudes_Threaded (psThreadJob *job); 68 68 … … 76 76 bool psphotExtendedSourceAnalysis (pmReadout *readout, psArray *sources, psMetadata *recipe); 77 77 bool psphotExtendedSourceFits (pmReadout *readout, psArray *sources, psMetadata *recipe); 78 bool psphotEfficiency(pmConfig *config, pmReadout *readout, const pmFPAview *view, const pmPSF *psf, psMetadata *recipe, const psArray *realSources); 78 79 79 80 // thread-related: … … 147 148 pmPSF *psphotLoadPSF (pmConfig *config, const pmFPAview *view, psMetadata *recipe); 148 149 bool psphotSetHeaderNstars (psMetadata *recipe, psArray *sources); 149 bool psphotAddNoise (pmReadout *readout, psArray *sources,psMetadata *recipe);150 bool psphotSubNoise (pmReadout *readout, psArray *sources,psMetadata *recipe);151 bool psphotAddOrSubNoise (pmReadout *readout, psArray *sources,psMetadata *recipe, bool add);150 bool psphotAddNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe); 151 bool psphotSubNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe); 152 bool psphotAddOrSubNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe, bool add); 152 153 bool psphotRadialPlot (int *kapa, const char *filename, pmSource *source); 153 154 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe); -
trunk/psphot/src/psphotAddNoise.c
r21519 r25383 1 1 # include "psphotInternal.h" 2 2 3 bool psphotAddNoise (pmReadout *readout, psArray *sources,psMetadata *recipe) {3 bool psphotAddNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe) { 4 4 return psphotAddOrSubNoise (readout, sources, recipe, true); 5 5 } 6 6 7 bool psphotSubNoise (pmReadout *readout, psArray *sources,psMetadata *recipe) {7 bool psphotSubNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe) { 8 8 return psphotAddOrSubNoise (readout, sources, recipe, false); 9 9 } 10 10 11 bool psphotAddOrSubNoise (pmReadout *readout, psArray *sources,psMetadata *recipe, bool add) {11 bool psphotAddOrSubNoise (pmReadout *readout, const psArray *sources, const psMetadata *recipe, bool add) { 12 12 13 13 bool status = false; … … 42 42 PS_ASSERT (status, false); 43 43 if (isfinite(GAIN)) { 44 FACTOR /= GAIN;44 FACTOR /= GAIN; 45 45 } 46 46 … … 70 70 oldshape.sxy = PAR[PM_PAR_SXY]; 71 71 72 // XXX can this be done more intelligently?73 if (oldI0 == 0.0) continue;74 if (!isfinite(oldI0)) continue;72 // XXX can this be done more intelligently? 73 if (oldI0 == 0.0) continue; 74 if (!isfinite(oldI0)) continue; 75 75 76 76 // increase size and height of source -
trunk/psphot/src/psphotFake.c
- Property svn:mergeinfo changed
/trunk/psphot/src/psphotFake.c merged: 25137-25229
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotFitSourcesLinear.c
r23445 r25383 12 12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psImageMaskType markVal); 13 13 14 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, psMetadata *recipe,pmPSF *psf, bool final) {14 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, const psMetadata *recipe, const pmPSF *psf, bool final) { 15 15 16 16 bool status; -
trunk/psphot/src/psphotMagnitudes.c
r23349 r25383 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMagnitudes(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, pmPSF *psf) {3 bool psphotMagnitudes(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, const pmPSF *psf) { 4 4 5 5 bool status = false; … … 64 64 65 65 psArrayAdd(job->args, 1, cells->data[j]); // sources 66 psArrayAdd(job->args, 1, psf);66 psArrayAdd(job->args, 1, (pmPSF*)psf); // Casting away const 67 67 psArrayAdd(job->args, 1, binning); 68 68 psArrayAdd(job->args, 1, backModel); -
trunk/psphot/src/psphotReadout.c
r24890 r25383 61 61 // display the backsub and backgnd images 62 62 psphotVisualShowBackground (config, view, readout); 63 63 64 64 // run a single-model test if desired (exits from here if test is run) 65 65 psphotModelTest (config, view, recipe); … … 224 224 psphotMagnitudes(config, readout, view, sources, psf); 225 225 226 if (!psphotEfficiency(config, readout, view, psf, recipe, sources)) { 227 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 228 psErrorClear(); 229 } 230 226 231 // replace failed sources? 227 232 // psphotReplaceUnfitSources (sources); -
trunk/psphot/src/psphotReadoutMinimal.c
r24890 r25383 97 97 psphotMagnitudes(config, readout, view, sources, psf); 98 98 99 if (!psphotEfficiency(config, readout, view, psf, recipe, sources)) { 100 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 101 psErrorClear(); 102 } 103 99 104 // drop the references to the image pixels held by each source 100 105 psphotSourceFreePixels (sources); -
trunk/psphot/src/psphotReplaceUnfit.c
r21519 r25383 47 47 } 48 48 49 bool psphotRemoveAllSources ( psArray *sources,psMetadata *recipe) {49 bool psphotRemoveAllSources (const psArray *sources, const psMetadata *recipe) { 50 50 51 51 bool status; -
trunk/psphot/src/psphotSignificanceImage.c
r21407 r25383 22 22 } 23 23 24 bool status_x, status_y; 25 float FWHM_X = psMetadataLookupF32 (&status_x, recipe, "FWHM_X"); 26 float FWHM_Y = psMetadataLookupF32 (&status_y, recipe, "FWHM_Y"); 27 if (status_x && status_y) { 28 // if we know the FHWM, use that to set the smoothing kernel (XXX allow an optional override?) 29 SIGMA_SMTH = 0.5*(FWHM_X + FWHM_Y) / (2.0*sqrt(2.0*log(2.0))); 30 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 31 guess = false; 24 bool statusMajor, statusMinor; 25 float fwhmMajor = psMetadataLookupF32(&statusMajor, recipe, "FWHM_MAJ"); 26 float fwhmMinor = psMetadataLookupF32(&statusMinor, recipe, "FWHM_MIN"); 27 if (statusMajor && statusMinor) { 28 // if we know the FHWM, use that to set the smoothing kernel (XXX allow an optional override?) 29 if (!isfinite(fwhmMajor) || !isfinite(fwhmMinor) || fwhmMajor == 0.0 || fwhmMinor == 0.0) { 30 psWarning("fwhmMajor (%f) or fwhmMinor (%f) is bad!", fwhmMajor, fwhmMinor); 31 } 32 SIGMA_SMTH = 0.5*(fwhmMajor + fwhmMinor) / (2.0*sqrt(2.0*log(2.0))); 33 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 34 guess = false; 32 35 } else { 33 // if we do not know the FWHM, use the guess smoothing kernel supplied.34 // it is a configuration error if these are not supplied35 SIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA");36 PS_ASSERT (status, NULL);37 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA");38 PS_ASSERT (status, NULL);39 guess = true;36 // if we do not know the FWHM, use the guess smoothing kernel supplied. 37 // it is a configuration error if these are not supplied 38 SIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA"); 39 PS_ASSERT (status, NULL); 40 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 41 PS_ASSERT (status, NULL); 42 guess = true; 40 43 } 41 44 // record the actual smoothing sigma
Note:
See TracChangeset
for help on using the changeset viewer.
