Changeset 35468
- Timestamp:
- May 1, 2013, 4:10:17 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
ippconfig/recipes/psphot.config (modified) (3 diffs)
-
psphot/src/psphotEvalPSF.c (modified) (3 diffs)
-
psphot/src/psphotRadialApertures.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippconfig/recipes/psphot.config
r35239 r35468 226 226 227 227 # SDSS values (in SDSS pixels) 228 # @RADIAL.ANNULAR.BINS.LOWER F32 0.00 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 #229 # @RADIAL.ANNULAR.BINS.UPPER F32 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 652.50 #228 # @RADIAL.ANNULAR.BINS.LOWER F32 0.00 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 # 229 # @RADIAL.ANNULAR.BINS.UPPER F32 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 652.50 # 230 230 231 231 # PS1 values? (all SDSS @ PS1 0.2 arcsec pixel scales) … … 233 233 # @RADIAL.ANNULAR.BINS.UPPER F32 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 345.0 539.1 841.0 1305.0 # 234 234 235 # PS1 values? (revised fpr PS1 @0.25 arcsec pixel scales) 236 @RADIAL.ANNULAR.BINS.LOWER F32 0.0 0.96 2.72 4.16 7.04 12.0 18.56 29.76 45.68 72.80 112.80 # perl parser fails without a comment ticket #1476 still? 237 @RADIAL.ANNULAR.BINS.UPPER F32 0.96 2.72 4.16 7.04 12.0 18.56 29.76 45.68 72.80 112.80 176.88 # perl parser fails without a comment ticket #1476 still? 235 # PV1 PS1 values (revised for PS1 @0.25 arcsec pixel scales) 236 # @RADIAL.ANNULAR.BINS.LOWER F32 0.00 0.96 2.72 4.16 7.04 12.00 18.56 29.76 45.68 72.80 112.80 # perl parser fails without a comment ticket #1476 still? 237 # @RADIAL.ANNULAR.BINS.UPPER F32 0.96 2.72 4.16 7.04 12.00 18.56 29.76 45.68 72.80 112.80 176.88 # perl parser fails without a comment ticket #1476 still? 238 239 # PV2 PS1 values (dropped inner 2 apertures) 240 @RADIAL.ANNULAR.BINS.LOWER F32 0.00 4.16 7.04 12.00 18.56 29.76 45.68 72.80 112.80 # perl parser fails without a comment ticket #1476 still? 241 @RADIAL.ANNULAR.BINS.UPPER F32 4.16 7.04 12.0 18.56 29.76 45.68 72.80 112.80 176.88 # perl parser fails without a comment ticket #1476 still? 242 243 RADIAL.ANNULAR.BINS.MIN S32 4 # always measure apertures to this entry 238 244 239 245 # In very dense fields it doesn't make sense to measure out to large radial apertures. … … 317 323 TEST_FIT_X F32 NAN 318 324 TEST_FIT_Y F32 NAN 325 TEST_FIT_CONVOLVED BOOL FALSE 319 326 320 327 TEST_FIT_PAR0 F32 NAN -
trunk/psphot/src/psphotEvalPSF.c
r29606 r35468 67 67 psTrace ("psphot", 5, "satstar failed fit"); 68 68 } 69 return false; 70 } 71 72 // unless we prove otherwise, this object is a star. 73 source->type = PM_SOURCE_TYPE_STAR; 74 75 // the following source->mode information pertains to modelPSF: 76 source->mode |= PM_SOURCE_MODE_PSFMODEL; 77 78 // if the object has fitted peak above saturation, label as SATSTAR 79 // this is a valid PSF object, but ignore the other quality tests 80 // remember: fit does not use saturated pixels (masked) 81 // XXX no extended object can saturate and stay extended... 82 83 // XXX this test is wrong : it should add back in the local sky from the model to test 84 // against saturation the local sky is saved in source->sky after psphotMagnitudes is called 85 if (model->params->data.F32[PM_PAR_I0] >= SATURATION) { 86 if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 87 psLogMsg ("psphot", 5, "PSFSTAR marked SATSTAR\n"); 88 } 89 source->mode |= PM_SOURCE_MODE_SATSTAR; 90 return true; 91 } 92 93 // if the object has a fitted peak below 0.02, the source is not viable 94 // perhaps the fit did not converge cleanly 95 if (model->params->data.F32[PM_PAR_I0] <= 0.02) { 96 source->mode |= PM_SOURCE_MODE_FAIL; 97 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 98 psTrace ("psphot", 5, "satstar failed fit (peak below 0)"); 99 } 100 return false; 101 } 102 103 // if the source was predicted to be a SATSTAR, but it fitted below saturation, 104 // make a note to the user. 105 // XXX do not do this until we have a local measure of the sky in place 106 if (false && (source->mode & PM_SOURCE_MODE_SATSTAR)) { 107 psLogMsg ("psphot", 5, "SATSTAR marked normal (fitted peak below saturation)\n"); 108 source->mode &= ~PM_SOURCE_MODE_SATSTAR; 109 } 110 111 SN = model->params->data.F32[PM_PAR_I0]/model->dparams->data.F32[PM_PAR_I0]; 112 Chi = model->chisqNorm / model->nDOF; 113 114 // assign PM_SOURCE_MODE_GOODSTAR to bright objects within PSF region of dparams[] 115 keep = TRUE; 116 keep &= (SN > PSF_MIN_SN); 117 keep &= (Chi < PSF_MAX_CHI); 118 119 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 120 psTrace ("psphot", 5, "satstar fit results: %f, %f %d : SN: %f Chisq: %f\n", 121 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], keep, SN, Chi); 122 } 123 124 if (keep) { 125 if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 126 psTrace ("psphot", 7, "PSFSTAR kept (%f, %f : SN: %f Chisq: %f)\n", 127 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi); 128 } 129 return true; 130 } 131 132 // this source is not a star, warn if it was a PSFSTAR 133 if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 134 psTrace ("psphot", 5, "PSFSTAR demoted based on fit quality (%f, %f : SN: %f Chisq: %f)\n", 135 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi); 136 } else { 137 psTrace ("psphot", 5, "fails PSF fit (%f, %f : SN: %f Chisq: %f)\n", 138 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi); 139 } 140 141 // poor-quality fit; only keep if nothing else works... 142 source->mode |= PM_SOURCE_MODE_POOR; 143 return false; 144 } 145 146 // examine the model->status, fit parameters, etc and decide if the model succeeded 147 // set the source->type and source->mode appropriately 148 bool psphotEvalDBL (pmSource *source, pmModel *model) { 149 150 // do we actually have a valid PSF model? 151 if (model == NULL) { 152 source->mode &= ~PM_SOURCE_MODE_FITTED; 153 return false; 154 } 155 156 // was the model actually fitted? 157 if (!(model->flags & PM_MODEL_STATUS_FITTED)) { 158 source->mode &= ~PM_SOURCE_MODE_FITTED; 159 return false; 160 } 161 // did the model fit fail for one or another reason? 162 if (model->flags & (PM_MODEL_STATUS_BADARGS | 163 PM_MODEL_STATUS_NONCONVERGE | 164 PM_MODEL_STATUS_OFFIMAGE)) { 165 source->mode |= PM_SOURCE_MODE_FAIL; 69 166 return false; 70 167 } … … 88 185 } 89 186 90 // if the object has a fitted peak below 0.02, the source is not viable 91 // perhaps the fit did not converge cleanly 187 // if the object has a fitted peak below 0, the fit did not converge cleanly 92 188 if (model->params->data.F32[PM_PAR_I0] <= 0.02) { 93 189 source->mode |= PM_SOURCE_MODE_FAIL; 94 if (source->mode & PM_SOURCE_MODE_SATSTAR) {95 psTrace ("psphot", 5, "satstar failed fit (peak below 0)");96 }97 190 return false; 98 191 } … … 104 197 source->mode &= ~PM_SOURCE_MODE_SATSTAR; 105 198 } 106 107 SN = model->params->data.F32[PM_PAR_I0]/model->dparams->data.F32[PM_PAR_I0];108 Chi = model->chisqNorm / model->nDOF;109 110 // assign PM_SOURCE_MODE_GOODSTAR to bright objects within PSF region of dparams[]111 keep = TRUE;112 keep &= (SN > PSF_MIN_SN);113 keep &= (Chi < PSF_MAX_CHI);114 115 if (source->mode & PM_SOURCE_MODE_SATSTAR) {116 psTrace ("psphot", 5, "satstar fit results: %f, %f %d : SN: %f Chisq: %f\n",117 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], keep, SN, Chi);118 }119 120 if (keep) {121 if (source->mode & PM_SOURCE_MODE_PSFSTAR) {122 psTrace ("psphot", 7, "PSFSTAR kept (%f, %f : SN: %f Chisq: %f)\n",123 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi);124 }125 return true;126 }127 128 // this source is not a star, warn if it was a PSFSTAR129 if (source->mode & PM_SOURCE_MODE_PSFSTAR) {130 psTrace ("psphot", 5, "PSFSTAR demoted based on fit quality (%f, %f : SN: %f Chisq: %f)\n",131 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi);132 } else {133 psTrace ("psphot", 5, "fails PSF fit (%f, %f : SN: %f Chisq: %f)\n",134 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], SN, Chi);135 }136 137 // poor-quality fit; only keep if nothing else works...138 source->mode |= PM_SOURCE_MODE_POOR;139 return false;140 }141 142 // examine the model->status, fit parameters, etc and decide if the model succeeded143 // set the source->type and source->mode appropriately144 bool psphotEvalDBL (pmSource *source, pmModel *model) {145 146 // do we actually have a valid PSF model?147 if (model == NULL) {148 source->mode &= ~PM_SOURCE_MODE_FITTED;149 return false;150 }151 152 // was the model actually fitted?153 if (!(model->flags & PM_MODEL_STATUS_FITTED)) {154 source->mode &= ~PM_SOURCE_MODE_FITTED;155 return false;156 }157 // did the model fit fail for one or another reason?158 if (model->flags & (PM_MODEL_STATUS_BADARGS |159 PM_MODEL_STATUS_NONCONVERGE |160 PM_MODEL_STATUS_OFFIMAGE)) {161 source->mode |= PM_SOURCE_MODE_FAIL;162 return false;163 }164 165 // unless we prove otherwise, this object is a star.166 source->type = PM_SOURCE_TYPE_STAR;167 168 // the following source->mode information pertains to modelPSF:169 source->mode |= PM_SOURCE_MODE_PSFMODEL;170 171 // if the object has fitted peak above saturation, label as SATSTAR172 // this is a valid PSF object, but ignore the other quality tests173 // remember: fit does not use saturated pixels (masked)174 // XXX no extended object can saturate and stay extended...175 if (model->params->data.F32[PM_PAR_I0] >= SATURATION) {176 if (source->mode & PM_SOURCE_MODE_PSFSTAR) {177 psLogMsg ("psphot", 5, "PSFSTAR marked SATSTAR\n");178 }179 source->mode |= PM_SOURCE_MODE_SATSTAR;180 return true;181 }182 183 // if the object has a fitted peak below 0, the fit did not converge cleanly184 if (model->params->data.F32[PM_PAR_I0] <= 0.02) {185 source->mode |= PM_SOURCE_MODE_FAIL;186 return false;187 }188 189 // if the source was predicted to be a SATSTAR, but it fitted below saturation,190 // make a note to the user191 if (source->mode & PM_SOURCE_MODE_SATSTAR) {192 psLogMsg ("psphot", 5, "SATSTAR marked normal (fitted peak below saturation)\n");193 source->mode &= ~PM_SOURCE_MODE_SATSTAR;194 }195 199 return true; 196 200 } -
trunk/psphot/src/psphotRadialApertures.c
r34404 r35468 47 47 static float outerRadius = NAN; 48 48 static float SN_LIM = NAN; 49 static int RADIAL_AP_MIN = 5; 49 50 static psImageMaskType maskVal = 0; 50 51 … … 115 116 // S/N limit to perform full non-linear fits 116 117 SN_LIM = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 118 119 // S/N limit to perform full non-linear fits 120 RADIAL_AP_MIN = psMetadataLookupS32 (&status, recipe, "RADIAL.ANNULAR.BINS.MIN"); 121 if (!status) { 122 RADIAL_AP_MIN = 5; 123 } 117 124 118 125 // source analysis is done in S/N order (brightest first) … … 310 317 311 318 // find the largest aperture of interest (use only apertures with inner radii <= 312 // source->skyRadius )319 // source->skyRadius, as long as i >= RADIAL_AP_MIN 313 320 int lastAp = aperRadii->n; 314 for (int i = 0; i < aperRadii->n; i++) {315 if (aperRadii->data.F32[i] < source->skyRadius) continue; 321 for (int i = RADIAL_AP_MIN; i < aperRadii->n; i++) { 322 if (aperRadii->data.F32[i] < source->skyRadius) continue; // measure out to this radius 316 323 lastAp = i + 1; 317 324 break;
Note:
See TracChangeset
for help on using the changeset viewer.
