IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2012, 2:38:37 PM (14 years ago)
Author:
bills
Message:

Several changes to psphot and psphotStack

  1. Add function to compute the memory used by all of the sources
  2. Add function to log memory stats in psphotStack
  3. Don't load or psf match the convolved images into psphotStack unless they are needed.

This saves a lot of time if RADIAL_APERTURES are not enabled and we are measuring on the raw images

  1. Several improvements to the error handling in the Kron measurements. In particular the Mrf value

was being treated as positive when both the numerator and denomiator were negative. This is the cause
of many of the very large kron radius measurements. Set Mrf to NAN in these cases.

  1. Skip kron measurments for source if the previous Mrf measurement was NAN earlier in the process.

This saves memory by not expanding the source images when the kron measurements were actually going
to be skipped

  1. Remove the hack cut on fwhmMaj. Managing the kron radius measurements better fixes the memory explosion

that that helped to reduce.

File:
1 edited

Legend:

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

    r34136 r34317  
    8181    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
    8282    psAssert (maskVal, "missing mask value?");
     83    psImageMaskType maskSat = psMetadataLookupImageMask(&status, recipe, "MASK.SAT"); // Mask value for bad pixels
     84    psAssert (maskSat, "missing mask value?");
     85
    8386
    8487    float minGauss = psMetadataLookupF32(NULL, recipe, "PEAKS_MIN_GAUSS"); // Minimum valid fraction of kernel
     
    123126    psImageSmoothMask_Threaded(readout->variance, readout->variance, readout->mask, maskVal, SIGMA_SMTH * M_SQRT1_2, NSIGMA_SMTH, minGauss);
    124127    psLogMsg("psphot", PS_LOG_MINUTIA, "smooth variance: %f sec\n", psTimerMark("psphot.smooth"));
     128
     129    // Insure that invalid pixels are masked
     130    // XXX: the smoothing seems to generate nan pixels in the variance image
     131    // XXX: We may need to loop over the cached sources and redefine the maskObj images...
     132    pmReadoutMaskInvalid(readout, maskVal, maskSat);
     133    {
     134        // Now go rebuild the sources' copies of the mask
     135        pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     136        psAssert (detections, "missing detections?");
     137
     138        psArray *sources = detections->allSources;
     139
     140        if (sources && sources->n) {
     141            for (int i = 0 ; i < sources->n; i++) {
     142                // XXX: move this to a function in pmSource.c
     143                pmSource *source = sources->data[i];
     144                if (source->maskObj && source->maskView) {
     145                    psFree(source->maskObj);
     146                    source->maskObj = psImageCopy (source->maskObj, source->maskView, PS_TYPE_IMAGE_MASK);
     147                }
     148            }
     149        }
     150    }
    125151
    126152    psLogMsg("psphot", PS_LOG_INFO, "smoothed");
Note: See TracChangeset for help on using the changeset viewer.