Changeset 5718 for trunk/psphot/src/psphotEnsemblePSF.c
- Timestamp:
- Dec 6, 2005, 9:55:31 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotEnsemblePSF.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotEnsemblePSF.c
r5704 r5718 13 13 sources = psArraySort (sources, psphotSortByY); 14 14 15 // this should be added to the PM_SOURCE flags: 16 int PM_SOURCE_BLEND = PM_SOURCE_OTHER + 1; 17 15 18 float OUTER_RADIUS = psMetadataLookupF32 (&status, config, "SKY_OUTER_RADIUS"); 16 19 float PSF_FIT_NSIGMA = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA"); … … 23 26 // pre-calculate all model pixels 24 27 psArray *models = psArrayAlloc (sources->n); 28 psVector *index = psVectorAlloc (sources->n, PS_TYPE_U32); 29 models->n = 0; 30 index->n = 0; 31 25 32 for (int i = 0; i < sources->n; i++) { 26 33 pmSource *inSource = sources->data[i]; 34 35 // skip non-astronomical objects (very likely defects) 36 // XXX EAM : should we try these anyway? 37 if (inSource->type == PM_SOURCE_BLEND) continue; 38 if (inSource->type == PM_SOURCE_DEFECT) continue; 39 if (inSource->type == PM_SOURCE_SATURATED) continue; 40 27 41 pmSource *otSource = pmSourceAlloc (); 28 42 … … 72 86 // save source in list 73 87 otSource->modelPSF = model; 74 models->data[i] = otSource; 88 index->data.U32[models->n] = i; 89 psArrayAdd (models, 100, otSource); 75 90 } 76 91 psLogMsg ("psphot.emsemble", 4, "built models: %f (%d objects)\n", psTimerMark ("psphot"), sources->n); … … 79 94 80 95 // fill out the sparse matrix 81 psSparse *sparse = psSparseAlloc (sources->n, 100); 82 for (int i = 0; i < sources->n; i++) { 83 pmSource *Fi = sources->data[i]; 96 psSparse *sparse = psSparseAlloc (models->n, 100); 97 for (int i = 0; i < models->n; i++) { 98 int N = index->data.U32[i]; 99 pmSource *Fi = sources->data[N]; 84 100 pmSource *Mi = models->data[i]; 85 101 … … 93 109 94 110 // loop over all other stars following this one 95 for (int j = i + 1; j < sources->n; j++) {111 for (int j = i + 1; j < models->n; j++) { 96 112 pmSource *Mj = models->data[j]; 97 113 98 // XXX double check that this is working! should not break here 99 check me here; 100 if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) break; 114 // skip over disjoint source images, break after last possible overlap 115 if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) break; 116 if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue; 117 if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) continue; 101 118 if (Mj->pixels->col0 + Mj->pixels->numCols < Mi->pixels->col0) continue; 102 if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) continue;103 if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue;104 119 105 120 // got an overlap; calculate cross-product and add to output array … … 115 130 116 131 // adjust models, set sources and subtract 117 for (int i = 0; i < sources->n; i++) { 118 pmSource *Fi = sources->data[i]; 132 for (int i = 0; i < models->n; i++) { 133 int N = index->data.U32[i]; 134 pmSource *Fi = sources->data[N]; 119 135 pmSource *Mi = models->data[i]; 120 136
Note:
See TracChangeset
for help on using the changeset viewer.
