Changeset 23199 for branches/cnb_branches/cnb_branch_20090215/psModules
- Timestamp:
- Mar 5, 2009, 11:24:29 AM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 1 deleted
- 22 edited
- 2 copied
-
. (modified) (1 prop)
-
psModules/src/camera/pmFPAWrite.c (modified) (3 diffs)
-
psModules/src/config/Makefile.am (modified) (1 diff)
-
psModules/src/config/pmVersion.c (modified) (1 diff)
-
psModules/src/config/pmVersion.h (modified) (3 diffs)
-
psModules/src/imcombine/pmPSFEnvelope.c (modified) (1 diff)
-
psModules/src/objects/Makefile.am (modified) (2 diffs)
-
psModules/src/objects/pmFootprint.c (modified) (3 diffs)
-
psModules/src/objects/pmModel.c (modified) (13 diffs)
-
psModules/src/objects/pmMoments.c (modified) (2 diffs)
-
psModules/src/objects/pmPeaks.c (modified) (19 diffs)
-
psModules/src/objects/pmSource.c (modified) (12 diffs)
-
psModules/src/objects/pmSource.h (modified) (3 diffs)
-
psModules/src/objects/pmSourceContour.c (modified) (20 diffs)
-
psModules/src/objects/pmSourceFitModel.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceFitSet.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V1.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMasks.c (copied) (copied from trunk/psModules/src/objects/pmSourceMasks.c )
-
psModules/src/objects/pmSourceMasks.h (copied) (copied from trunk/psModules/src/objects/pmSourceMasks.h )
-
psModules/src/objects/pmSourceMatch.c (modified) (15 diffs)
-
psModules/src/objects/pmSourceSky.c (modified) (6 diffs)
-
psModules/src/objects/pmSourceUtils.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceVisual.c (modified) (3 diffs)
-
psModules/src/psmodules.h (modified) (1 diff)
-
psModules/src/sky (deleted)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
- Property svn:mergeinfo changed
/trunk merged: 22727-22752,23115-23126,23128,23137-23157,23159-23174,23182-23195,23198
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090215/psModules/src/camera/pmFPAWrite.c
r23197 r23199 692 692 "Centre of covariance matrix in y", -yMinCovar); 693 693 694 // Turn off compression 695 int bitpix = fits->options ? fits->options->bitpix : 0; // Desired bits per pixel 696 psFitsCompression *compress = psFitsCompressionGet(fits); // Current compression options 697 if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 698 psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE"); 699 psFree(extname); 700 psFree(header); 701 psFree(images); 702 psFree(compress); 703 return false; 704 } 705 if (fits->options) { 706 fits->options->bitpix = 0; 707 } 708 694 709 // Write images 695 710 if (!psFitsWriteImageCube(fits, header, images, extname)) { … … 699 714 psFree(header); 700 715 psFree(images); 716 if (fits->options) { 717 fits->options->bitpix = bitpix; 718 } 719 psFitsCompressionApply(fits, compress); 720 psFree(compress); 701 721 return 0; 702 722 } … … 704 724 psFree(header); 705 725 psFree(images); 726 727 // Restore compression 728 if (fits->options) { 729 fits->options->bitpix = bitpix; 730 } 731 if (!psFitsCompressionApply(fits, compress)) { 732 psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE"); 733 psFree(compress); 734 return false; 735 } 736 psFree(compress); 706 737 707 738 return true; -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/Makefile.am
r18905 r23199 1 1 noinst_LTLIBRARIES = libpsmodulesconfig.la 2 2 3 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) 3 PSMODULES_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PSMODULES_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 PSMODULES_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of pmVersion.c, since it gets the version information 8 pmVersion.c: FORCE 9 touch pmVersion.c 10 FORCE: ; 11 12 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) -DPSMODULES_VERSION=\"$(PSMODULES_VERSION)\" -DPSMODULES_BRANCH=\"$(PSMODULES_BRANCH)\" -DPSMODULES_SOURCE=\"$(PSMODULES_SOURCE)\" 4 13 libpsmodulesconfig_la_LDFLAGS = -release $(PACKAGE_VERSION) 5 14 libpsmodulesconfig_la_SOURCES = \ -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.c
r10291 r23199 8 8 #include "pmVersion.h" 9 9 10 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name11 12 10 psString psModulesVersion(void) 13 11 { 14 psString version = NULL; // Version, to return 15 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 16 return version; 12 #ifndef PSMODULES_VERSION 13 #error "PSMODULES_VERSION is not set" 14 #endif 15 #ifndef PSMODULES_BRANCH 16 #error "PSMODULES_BRANCH is not set" 17 #endif 18 return psStringCopy(PSMODULES_BRANCH "@" PSMODULES_VERSION); 17 19 } 20 21 psString psModulesSource(void) 22 { 23 #ifndef PSMODULES_SOURCE 24 #error "PSMODULES_SOURCE is not set" 25 #endif 26 return psStringCopy(PSMODULES_SOURCE); 27 } 28 18 29 19 30 psString psModulesVersionLong(void) 20 31 { 21 psString version = psModulesVersion(); // Version, to return22 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag32 psString version = psModulesVersion(); // Version, to return 33 psString source = psModulesSource(); // Source 23 34 24 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 35 psStringPrepend(&version, "psModules "); 36 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 37 psFree(source); 25 38 26 psFree(tag); 39 #ifdef __OPTIMIZE__ 40 psStringAppend(&version, " optimised"); 41 #else 42 psStringAppend(&version, " unoptimised"); 43 #endif 44 45 #ifdef HAVE_NEBCLIENT 46 psStringAppend(&version, " with nebclient"); 47 #else 48 psStringAppend(&version, " without nebclient"); 49 #endif 50 27 51 return version; 52 }; 53 54 55 bool psModulesVersionHeader(psMetadata *header) 56 { 57 PS_ASSERT_METADATA_NON_NULL(header, false); 58 59 psString version = psModulesVersion(); // Software version 60 psString source = psModulesSource(); // Software source 61 62 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.VERSION", PS_META_REPLACE, 63 "Software version", version); 64 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.SOURCE", PS_META_REPLACE, 65 "S/W source", source); 66 67 psFree(version); 68 psFree(source); 69 70 return true; 28 71 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.h
r12696 r23199 1 1 /* @file pmVersion.h 2 2 * @brief Version functions 3 * 3 * 4 4 * @author Paul Price, IfA 5 5 * @author Eugene Magnier, IfA 6 * 6 * 7 7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 8 * @date $Date: 2007-03-30 21:12:56 $ … … 22 22 * @return psString: String with version name. 23 23 */ 24 psString psModulesVersion( 25 void 26 ); 24 psString psModulesVersion(void); 25 26 /** Get current psModules source 27 * 28 * Returns the current psModules source as a string. 29 * 30 * @return psString: String with source. 31 */ 32 psString psModulesSource(void); 27 33 28 34 /** Get current psModules version (full identification) … … 34 40 psString psModulesVersionLong(void); 35 41 42 /// Populate a header with version information 43 bool psModulesVersionHeader( 44 psMetadata *header ///< Header to populate 45 ); 46 47 36 48 /// @} 37 49 #endif -
branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c
r22722 r23199 115 115 for (int i = 0; i < inputs->n; i++) { 116 116 pmPSF *psf = inputs->data[i]; // PSF of interest 117 if (!psf) { 118 continue; 119 } 117 120 pmResiduals *resid = psf->residuals;// PSF residuals 118 121 psf->residuals = NULL; -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/Makefile.am
r21536 r23199 19 19 pmModelUtils.c \ 20 20 pmSource.c \ 21 pmSourceMasks.c \ 21 22 pmSourceMoments.c \ 22 23 pmSourceExtendedPars.c \ … … 69 70 pmModelUtils.h \ 70 71 pmSource.h \ 72 pmSourceMasks.h \ 71 73 pmSourceExtendedPars.h \ 72 74 pmSourceUtils.h \ -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmFootprint.c
r20937 r23199 28 28 } 29 29 30 psTrace("psModules.objects", 5, "---- begin ----\n");30 psTrace("psModules.objects", 10, "---- begin ----\n"); 31 31 32 32 psFree(tmp->spans); 33 33 psFree(tmp->peaks); 34 34 35 psTrace("psModules.objects", 5, "---- end ----\n");35 psTrace("psModules.objects", 10, "---- end ----\n"); 36 36 } 37 37 … … 42 42 const psImage *image) // region footprint lives in 43 43 { 44 psTrace("psModules.objects", 5, "---- begin ----\n");44 psTrace("psModules.objects", 10, "---- begin ----\n"); 45 45 46 46 static int id = 1; … … 69 69 } 70 70 71 psTrace("psModules.objects", 5, "---- end ----\n");71 psTrace("psModules.objects", 10, "---- end ----\n"); 72 72 return(footprint); 73 73 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmModel.c
r23197 r23199 32 32 static void modelFree(pmModel *tmp) 33 33 { 34 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);34 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 35 35 psFree(tmp->params); 36 36 psFree(tmp->dparams); 37 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);37 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 38 38 } 39 39 … … 44 44 pmModel *pmModelAlloc(pmModelType type) 45 45 { 46 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);46 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 47 47 48 48 pmModelClass *class = pmModelClassSelect (type); … … 87 87 tmp->modelFitStatus = class->modelFitStatus; 88 88 89 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);89 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 90 90 return(tmp); 91 91 } … … 130 130 psF32 pmModelEval(pmModel *model, psImage *image, psS32 col, psS32 row) 131 131 { 132 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);132 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 133 133 PS_ASSERT_PTR_NON_NULL(image, NAN); 134 134 PS_ASSERT_PTR_NON_NULL(model, NAN); … … 144 144 tmpF = model->modelFunc (NULL, model->params, x); 145 145 psFree(x); 146 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);146 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 147 147 return(tmpF); 148 148 } … … 150 150 psF32 pmModelEvalWithOffset(pmModel *model, psImage *image, psS32 col, psS32 row, int dx, int dy) 151 151 { 152 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);152 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 153 153 PS_ASSERT_PTR_NON_NULL(image, false); 154 154 PS_ASSERT_PTR_NON_NULL(model, false); … … 164 164 tmpF = model->modelFunc (NULL, model->params, x); 165 165 psFree(x); 166 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);166 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 167 167 return(tmpF); 168 168 } … … 180 180 ) 181 181 { 182 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);182 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 183 183 184 184 PS_ASSERT_PTR_NON_NULL(model, false); … … 344 344 345 345 psFree(x); 346 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);346 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 347 347 return(true); 348 348 } … … 356 356 psImageMaskType maskVal) 357 357 { 358 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);358 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 359 359 psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, 0.0, 0.0); 360 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);360 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 361 361 return(rc); 362 362 } … … 370 370 psImageMaskType maskVal) 371 371 { 372 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);372 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 373 373 psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, 0.0, 0.0); 374 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);374 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 375 375 return(rc); 376 376 } … … 386 386 int dy) 387 387 { 388 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);388 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 389 389 psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, dx, dy); 390 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);390 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 391 391 return(rc); 392 392 } … … 402 402 int dy) 403 403 { 404 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);404 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 405 405 psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, dx, dy); 406 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);406 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 407 407 return(rc); 408 408 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmMoments.c
r19879 r23199 27 27 pmMoments *pmMomentsAlloc() 28 28 { 29 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);29 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 30 30 pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments)); 31 31 tmp->Mx = 0.0; … … 52 52 tmp->nPixels = 0; 53 53 54 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);54 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 55 55 return(tmp); 56 56 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmPeaks.c
r23197 r23199 37 37 pmPeakType type) 38 38 { 39 psTrace("psModules.objects", 5, "---- begin ----\n");39 psTrace("psModules.objects", 10, "---- begin ----\n"); 40 40 41 41 if (peaks == NULL) { … … 82 82 psFree (peak); 83 83 84 psTrace("psModules.objects", 5, "---- end ----\n");84 psTrace("psModules.objects", 10, "---- end ----\n"); 85 85 return(peaks); 86 86 } … … 96 96 psU32 row) 97 97 { 98 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);98 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 99 99 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 100 100 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL); … … 104 104 tmpVector->data.F32[col] = image->data.F32[row][col]; 105 105 } 106 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);106 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 107 107 return(tmpVector); 108 108 } … … 117 117 psS32 y) 118 118 { 119 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);119 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 120 120 if ((x >= valid.x0) && 121 121 (x <= valid.x1) && 122 122 (y >= valid.y0) && 123 123 (y <= valid.y1)) { 124 psTrace("psModules.objects", 4, "---- %s(true) end ----\n", __func__);124 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 125 125 return(true); 126 126 } 127 psTrace("psModules.objects", 4, "---- %s(false) end ----\n", __func__);127 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 128 128 return(false); 129 129 } … … 140 140 pmPeakType type) 141 141 { 142 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);142 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 143 143 static int id = 1; 144 144 pmPeak *tmp = (pmPeak *) psAlloc(sizeof(pmPeak)); … … 157 157 psMemSetDeallocator(tmp, (psFreeFunc) peakFree); 158 158 159 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);159 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 160 160 return(tmp); 161 161 } … … 172 172 int pmPeaksCompareAscend (const void **a, const void **b) 173 173 { 174 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);174 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 175 175 pmPeak *A = *(pmPeak **)a; 176 176 pmPeak *B = *(pmPeak **)b; … … 180 180 diff = A->value - B->value; 181 181 if (diff < FLT_EPSILON) { 182 psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);182 psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__); 183 183 return (-1); 184 184 } else if (diff > FLT_EPSILON) { 185 psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);185 psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__); 186 186 return (+1); 187 187 } 188 psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);188 psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__); 189 189 return (0); 190 190 } … … 194 194 int pmPeaksCompareDescend (const void **a, const void **b) 195 195 { 196 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);196 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 197 197 pmPeak *A = *(pmPeak **)a; 198 198 pmPeak *B = *(pmPeak **)b; … … 202 202 diff = A->value - B->value; 203 203 if (diff < FLT_EPSILON) { 204 psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);204 psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__); 205 205 return (+1); 206 206 } else if (diff > FLT_EPSILON) { 207 psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);207 psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__); 208 208 return (-1); 209 209 } 210 psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);210 psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__); 211 211 return (0); 212 212 } … … 258 258 psF32 threshold) 259 259 { 260 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);260 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 261 261 PS_ASSERT_VECTOR_NON_NULL(vector, NULL); 262 262 PS_ASSERT_VECTOR_NON_EMPTY(vector, NULL); … … 276 276 tmpVector = psVectorAlloc(0, PS_TYPE_U32); 277 277 } 278 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);278 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 279 279 return(tmpVector); 280 280 } … … 341 341 } 342 342 343 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);343 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 344 344 return(tmpVector); 345 345 } … … 363 363 psArray *pmPeaksInImage(const psImage *image, psF32 threshold) 364 364 { 365 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);365 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 366 366 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 367 367 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL); 368 368 if ((image->numRows == 1) || (image->numCols == 1)) { 369 369 psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns."); 370 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);370 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 371 371 return(NULL); 372 372 } … … 425 425 // 426 426 if (image->numRows == 1) { 427 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);427 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 428 428 return(list); 429 429 } … … 549 549 psFree (tmpRow); 550 550 psFree (row1); 551 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);551 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 552 552 return(list); 553 553 } … … 560 560 const psRegion valid) 561 561 { 562 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);562 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 563 563 PS_ASSERT_PTR_NON_NULL(peaks, NULL); 564 564 … … 575 575 psArrayAdd (output, 200, tmpPeak); 576 576 } 577 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);577 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 578 578 return(output); 579 579 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.c
r23197 r23199 41 41 return; 42 42 43 psTrace("psModules.objects", 5, "---- begin ----\n");43 psTrace("psModules.objects", 10, "---- begin ----\n"); 44 44 psFree(tmp->peak); 45 45 psFree(tmp->pixels); … … 55 55 psFree(tmp->extpars); 56 56 psFree(tmp->blends); 57 psTrace("psModules.objects", 5, "---- end ----\n");57 psTrace("psModules.objects", 10, "---- end ----\n"); 58 58 } 59 59 … … 94 94 pmSource *pmSourceAlloc() 95 95 { 96 psTrace("psModules.objects", 5, "---- begin ----\n");96 psTrace("psModules.objects", 10, "---- begin ----\n"); 97 97 static int id = 1; 98 98 pmSource *source = (pmSource *) psAlloc(sizeof(pmSource)); … … 131 131 source->extNsigma = NAN; 132 132 133 psTrace("psModules.objects", 5, "---- end ----\n");133 psTrace("psModules.objects", 10, "---- end ----\n"); 134 134 return(source); 135 135 } … … 280 280 pmPSFClump pmSourcePSFClump(psRegion *region, psArray *sources, psMetadata *recipe) 281 281 { 282 psTrace("psModules.objects", 5, "---- begin ----\n");282 psTrace("psModules.objects", 10, "---- begin ----\n"); 283 283 284 284 psArray *peaks = NULL; … … 496 496 } 497 497 498 psTrace("psModules.objects", 5, "---- end ----\n");498 psTrace("psModules.objects", 10, "---- end ----\n"); 499 499 return (psfClump); 500 500 } … … 508 508 bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, psImageMaskType maskSat) 509 509 { 510 psTrace("psModules.objects", 5, "---- begin ----");510 psTrace("psModules.objects", 10, "---- begin ----"); 511 511 512 512 PS_ASSERT_PTR_NON_NULL(sources, false); … … 664 664 psTrace ("psModules.objects", 2, "Ncr: %3d\n", Ncr); 665 665 666 psTrace("psModules.objects", 5, "---- end ----\n");666 psTrace("psModules.objects", 10, "---- end ----\n"); 667 667 return true; 668 668 } … … 692 692 psF32 radius) 693 693 { 694 psTrace("psModules.objects", 5, "---- begin ----\n");694 psTrace("psModules.objects", 10, "---- begin ----\n"); 695 695 PS_ASSERT_PTR_NON_NULL(source, false); 696 696 PS_ASSERT_PTR_NON_NULL(source->peak, false); … … 807 807 psTrace ("psModules.objects", 3, "insufficient valid pixels (%d vs %d; %f) for source\n", 808 808 numPixels, (int)(0.75*R2), Sum); 809 psTrace("psModules.objects", 5, "---- end (false) ----\n");809 psTrace("psModules.objects", 10, "---- end (false) ----\n"); 810 810 return (false); 811 811 } … … 824 824 psTrace ("psModules.objects", 3, "large centroid swing; invalid peak %d, %d\n", 825 825 source->peak->x, source->peak->y); 826 psTrace("psModules.objects", 5, "---- end(false) ----\n");826 psTrace("psModules.objects", 10, "---- end(false) ----\n"); 827 827 return (false); 828 828 } … … 850 850 source->moments->Mxx, source->moments->Myy, source->moments->Mxy); 851 851 852 psTrace("psModules.objects", 5, "---- end ----\n");852 psTrace("psModules.objects", 10, "---- end ----\n"); 853 853 return(true); 854 854 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.h
r23197 r23199 19 19 /// @addtogroup Objects Object Detection / Analysis Functions 20 20 /// @{ 21 22 #include <pmSourceMasks.h> 21 23 22 24 /** pmSourceType enumeration … … 34 36 PM_SOURCE_TYPE_EXTENDED, ///< an extended object (eg, galaxy) (subtracted model is EXT) 35 37 } pmSourceType; 36 37 // bit flags to distinguish analysis results38 typedef enum {39 PM_SOURCE_MODE_DEFAULT = 0x00000000, ///< Initial value: resets all bits40 PM_SOURCE_MODE_PSFMODEL = 0x00000001, ///< Source fitted with a psf model (linear or non-linear)41 PM_SOURCE_MODE_EXTMODEL = 0x00000002, ///< Source fitted with an extended-source model42 PM_SOURCE_MODE_FITTED = 0x00000004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)43 PM_SOURCE_MODE_FAIL = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)44 PM_SOURCE_MODE_POOR = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)45 PM_SOURCE_MODE_PAIR = 0x00000020, ///< Source fitted with a double psf46 PM_SOURCE_MODE_PSFSTAR = 0x00000040, ///< Source used to define PSF model47 PM_SOURCE_MODE_SATSTAR = 0x00000080, ///< Source model peak is above saturation48 PM_SOURCE_MODE_BLEND = 0x00000100, ///< Source is a blend with other sourcers49 PM_SOURCE_MODE_EXTERNAL = 0x00000200, ///< Source based on supplied input position50 PM_SOURCE_MODE_BADPSF = 0x00000400, ///< Failed to get good estimate of object's PSF51 PM_SOURCE_MODE_DEFECT = 0x00000800, ///< Source is thought to be a defect52 PM_SOURCE_MODE_SATURATED = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)53 PM_SOURCE_MODE_CR_LIMIT = 0x00002000, ///< Source has crNsigma above limit54 PM_SOURCE_MODE_EXT_LIMIT = 0x00004000, ///< Source has extNsigma above limit55 PM_SOURCE_MODE_MOMENTS_FAILURE = 0x00008000, ///< could not measure the moments56 PM_SOURCE_MODE_SKY_FAILURE = 0x00010000, ///< could not measure the local sky57 PM_SOURCE_MODE_SKYVAR_FAILURE = 0x00020000, ///< could not measure the local sky variance58 PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N59 PM_SOURCE_MODE_BIG_RADIUS = 0x00100000, ///< poor moments for small radius, try large radius60 PM_SOURCE_MODE_AP_MAGS = 0x00200000, ///< source has an aperture magnitude61 PM_SOURCE_MODE_BLEND_FIT = 0x00400000, ///< source was fitted as a blend62 PM_SOURCE_MODE_EXTENDED_FIT = 0x00800000, ///< full extended fit was used63 PM_SOURCE_MODE_EXTENDED_STATS = 0x01000000, ///< extended aperture stats calculated64 PM_SOURCE_MODE_LINEAR_FIT = 0x02000000, ///< source fitted with the linear fit65 PM_SOURCE_MODE_NONLINEAR_FIT = 0x04000000, ///< source fitted with the non-linear fit66 PM_SOURCE_MODE_RADIAL_FLUX = 0x08000000, ///< radial flux measurements calculated67 PM_SOURCE_MODE_SIZE_SKIPPED = 0x10000000, ///< size could not be determined68 } pmSourceMode;69 38 70 39 typedef enum { … … 101 70 pmSourceType type; ///< Best identification of object. 102 71 pmSourceMode mode; ///< analysis flags set for object. 103 pmSourceTmpF tmpFlags; ///< internal-only flags72 pmSourceTmpF tmpFlags; ///< internal-only flags 104 73 psArray *blends; ///< collection of sources thought to be confused with object 105 74 float psfMag; ///< calculated from flux in modelPSF -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceContour.c
r20937 r23199 59 59 { 60 60 61 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);61 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 62 62 63 63 // We define variables incr and lastColumn so that we can use the same loop … … 80 80 float value = image->data.F32[y][subCol]; 81 81 if (value <= threshold) { 82 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);82 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 83 83 return (subCol); 84 84 } 85 85 subCol += incr; 86 86 } 87 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);87 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 88 88 return (lastColumn); 89 89 } … … 99 99 { 100 100 101 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);101 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 102 102 103 103 // We define variables incr and lastColumn so that we can use the same loop … … 119 119 float value = image->data.F32[y][subCol]; 120 120 if (value >= threshold) { 121 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);121 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 122 122 if (subCol == x) { 123 123 return (subCol); … … 127 127 subCol += incr; 128 128 } 129 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);129 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 130 130 return (lastColumn); 131 131 } … … 149 149 psU32 dir) 150 150 { 151 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);151 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 152 152 // 153 153 // Convert coords to subImage space. … … 159 159 if (!((0 <= subCol) && (subCol < source->pixels->numCols))) { 160 160 psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range"); 161 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);161 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 162 162 return(NAN); 163 163 } 164 164 if (!((0 <= subRow) && (subRow < source->pixels->numRows))) { 165 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);165 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 166 166 psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range"); 167 167 return(NAN); … … 172 172 psF32 oldValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow); 173 173 if (oldValue == level) { 174 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);174 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 175 175 return(((psF32) (subCol + source->pixels->col0))); 176 176 } … … 194 194 psF32 newValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow); 195 195 if (oldValue == level) { 196 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);196 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 197 197 return((psF32) (subCol + source->pixels->col0)); 198 198 } … … 200 200 if ((newValue <= level) && (level <= oldValue)) { 201 201 // This is simple linear interpolation. 202 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);202 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 203 203 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) ); 204 204 } … … 206 206 if ((oldValue <= level) && (level <= newValue)) { 207 207 // This is simple linear interpolation. 208 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);208 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 209 209 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) ); 210 210 } … … 213 213 } 214 214 215 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);215 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 216 216 return(NAN); 217 217 } … … 222 222 psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold) 223 223 { 224 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);224 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 225 225 PS_ASSERT_PTR_NON_NULL(image, NULL); 226 226 … … 339 339 tmpArray->data[0] = (psPtr *) xVec; 340 340 tmpArray->data[1] = (psPtr *) yVec; 341 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);341 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 342 342 return(tmpArray); 343 343 } … … 360 360 psF32 level) 361 361 { 362 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);362 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 363 363 PS_ASSERT_PTR_NON_NULL(source, false); 364 364 PS_ASSERT_PTR_NON_NULL(image, false); … … 390 390 psFree(xVec); 391 391 psFree(yVec); 392 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);392 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 393 393 return(NULL); 394 394 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 403 403 psFree(xVec); 404 404 psFree(yVec); 405 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);405 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 406 406 return(NULL); 407 407 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 428 428 psFree(xVec); 429 429 psFree(yVec); 430 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);430 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 431 431 return(NULL); 432 432 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 440 440 psFree(xVec); 441 441 psFree(yVec); 442 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);442 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 443 443 return(NULL); 444 444 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 457 457 tmpArray->data[0] = (psPtr *) yVec; 458 458 tmpArray->data[1] = (psPtr *) xVec; 459 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);459 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 460 460 return(tmpArray); 461 461 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitModel.c
r23197 r23199 58 58 psImageMaskType maskVal) 59 59 { 60 psTrace("psModules.objects", 5, "---- %s begin ----\n", __func__);60 psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__); 61 61 PS_ASSERT_PTR_NON_NULL(source, false); 62 62 PS_ASSERT_PTR_NON_NULL(source->pixels, false); … … 231 231 232 232 rc = (onPic && fitStatus); 233 psTrace("psModules.objects", 5, "---- %s(%d) end ----\n", __func__, rc);233 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 234 234 return(rc); 235 235 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitSet.c
r21363 r23199 446 446 psImageMaskType maskVal) 447 447 { 448 psTrace("psModules.objects", 3, "---- %s begin ----\n", __func__);448 psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__); 449 449 PS_ASSERT_PTR_NON_NULL(source, false); 450 450 PS_ASSERT_PTR_NON_NULL(source->pixels, false); … … 533 533 if (nPix < thisSet->nParamSet + 1) { 534 534 psTrace (__func__, 4, "insufficient valid pixels\n"); 535 psTrace("psModules.objects", 3, "---- %s() end : fail pixels ----\n", __func__);535 psTrace("psModules.objects", 10, "---- %s() end : fail pixels ----\n", __func__); 536 536 for (int i = 0; i < modelSet->n; i++) { 537 537 pmModel *model = modelSet->data[i]; … … 602 602 603 603 bool rc = (onPic && fitStatus); 604 psTrace("psModules.objects", 5, "---- %s end (%d) ----\n", __func__, rc);604 psTrace("psModules.objects", 10, "---- %s end (%d) ----\n", __func__, rc); 605 605 return(rc); 606 606 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c
r23197 r23199 209 209 } 210 210 211 psMetadata *header = psMetadataCopy(NULL, tableHeader); 212 pmSourceMasksHeader(header); 213 211 214 if (table->n == 0) { 212 psFitsWriteBlank (fits, tableHeader, extname); 213 psFree (table); 215 psFitsWriteBlank(fits, header, extname); 216 psFree(table); 217 psFree(header); 214 218 return true; 215 219 } 216 220 217 221 psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname); 218 if (!psFitsWriteTable (fits, tableHeader, table, extname)) {222 if (!psFitsWriteTable(fits, header, table, extname)) { 219 223 psError(PS_ERR_IO, false, "writing ext data %s\n", extname); 220 224 psFree(table); 225 psFree(header); 221 226 return false; 222 227 } 223 psFree (table); 228 psFree(table); 229 psFree(header); 224 230 225 231 return true; -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceMatch.c
r21266 r23199 63 63 pmSource *source = sources->data[i]; // Source of interest 64 64 if (!source) continue; 65 if (source->mode & SOURCE_MASK) continue;66 if (!isfinite(source->psfMag)) continue;67 if (!isfinite(source->errMag)) continue;68 if (source->psfMag > SOURCE_FAINTEST) continue;65 if (source->mode & SOURCE_MASK) continue; 66 if (!isfinite(source->psfMag)) continue; 67 if (!isfinite(source->errMag)) continue; 68 if (source->psfMag > SOURCE_FAINTEST) continue; 69 69 70 70 float xSrc, ySrc; // Coordinates of source … … 290 290 static float sourceMatchRelphotIterate(psVector *trans, // Transparencies 291 291 psVector *stars, // Star magnitudes 292 psVector *badImage, // Bad image mask 292 293 const psArray *matches, // Array of matches 293 294 const psVector *zp, // Zero points for each image (incl. airmass term) … … 363 364 for (int i = 0; i < numImages; i++) { 364 365 trans->data.F32[i] = accum->data.F64[i] / accumErr->data.F64[i]; 365 366 if (!isfinite(trans->data.F32[i])) { 367 badImage->data.U8[i] = 0xFF; 368 } 366 369 psTrace("psModules.objects", 3, "Transparency for image %d: %f\n", i, trans->data.F32[i]); 367 370 } … … 379 382 } 380 383 int index = match->image->data.U32[j]; // Image index 384 if (badImage->data.U8[index]) { 385 continue; 386 } 381 387 float mag = match->mag->data.F32[j]; // Measured magnitude 382 388 float magErr2 = PS_SQR(match->magErr->data.F32[j]) + sysErr2; // Error in measured magnitude … … 402 408 static int sourceMatchRelphotPhotometric(psVector *photo, // Photometric determination 403 409 const psVector *trans, // Estimated transparencies 410 const psVector *badImage, // Bad image? 404 411 int transIter, // Iterations for transparency 405 412 float transClip, // Clipping level for transparency … … 409 416 psAssert(photo && photo->type.type == PS_TYPE_U8, "Need photometric determination"); 410 417 psAssert(trans && trans->type.type == PS_TYPE_F32, "Need transparencies"); 418 psAssert(badImage && badImage->type.type == PS_TYPE_U8, "Need bad image determination"); 411 419 412 420 int numImages = photo->n; // Number of images 413 421 414 422 psAssert(trans->n == numImages, "Not enough transparencies: %ld", trans->n); 423 psAssert(badImage->n == numImages, "Not enough bad image determinations: %ld", badImage->n); 415 424 psAssert(transIter >= 0, "Iterations for transparency must be non-negative: %d", transIter); 416 425 psAssert(transClip > 0, "Clipping level for transparency must be positive: %f", transClip); … … 421 430 stats->clipSigma = transClip; 422 431 423 if (!psVectorStats(stats, trans, NULL, NULL, 0)) {432 if (!psVectorStats(stats, trans, NULL, badImage, 0xFF)) { 424 433 psError(PS_ERR_UNKNOWN, false, "Unable to perform statistics on transparencies."); 425 434 psFree(stats); … … 432 441 int numPhoto = 0; // Number of photometric images 433 442 for (int i = 0; i < numImages; i++) { 443 if (badImage->data.U8[i]) { 444 continue; 445 } 434 446 if (trans->data.F32[i] < thresh) { 435 447 photo->data.U8[i] = 0xFF; … … 451 463 const psVector *zp, // Zero points for each image 452 464 const psVector *photo, // Photometric image? 465 const psVector *badImage, // Bad image? 453 466 float starClip, // Clipping for stars 454 467 float sysErr2 // Systematic error squared … … 468 481 psAssert(!photo || photo->type.type == PS_TYPE_U8, "Photometric determination is wrong type"); 469 482 psAssert(!photo || photo->n == numImages, "Not enough photometric determinations: %ld", photo->n); 483 psAssert(!badImage || badImage->type.type == PS_TYPE_U8, "Photometric determination is wrong type"); 484 psAssert(!badImage || badImage->n == numImages, "Not enough bad determinations: %ld", badImage->n); 470 485 471 486 starClip = PS_SQR(starClip); … … 481 496 numMeasurements++; 482 497 int index = match->image->data.U32[j]; // Image index 498 if (badImage->data.U8[index]) { 499 continue; 500 } 483 501 float mag = match->mag->data.F32[j]; // Measured magnitude 484 502 float magErr = match->magErr->data.F32[j]; // Error in measured magnitude … … 489 507 float dev = mag + cal - stars->data.F32[i]; // Deviation 490 508 491 // only reject detections from photometric images (non-photometric images can492 // have large errors. XXX Or: allow a much higher rejection threshold493 if (photo->data.U8[index]) {494 if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) {495 numRejected++;496 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF;497 }498 }509 // only reject detections from photometric images (non-photometric images can 510 // have large errors. XXX Or: allow a much higher rejection threshold 511 if (photo->data.U8[index]) { 512 if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) { 513 numRejected++; 514 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF; 515 } 516 } 499 517 } 500 518 } … … 529 547 psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image 530 548 psVectorInit(photo, 0); 549 psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image? 550 psVectorInit(badImage, 0); 531 551 psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star 532 552 533 float chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution 553 float chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, 554 photo, sysErr); // chi^2 for solution 534 555 psTrace("psModules.objects", 1, "Initial: chi^2 = %f\n", chi2); 535 556 float lastChi2 = INFINITY; // chi^2 on last iteration … … 540 561 541 562 // Identify photometric nights 542 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip, photoLevel); // Number of photometric images 543 if (numPhoto < 0) { 544 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination"); 545 psFree(trans); 546 psFree(photo); 547 psFree(stars); 548 return NULL; 549 } 550 psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages); 551 552 // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe) 553 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, 20.0, PS_SQR(0.1)); 554 psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100); 555 556 // XXX use 0.05 mag systematic error (move these to the recipe) 557 chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, PS_SQR(0.1)); // chi^2 for solution 558 psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 559 } 560 561 for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) { 562 lastChi2 = chi2; 563 564 // Identify photometric nights 565 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip, 563 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 566 564 photoLevel); // Number of photometric images 567 565 if (numPhoto < 0) { … … 572 570 return NULL; 573 571 } 572 psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages); 573 574 // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe) 575 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, 20.0, PS_SQR(0.1)); 576 psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100); 577 578 // XXX use 0.05 mag systematic error (move these to the recipe) 579 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, PS_SQR(0.1)); 580 psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 581 } 582 583 for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) { 584 lastChi2 = chi2; 585 586 // Identify photometric nights 587 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 588 photoLevel); // Number of photometric images 589 if (numPhoto < 0) { 590 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination"); 591 psFree(trans); 592 psFree(photo); 593 psFree(stars); 594 return NULL; 595 } 574 596 psTrace("psModules.objects", 3, "Determined %d/%d are photometric", numPhoto, numImages); 575 597 576 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, starClip, sysErr);598 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, starClip, sysErr); 577 599 psTrace("psModules.objects", 3, "%f%% of measurements rejected", fracRej * 100); 578 600 579 chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution601 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sysErr); 580 602 psTrace("psModules.objects", 1, "iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 581 603 } 582 604 583 605 psFree(photo); 606 psFree(badImage); 584 607 psFree(stars); 585 608 -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceSky.c
r21363 r23199 55 55 psImageMaskType markVal) 56 56 { 57 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);57 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 58 58 PS_ASSERT_PTR_NON_NULL(source, false); 59 59 PS_ASSERT_IMAGE_NON_NULL(source->pixels, false); … … 91 91 92 92 if (isnan(value)) { 93 psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);93 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 94 94 return(false); 95 95 } … … 98 98 } 99 99 source->moments->Sky = value; 100 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);100 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 101 101 return (true); 102 102 } … … 111 111 ) 112 112 { 113 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);113 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 114 114 PS_ASSERT_PTR_NON_NULL(source, false); 115 115 PS_ASSERT_IMAGE_NON_NULL(source->variance, false); … … 147 147 148 148 if (isnan(value)) { 149 psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);149 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 150 150 return(false); 151 151 } … … 154 154 } 155 155 source->moments->dSky = value; 156 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);156 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 157 157 return (true); 158 158 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceUtils.c
r20937 r23199 49 49 pmModelType modelType) 50 50 { 51 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);51 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 52 52 PS_ASSERT_PTR_NON_NULL(source, NULL); 53 53 PS_ASSERT_PTR_NON_NULL(source->moments, NULL); … … 61 61 } 62 62 63 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);63 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 64 64 return(model); 65 65 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c
r22722 r23199 7 7 #include "pmSourceVisual.h" 8 8 9 # if (HAVE_KAPA)10 # include <kapa.h>9 #if (HAVE_KAPA) 10 #include <kapa.h> 11 11 #include "pmVisual.h" 12 12 … … 155 155 // continue, save (provide name), ?? 156 156 pmVisualAskUser(&plotPSF); 157 157 158 return true; 158 159 } … … 251 252 } 252 253 253 # else 254 # endif 254 #else 255 256 bool pmSourceSetVisual(bool mode) 257 { 258 return true; 259 } 260 261 bool pmSourceVisualPSFModelResid(pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask) 262 { 263 return true; 264 } 265 266 #endif -
branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h
r23197 r23199 114 114 #include <pmPSF.h> 115 115 #include <pmModel.h> 116 #include <pmSourceMasks.h> 116 117 #include <pmSource.h> 117 118 #include <pmSourceUtils.h>
Note:
See TracChangeset
for help on using the changeset viewer.
