IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2025, 3:33:01 PM (14 months ago)
Author:
tdeboer
Message:

updates to detrend functions for 2D overscan correction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmPattern.c

    r42379 r42889  
    239239# define READNOISE 10 /* arbitrary number */
    240240    float sigma = sqrt(stats->robustMedian + PS_SQR(READNOISE));
     241    if(isnan(sigma)) sigma=20.;
    241242    float delta = PS_MIN (thresh * sigma, 2*nominalAmplitude);
    242243    float lower = stats->robustMedian - delta; // Lower bound for data
     
    246247    // if the noise from the background is too large
    247248    float significance = nominalAmplitude / sigma;
     249    significance = abs(significance);
    248250   
    249251    // XXX EAM : arbitrary number
    250252    if (isfinite(nominalAmplitude) && (significance < 1.0/6.0)) {
     253      psLogMsg("ppImage", PS_LOG_INFO, "Skipping row pattern correction for %s, %s, stats: %f - %f - %f : %f %f %f\n", chipName, cellName, lower, background, upper, sigma, nominalAmplitude, significance);
     254      return true;
     255    }
     256    //Add some safeties in case of bad fits
     257    if (isnan(significance) || (background < 0.0)) {
    251258      psLogMsg("ppImage", PS_LOG_INFO, "Skipping row pattern correction for %s, %s, stats: %f - %f - %f : %f %f %f\n", chipName, cellName, lower, background, upper, sigma, nominalAmplitude, significance);
    252259      return true;
     
    554561# define READNOISE 10 /* arbitrary number */
    555562    float sigma = sqrt(stats->robustMedian + PS_SQR(READNOISE));
     563    if(isnan(sigma)) sigma=20.; // XXX EAM : somewhat arbitrary number
    556564    float delta = PS_MIN (thresh * sigma, 5*nominalAmplitude);
    557565    float lower = stats->robustMedian - delta; // Lower bound for data
     
    561569    // if the noise from the background is too large
    562570    float significance = nominalAmplitude / sigma;
    563    
     571    significance = abs(significance);
     572     
    564573    // XXX EAM : arbitrary number
    565574    if (isfinite(nominalAmplitude) && (significance < 1.0/6.0)) {
     
    569578      return true;
    570579    }
     580    //Add some safeties in case of bad fits
     581    if (isnan(significance) || (background < 0.0)) {
     582      psLogMsg("ppImage", PS_LOG_INFO, "Skipping row pattern correction due to bad fit for %s, %s, stats: %f - %f - %f : %f %f %f\n", chipName, cellName, lower, background, upper, sigma, nominalAmplitude, significance);
     583      psFree(stats);
     584      psFree(rng);
     585      return true;
     586    }
     587   
    571588    psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s, stats: %f - %f - %f : %f %f %f\n", chipName, cellName, lower, background, upper, sigma, nominalAmplitude, significance);
    572589# endif   
Note: See TracChangeset for help on using the changeset viewer.