- Timestamp:
- Mar 9, 2009, 3:41:26 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStackSources.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
- Property svn:mergeinfo changed
/branches/eam_branches/eam_branch_20090303 (added) merged: 23158,23175-23181,23202-23210,23220-23225 /trunk merged: 23211-23219,23226-23238
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackSources.c
r23199 r23239 81 81 82 82 float radius = psMetadataLookupF32(NULL, recipe, "ZP.RADIUS"); // Radius (pixels) for matching sources 83 int iter = psMetadataLookupS32(NULL, recipe, "ZP.ITER"); // Maximum iterations 83 int iter1 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.1"); // Maximum iterations for pass 1 84 int iter2 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.2"); // Maximum iterations for pass 2 84 85 float tol = psMetadataLookupF32(NULL, recipe, "ZP.TOL"); // Tolerance for zero point iterations 85 86 int transIter = psMetadataLookupS32(NULL, recipe, "ZP.TRANS.ITER"); // Iterations for transparency 86 87 float transRej = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.REJ");// Rejection threshold for transparency 87 88 float transThresh = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.THRESH"); // Threshold for transparency 88 float starRej = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ"); // Rejection threshold for stars 89 90 float starRej1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.1"); // Rejection threshold for stars 91 float starSys1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.1"); // Estimated systematic error 92 float starRej2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.2"); // Rejection threshold for stars 93 float starSys2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.2"); // Estimated systematic error 94 89 95 float starLimit = psMetadataLookupF32(NULL, recipe, "ZP.STAR.LIMIT"); // Limit on star rejection fraction 90 float starSys = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS"); // Estimated systematic error 96 97 float fracMatch = psMetadataLookupF32(NULL, recipe, "ZP.MATCH"); // Fraction of images to match for star 91 98 92 99 psMetadata *airmassZP = psMetadataLookupMetadata(NULL, recipe, "ZP.AIRMASS"); // Airmass terms … … 110 117 pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout 111 118 pmPSF *psf = psMetadataLookupPtr(NULL, config->arguments, "PSF.TARGET"); // PSF for fake image 112 pmReadoutFakeFromSources(fake, FAKE_COLS, FAKE_ROWS, sourceLists->data[i], NULL, NULL, psf, 5, 0, false, true); 119 pmReadoutFakeFromSources(fake, FAKE_COLS, FAKE_ROWS, sourceLists->data[i], 120 NULL, NULL, psf, 5, 0, false, true); 113 121 psString name = NULL; 114 122 psStringAppend(&name, "start_%03d.fits", i); … … 153 161 } 154 162 155 psArray *matches = pmSourceMatchSources(sourceLists, radius ); // List of matches163 psArray *matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches 156 164 if (!matches) { 157 165 psError(PS_ERR_UNKNOWN, false, "Unable to match sources"); … … 164 172 #endif 165 173 166 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, 167 transThresh, starRej, starSys); // Transparencies for each image 174 psVector *trans = pmSourceMatchRelphot(matches, zp, tol, iter1, starRej1, starSys1, 175 iter2, starRej2, starSys2, starLimit, 176 transIter, transRej, transThresh); // Transparencies for each image 168 177 if (!trans) { 169 178 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies"); … … 184 193 // XXX this is a really poor output location; clean up the pmFPAfiles used in ppStack 185 194 pmCell *sourcesCell = pmFPAfileThisCell(config->files, view, "PPSTACK.OUTPUT"); 186 psArray *sourcesBest = psArrayAllocEmpty (100);187 188 // XXX something of a hack: require at 2 detections or 1/2of the max possible189 int minMatches = PS_MAX (2, 0.5*num);195 psArray *sourcesBest = psArrayAllocEmpty(matches->n); 196 197 // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible 198 int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required 190 199 for (int i = 0; i < matches->n; i++) { 191 200 pmSourceMatch *match = matches->data[i]; // Match of interest 192 if (match->num < minMatches) continue; 201 if (match->num < minMatches) { 202 continue; 203 } 193 204 194 205 // We need to grab a single instance of this source: just take the first available 195 int nImage = match->image->data.S32[0];196 int nIndex = match->index->data.S32[0];197 psArray *sources = sourceLists->data[ nImage];198 pmSource *source = sources->data[ nIndex];199 200 // stick this sample source on sourcesBest201 psArrayAdd (sourcesBest, 100, source);202 }203 psMetadataAdd (sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE,"psphot sources", sourcesBest);204 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis \n", sourcesBest->n);205 psFree (sourcesBest);206 int image = match->image->data.S32[0]; // Index of image 207 int index = match->index->data.S32[0]; // Index of source within image 208 psArray *sources = sourceLists->data[image]; // Sources for image 209 pmSource *source = sources->data[index]; // Source of interest 210 211 psArrayAdd(sourcesBest, sourcesBest->n, source); 212 } 213 psMetadataAdd(sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, 214 "psphot sources", sourcesBest); 215 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis", sourcesBest->n); 216 psFree(sourcesBest); 206 217 207 218 psFree(matches);
Note:
See TracChangeset
for help on using the changeset viewer.
