IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 31, 2012, 11:50:18 AM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20120627/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120627/psphot

  • branches/eam_branches/ipp-20120627/psphot/src

  • branches/eam_branches/ipp-20120627/psphot/src/psphotFitSourcesLinear.c

    r34086 r34247  
    1313
    1414// for now, let's store the detections on the readout->analysis for each readout
    15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final)
     15bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final, bool skipNegativeFluxSources)
    1616{
    1717    bool status = true;
     
    5151        psAssert (readout, "missing readout?");
    5252
     53        if (psMetadataLookupBool (&status, readout->analysis, "PSPHOT.SKIP.INPUT")) {
     54            psLogMsg ("psphot", PS_LOG_DETAIL, "skipping fit sources for input file %d", i);
     55            continue;
     56        }
     57
     58
    5359        pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
    5460        psAssert (detections, "missing detections?");
     
    6066        psAssert (psf, "missing psf?");
    6167
    62         if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1)) {
     68        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1, skipNegativeFluxSources)) {
    6369            psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i);
    6470            return false;
     
    7985
    8086            // rerun fit with correct fitVarMode
    81             if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarMode)) {
     87            // XXX: does skipNegativeFlux work here?
     88            if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarMode, skipNegativeFluxSources)) {
    8289                psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i);
    8390                return false;
     
    130137}
    131138
    132 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode) {
     139bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode, bool skipNegativeFluxSources) {
    133140    bool status;
    134141    float x;
     
    177184    float MIN_VALID_FLUX = psMetadataLookupF32(&status, recipe, "PSF_FIT_MIN_VALID_FLUX");
    178185    if (!status) {
     186        MIN_VALID_FLUX = 0.0;
     187    }
     188    if (skipNegativeFluxSources && MIN_VALID_FLUX < 0) {
    179189        MIN_VALID_FLUX = 0.0;
    180190    }
     
    252262        if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit)
    253263        if (modelSum < 0.8) {
    254             fprintf (stderr, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
     264            psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
    255265                     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
    256266        }
    257267        if (maskedSum < 0.5) {
    258             fprintf (stderr, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
     268            psLogMsg ("psphot.ensemble",  PS_LOG_MINUTIA, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
    259269                     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
    260270        }
Note: See TracChangeset for help on using the changeset viewer.