IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20829


Ignore:
Timestamp:
Nov 25, 2008, 2:41:54 PM (17 years ago)
Author:
Paul Price
Message:

psphotInit should not turn on threading for psImageConvolveMask because parts of some programs (e.g., ppStack, ppSub) explicitly do not want threading of that.

Location:
trunk/psphot/src
Files:
4 edited

Legend:

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

    r20453 r20829  
    1212    float FOOTPRINT_NSIGMA_LIMIT;
    1313    if (pass == 1) {
    14         FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT");
     14        FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT");
    1515    } else {
    16         FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT_2");
     16        FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT_2");
    1717    }
    1818    PS_ASSERT (status, false);
     
    2525    int growRadius = 0;
    2626    if (pass == 1) {
    27         growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS");
     27        growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS");
    2828    } else {
    29         growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS_2");
     29        growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS_2");
    3030    }
    3131    PS_ASSERT (status, false);
    3232
    33     // find the raw footprints & assign the peaks to those footprints 
     33    // find the raw footprints & assign the peaks to those footprints
    3434    psArray *footprints = pmFootprintsFind (significance, threshold, npixMin);
    3535
     
    3838
    3939    // footprints now owns the peaks; after culling (below), we will rebuild the peaks array
    40     psFree (detections->peaks); 
     40    psFree (detections->peaks);
    4141
    4242    psLogMsg ("psphot", PS_LOG_MINUTIA, "found %ld footprints: %f sec\n", footprints->n, psTimerMark ("psphot.footprints"));
     
    4444    // optionally grow footprints isotropically by growRadius pixels
    4545    if (growRadius > 0) {
    46         psArray *tmp = pmFootprintArrayGrow(footprints, growRadius);
    47         psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp->n, psTimerMark ("psphot.footprints"));
    48         psFree(footprints);
    49         footprints = tmp;
     46        bool oldThreads = psImageConvolveThreads(true); // Old value of threading for psImageConvolve
     47        psArray *tmp = pmFootprintArrayGrow(footprints, growRadius);
     48        psImageConvolveThreads(oldThreads);
     49        psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp->n, psTimerMark ("psphot.footprints"));
     50        psFree(footprints);
     51        footprints = tmp;
    5052    }
    5153
    5254    if (pass == 2) {
    53         // merge in old peaks;
    54         const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints
    55        
    56         // XXX EAM : still not sure I understand this: are we double-couning or undercounting peaks
     55        // merge in old peaks;
     56        const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints
    5757
    58         psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
    59         psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
     58        // XXX EAM : still not sure I understand this: are we double-couning or undercounting peaks
    6059
    61         psFree(footprints);
    62         psFree(detections->footprints);
    63         detections->footprints = mergedFootprints;
     60        psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
     61        psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
     62
     63        psFree(footprints);
     64        psFree(detections->footprints);
     65        detections->footprints = mergedFootprints;
    6466    } else {
    65         detections->footprints = footprints;
     67        detections->footprints = footprints;
    6668    }
    6769
  • trunk/psphot/src/psphotReadout.c

    r20464 r20829  
    77    psphotModelClassInit ();            // load implementation-specific models
    88    psphotSetThreads ();
    9     psImageConvolveSetThreads(true);
    109    return true;
    1110}
  • trunk/psphot/src/psphotSignificanceImage.c

    r20463 r20829  
    1212    // smooth the image and weight map
    1313    psTimerStart ("psphot.smooth");
    14     psImageConvolveSetThreads(true);
     14    bool oldThreads = psImageConvolveSetThreads(true); // Old value of threading in psImageConvolve
    1515
    1616    // XXX we can a) choose fft to convolve if needed and b) multithread fftw
     
    128128
    129129    psFree(smooth_wt);
     130
     131    psImageConvolveSetThreads(oldThreads);
     132
    130133    return smooth_im;
    131134}
    132135
    133 # if (0) 
    134 { 
     136# if (0)
     137{
    135138    // threadingdemo
    136139    // smooth the image, applying the mask as we go
  • trunk/psphot/src/psphotSourceSize.c

    r20453 r20829  
    218218    // now that we have masked pixels associated with CRs, we can grow the mask
    219219    if (grow > 0) {
     220        bool oldThreads = psImageConvolveThreads(true); // Old value of threading for psImageConvolveMask
    220221        psImage *newMask = psImageConvolveMask(NULL, readout->mask, crMask, crMask, -grow, grow, -grow, grow);
     222        psImageConvolveThreads(oldThreads);
    221223        if (!newMask) {
    222224            psError(PS_ERR_UNKNOWN, false, "Unable to grow CR mask");
Note: See TracChangeset for help on using the changeset viewer.