Changeset 25990
- Timestamp:
- Nov 1, 2009, 4:04:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotFitSourcesLinear.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFitSourcesLinear.c
r25755 r25990 59 59 } 60 60 61 // XXX test: choose a larger-than expected radius: 62 float covarFactor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix 63 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "covariance factor: %f\n", covarFactor); 64 65 // XXX do not apply covarFactor for the moment... 66 // covarFactor = 1.0; 67 61 68 // select the sources which will be used for the fitting analysis 62 69 for (int i = 0; i < sources->n; i++) { … … 120 127 121 128 // diagonal elements of the sparse matrix (auto-cross-product) 122 f = pmSourceModelDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS );129 f = pmSourceModelDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 123 130 psSparseMatrixElement (sparse, i, i, f); 124 131 125 132 // the formal error depends on the weighting scheme 126 133 if (CONSTANT_PHOTOMETRIC_WEIGHTS) { 127 float var = pmSourceModelDotModel (SRCi, SRCi, false );134 float var = pmSourceModelDotModel (SRCi, SRCi, false, covarFactor); 128 135 errors->data.F32[i] = 1.0 / sqrt(var); 129 136 } else { … … 133 140 134 141 // find the image x model value 135 f = pmSourceDataDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS );142 f = pmSourceDataDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 136 143 psSparseVectorElement (sparse, i, f); 137 144 … … 139 146 switch (SKY_FIT_ORDER) { 140 147 case 1: 141 f = pmSourceModelWeight (SRCi, 1, CONSTANT_PHOTOMETRIC_WEIGHTS );148 f = pmSourceModelWeight (SRCi, 1, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 142 149 psSparseBorderElementB (border, i, 1, f); 143 f = pmSourceModelWeight (SRCi, 2, CONSTANT_PHOTOMETRIC_WEIGHTS );150 f = pmSourceModelWeight (SRCi, 2, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 144 151 psSparseBorderElementB (border, i, 2, f); 145 152 146 153 case 0: 147 f = pmSourceModelWeight (SRCi, 0, CONSTANT_PHOTOMETRIC_WEIGHTS );154 f = pmSourceModelWeight (SRCi, 0, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 148 155 psSparseBorderElementB (border, i, 0, f); 149 156 break; … … 165 172 166 173 // got an overlap; calculate cross-product and add to output array 167 f = pmSourceModelDotModel (SRCi, SRCj, CONSTANT_PHOTOMETRIC_WEIGHTS );174 f = pmSourceModelDotModel (SRCi, SRCj, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor); 168 175 psSparseMatrixElement (sparse, j, i, f); 169 176 } … … 219 226 220 227 // measure chisq for each source 221 for (int i = 0; final && (i < fitSources->n); i++) { 228 // for (int i = 0; final && (i < fitSources->n); i++) { 229 for (int i = 0; i < fitSources->n; i++) { 222 230 pmSource *source = fitSources->data[i]; 223 231 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue; 224 232 pmModel *model = pmSourceGetModel (NULL, source); 225 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal );233 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, covarFactor); 226 234 } 227 235 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem); … … 238 246 239 247 psphotVisualShowResidualImage (readout); 248 psphotVisualPlotChisq (sources); 240 249 // psphotVisualShowFlags (sources); 241 250 … … 244 253 245 254 // XXX do we need this? 255 // XXX disallow the simultaneous sky fit and remove this code... 246 256 247 257 // Calculate the weight terms for the sky fit component of the matrix. This function operates
Note:
See TracChangeset
for help on using the changeset viewer.
