Changeset 9527 for trunk/psphot/src/psphotEnsemblePSF.c
- Timestamp:
- Oct 12, 2006, 4:24:34 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotEnsemblePSF.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotEnsemblePSF.c
r9270 r9527 37 37 // psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 38 38 if (psRegionIsNaN (AnalysisRegion)) psAbort ("psphot", "analysis region mis-defined"); 39 40 const bool CONSTANT_PHOTOMETRIC_WEIGHTS = 41 psMetadataLookupBool(&status, recipe, "CONSTANT_PHOTOMETRIC_WEIGHTS"); 42 if (!status) { 43 psAbort(PS_FILE_LINE, "You must provide a value for the BOOL recipe CONSTANT_PHOTOMETRIC_WEIGHTS"); 44 } 39 45 40 46 for (int i = 0; i < sources->n; i++) { … … 68 74 pmModel *modelEXT = pmSourceModelGuess (inSource, psf->type); 69 75 if (inSource->mode & PM_SOURCE_MODE_SATSTAR) { 70 modelEXT->params->data.F32[ 2] = inSource->moments->x;71 modelEXT->params->data.F32[ 3] = inSource->moments->y;76 modelEXT->params->data.F32[PM_PAR_XPOS] = inSource->moments->x; 77 modelEXT->params->data.F32[PM_PAR_YPOS] = inSource->moments->y; 72 78 } else { 73 79 // peak-up on peak (for non-sat objects) … … 81 87 82 88 psTrace ("psphotEnsemblePSF", 5, "peak coord: %f %f -> %f %f\n", 83 modelEXT->params->data.F32[ 2], modelEXT->params->data.F32[3], min.x + ix, min.y + iy);89 modelEXT->params->data.F32[PM_PAR_XPOS], modelEXT->params->data.F32[PM_PAR_YPOS], min.x + ix, min.y + iy); 84 90 85 91 // if min point is too deviant, keep the old value 86 92 if ((fabs(min.x) < 1.5) && (fabs(min.y) < 1.5)) { 87 modelEXT->params->data.F32[ 2] = min.x + ix;88 modelEXT->params->data.F32[ 3] = min.y + iy;93 modelEXT->params->data.F32[PM_PAR_XPOS] = min.x + ix; 94 modelEXT->params->data.F32[PM_PAR_YPOS] = min.y + iy; 89 95 } 90 96 psFree (bicube); … … 96 102 97 103 // save the original coords 98 x = model->params->data.F32[ 2];99 y = model->params->data.F32[ 3];104 x = model->params->data.F32[PM_PAR_XPOS]; 105 y = model->params->data.F32[PM_PAR_YPOS]; 100 106 101 107 // set the fit radius based on the object flux limit and the model … … 112 118 113 119 // set model to unit peak, zero sky (we assume sky is subtracted) 114 model->params->data.F32[ 0] = 0.0;115 model->params->data.F32[ 1] = 1.0;120 model->params->data.F32[PM_PAR_SKY] = 0.0; 121 model->params->data.F32[PM_PAR_FLUX] = 1.0; 116 122 117 123 // fill in the model pixel values … … 143 149 144 150 // scale by diagonal element (auto-cross-product) 145 r = pmSourceCrossProduct (Mi, Mi );151 r = pmSourceCrossProduct (Mi, Mi, CONSTANT_PHOTOMETRIC_WEIGHTS); 146 152 weight->data.F32[i] = r; 147 153 … … 149 155 150 156 // find the image x model value 151 f = pmSourceCrossProduct (Fi, Mi );157 f = pmSourceCrossProduct (Fi, Mi, CONSTANT_PHOTOMETRIC_WEIGHTS); 152 158 psSparseVectorElement (sparse, i, f / r); 153 159 … … 163 169 164 170 // got an overlap; calculate cross-product and add to output array 165 f = pmSourceCrossProduct (Mi, Mj );171 f = pmSourceCrossProduct (Mi, Mj, CONSTANT_PHOTOMETRIC_WEIGHTS); 166 172 psSparseMatrixElement (sparse, j, i, f / r); 167 173 } … … 194 200 psAbort ("psphot", "ensemble source is nan"); 195 201 } 196 Fi->modelPSF->params->data.F32[ 1] = norm->data.F32[i];197 Fi->modelPSF->dparams->data.F32[ 1] = sqrt(sqrt(2) * norm->data.F32[i] / (sparse->Bfj->data.F32[i] * weight->data.F32[i]));202 Fi->modelPSF->params->data.F32[PM_PAR_FLUX] = norm->data.F32[i]; 203 Fi->modelPSF->dparams->data.F32[PM_PAR_FLUX] = sqrt(sqrt(2) * norm->data.F32[i] / (sparse->Bfj->data.F32[i] * weight->data.F32[i])); 198 204 // XXX EAM : this factor of sqrt(2) makes the errors consistent, but I don't understand it 199 205 … … 210 216 pmModel *model = Fi->modelPSF; 211 217 212 x = model->params->data.F32[ 2];213 y = model->params->data.F32[ 3];218 x = model->params->data.F32[PM_PAR_XPOS]; 219 y = model->params->data.F32[PM_PAR_YPOS]; 214 220 215 221 psImageKeepCircle (Fi->mask, x, y, model->radiusTMP, "OR", PM_MASK_MARK);
Note:
See TracChangeset
for help on using the changeset viewer.
