IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2011, 1:56:22 PM (15 years ago)
Author:
watersc1
Message:

merge from trunk before working on new stacking code

Location:
branches/czw_branch/20110406
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406

  • branches/czw_branch/20110406/psphot

  • branches/czw_branch/20110406/psphot/src/psphotFitSourcesLinear.c

    r31154 r31606  
    137137        if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;
    138138
     139        // do not include MOMENTS_FAILURES in the fit
     140        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
     141
    139142        // XXX count saturated stars
    140143        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     
    164167
    165168        // check the integral of the model : is it large enough?
     169        // apply mask?
    166170        float modelSum = 0.0;
     171        float maskedSum = 0.0;
    167172        for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
    168173            for (int ix = 0; ix < source->modelFlux->numCols; ix++) {
    169174                modelSum += source->modelFlux->data.F32[iy][ix];
     175                if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue;
     176                maskedSum += source->modelFlux->data.F32[iy][ix];
    170177            }
    171178        }
    172179        if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit)
    173         // if (modelSum < 0.01) continue; // skip sources with no model constraint (somewhat arbitrary limit)
    174180        if (modelSum < 0.8) {
    175             fprintf (stderr, "low-sig model @ %f, %f (%f sum, %f peak)\n",
    176                      source->peak->xf, source->peak->yf, modelSum, source->peak->rawFlux);
     181            fprintf (stderr, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
     182                     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
    177183        }
    178 
    179         pmModel *model = pmSourceGetModel (NULL, source);
     184        if (maskedSum < 0.5) {
     185            fprintf (stderr, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
     186                     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
     187        }
     188
     189        bool isPSF = false;
     190        pmModel *model = pmSourceGetModel (&isPSF, source);
    180191
    181192        psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
    182193        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, model->fitRadius, "OR", markVal);
    183194
    184         source->mode |= PM_SOURCE_MODE_LINEAR_FIT;
     195        // we call this function multiple times. for the first time, we have only PSF models for all objects
     196        // the second time has extended sources.  If we ever fit the PSF model, we should raise this bit
     197        source->mode |= PM_SOURCE_MODE_LINEAR_FIT;
     198        if (isPSF) {
     199            source->mode |= PM_SOURCE_MODE_PSFMODEL;
     200        }           
     201       
    185202        psArrayAdd (fitSources, 100, source);
    186203    }
     
    260277        }
    261278    }
     279
     280# if (0)
     281    static int npass = 0;
     282    char name[128];
     283    FILE *f1 = NULL;
     284    int fd = -1;
     285
     286    snprintf (name, 128, "sparse.Aij.%02d.dat", npass);
     287    f1 = fopen (name, "w");
     288    psAssert (f1, "failed to open file\n");
     289    fd = fileno (f1);
     290    p_psVectorPrint (fd, sparse->Aij, "Aij");
     291    fclose (f1);
     292
     293    snprintf (name, 128, "sparse.Bfj.%02d.dat", npass);
     294    f1 = fopen (name, "w");
     295    psAssert (f1, "failed to open file\n");
     296    fd = fileno (f1);
     297    p_psVectorPrint (fd, sparse->Bfj, "Bfj");
     298    fclose (f1);
     299
     300    snprintf (name, 128, "sparse.Qii.%02d.dat", npass);
     301    f1 = fopen (name, "w");
     302    psAssert (f1, "failed to open file\n");
     303    fd = fileno (f1);
     304    p_psVectorPrint (fd, sparse->Qii, "Qii");
     305    fclose (f1);
     306    npass ++;
     307# endif
    262308
    263309    psSparseResort (sparse);
Note: See TracChangeset for help on using the changeset viewer.