IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 30, 2008, 12:09:14 PM (18 years ago)
Author:
Paul Price
Message:

Figured that we don't want a set of unique sources, since that includes all the cosmic rays from all the inputs. Rather, we want for each image the list of sources in that image, but corrected to be on a common magnitude system (matching zero points across the images) and use that for our target PSF image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackLoop.c

    r18346 r18382  
    213213    // Preparation iteration: Load the sources, and get a target PSF model
    214214    psTrace("ppStack", 1, "Determining target PSF....\n");
    215     psArray *sources = NULL;            // Sources to use for PSF matching
     215    psArray *globalSources = NULL;      // Global list of sources for matching (haveSources = TRUE)
     216    psArray *indSources = psArrayAlloc(num); // Individual lists of sources for matching (haveSources = FALSE)
    216217    pmPSF *targetPSF = NULL;            // Target PSF
    217218    bool haveSources = psMetadataLookupBool(NULL, config->arguments, "HAVE.SOURCES"); // Global sources?
     
    240241                psError(PS_ERR_UNKNOWN, false, "Unable to find PSF.");
    241242                psFree(view);
    242                 psFree(sources);
     243                psFree(globalSources);
     244                psFree(indSources);
    243245                psFree(sourceLists);
    244246                psFree(fileIter);
     
    257259                psError(PS_ERR_UNKNOWN, false, "Unable to determine size of image from PSF.");
    258260                psFree(view);
    259                 psFree(sources);
     261                psFree(globalSources);
     262                psFree(indSources);
    260263                psFree(sourceLists);
    261264                psFree(fileIter);
     
    270273            if (!haveSources) {
    271274                pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
    272                 sourceLists = ppStackSourceListAdd(sourceLists, ro, config);
     275                psArray *sources = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.SOURCES"); // Sources
     276                if (!sources) {
     277                    psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find sources in readout.");
     278                    return NULL;
     279                }
     280                sources->data[index] = psMemIncrRefCounter(sources);
     281                sourceLists = ppStackSourceListAdd(sourceLists, sources, config);
    273282                if (!sourceLists) {
    274283                    psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list.");
    275284                    psFree(view);
    276                     psFree(sources);
     285                    psFree(globalSources);
     286                    psFree(indSources);
    277287                    psFree(fileIter);
    278288                    psFree(psfs);
     
    288298        if (!targetPSF) {
    289299            psError(PS_ERR_UNKNOWN, false, "Unable to determine output PSF.");
    290             psFree(sources);
     300            psFree(globalSources);
     301            psFree(indSources);
    291302            return false;
    292303        }
     
    294305        if (haveSources) {
    295306            // We want to hang on to the 'sources' even when its host FPA is blown away
    296             sources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view, "PPSTACK.INPUT.SOURCES"));
    297             if (!sources) {
     307            globalSources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view,
     308                                                                     "PPSTACK.INPUT.SOURCES"));
     309            if (!globalSources) {
    298310                psError(PS_ERR_UNKNOWN, true, "Unable to find sources.");
    299311                psFree(view);
     
    301313            }
    302314        } else {
    303             sources = ppStackSourceListCombine(sourceLists, config);
     315            globalSources = ppStackSourceListCombine(sourceLists, config);
    304316            psFree(sourceLists);
    305             if (!sources) {
     317            if (!globalSources) {
    306318                psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list.");
    307319                psFree(view);
     
    343355        pmFPAview *view = filesIterateDown(config);
    344356        if (!view) {
    345             psFree(sources);
     357            psFree(globalSources);
     358            psFree(indSources);
    346359            psFree(targetPSF);
    347360            psFree(rng);
     
    354367        // Background subtraction, scaling and normalisation is performed automatically by the image matching
    355368        psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction
     369        psArray *sources = haveSources ? globalSources : indSources->data[i]; // Sources for matching
    356370        if (!ppStackMatch(readout, &regions, &kernels, sources, targetPSF, rng, config)) {
    357371            psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
     
    374388        numGood++;
    375389    }
    376     psFree(sources);
     390    psFree(globalSources);
     391    psFree(indSources);
    377392    psFree(targetPSF);
    378393    psFree(rng);
Note: See TracChangeset for help on using the changeset viewer.