IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36759 for trunk/psphot/src


Ignore:
Timestamp:
May 21, 2014, 2:10:14 PM (12 years ago)
Author:
bills
Message:

changes to psphotFullForceSummary to deal with multiple models per source

File:
1 edited

Legend:

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

    r36747 r36759  
    188188    int ID = source0->seq;
    189189
    190     // Find the parameters from the cff tables
     190    // Find the parameters from the cff tables. nModels is the number of extended model types that
     191    // this source has an entry for
    191192    int nModels = 0;
    192193    // skip table 0 which is modelType -1 not extended
     
    227228            }
    228229        }
    229         if (nModels && !outSrc->modelFits && source->modelFits && source->modelFits->n == nModels) {
    230             outSrc->modelFits =  psMemIncrRefCounter(source->modelFits);
     230        if (nModels && source->modelFits && source->modelFits->n) {
     231            if (!outSrc->modelFits) {
     232                outSrc->modelFits = psArrayAllocEmpty(nModels);
     233            }
     234            for (int iModel = 0; iModel < source->modelFits->n; iModel++) {
     235                pmModel *newModel = source->modelFits->data[iModel];
     236                pmModel *outModel = NULL;
     237                for (int jModel = 0; jModel < outSrc->modelFits->n; jModel++) {
     238                    outModel = outSrc->modelFits->data[jModel];
     239                    if (newModel->type == outModel->type)  {
     240                        // already have an entry for this type
     241                        break;
     242                    }
     243                    outModel = NULL;
     244                }
     245                if (!outModel) {
     246                    // no model of this type in output source yet. Add this one.
     247                    // Note: the parameters that we need (position, angle, index, if applicable)
     248                    // are the same for all sources so copying any of them is fine
     249                    psArrayAdd(outSrc->modelFits, 1, newModel);
     250                }
     251            }
    231252        }
    232253    }
Note: See TracChangeset for help on using the changeset viewer.