IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2005, 9:55:31 PM (21 years ago)
Author:
eugene
Message:

finshed deblender, dropped local copies of psModule code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotEnsemblePSF.c

    r5704 r5718  
    1313    sources = psArraySort (sources, psphotSortByY);
    1414
     15    // this should be added to the PM_SOURCE flags:
     16    int PM_SOURCE_BLEND = PM_SOURCE_OTHER + 1;
     17
    1518    float OUTER_RADIUS     = psMetadataLookupF32 (&status, config, "SKY_OUTER_RADIUS");
    1619    float PSF_FIT_NSIGMA   = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA");
     
    2326    // pre-calculate all model pixels
    2427    psArray  *models = psArrayAlloc (sources->n);
     28    psVector *index  = psVectorAlloc (sources->n, PS_TYPE_U32);
     29    models->n = 0;
     30    index->n = 0;
     31
    2532    for (int i = 0; i < sources->n; i++) {
    2633        pmSource *inSource = sources->data[i];
     34
     35        // skip non-astronomical objects (very likely defects)
     36        // XXX EAM : should we try these anyway?
     37        if (inSource->type == PM_SOURCE_BLEND) continue;
     38        if (inSource->type == PM_SOURCE_DEFECT) continue;
     39        if (inSource->type == PM_SOURCE_SATURATED) continue;
     40
    2741        pmSource *otSource = pmSourceAlloc ();
    2842
     
    7286        // save source in list
    7387        otSource->modelPSF = model;
    74         models->data[i] = otSource;
     88        index->data.U32[models->n] = i;
     89        psArrayAdd (models, 100, otSource);
    7590    }
    7691    psLogMsg ("psphot.emsemble", 4, "built models: %f (%d objects)\n", psTimerMark ("psphot"), sources->n);
     
    7994
    8095    // fill out the sparse matrix
    81     psSparse *sparse = psSparseAlloc (sources->n, 100);
    82     for (int i = 0; i < sources->n; i++) {
    83         pmSource *Fi = sources->data[i];
     96    psSparse *sparse = psSparseAlloc (models->n, 100);
     97    for (int i = 0; i < models->n; i++) {
     98        int N = index->data.U32[i];
     99        pmSource *Fi = sources->data[N];
    84100        pmSource *Mi = models->data[i];
    85101
     
    93109
    94110        // loop over all other stars following this one
    95         for (int j = i + 1; j < sources->n; j++) {
     111        for (int j = i + 1; j < models->n; j++) {
    96112            pmSource *Mj = models->data[j];
    97113
    98             // XXX double check that this is working!  should not break here
    99             check me here;
    100             if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) break;
     114            // skip over disjoint source images, break after last possible overlap
     115            if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) break;
     116            if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue;
     117            if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) continue;
    101118            if (Mj->pixels->col0 + Mj->pixels->numCols < Mi->pixels->col0) continue;
    102             if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) continue;
    103             if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue;
    104119           
    105120            // got an overlap; calculate cross-product and add to output array
     
    115130
    116131    // adjust models, set sources and subtract
    117     for (int i = 0; i < sources->n; i++) {
    118         pmSource *Fi = sources->data[i];
     132    for (int i = 0; i < models->n; i++) {
     133        int N = index->data.U32[i];
     134        pmSource *Fi = sources->data[N];
    119135        pmSource *Mi = models->data[i];
    120136
Note: See TracChangeset for help on using the changeset viewer.