IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10026


Ignore:
Timestamp:
Nov 16, 2006, 3:18:05 PM (20 years ago)
Author:
Paul Price
Message:

Using Poisson distribution if threshold is negative.

Location:
trunk/psModules/src/detrend
Files:
2 edited

Legend:

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

    r10022 r10026  
    165165        }
    166166
    167         float target = histo->nums->data.F32[0] * powf(10.0, thresh); // Level to which histogram must fall
    168         int index;
    169         for (index = 0; histo->nums->data.F32[index] > target && index < histo->nums->n; index++)
    170             ;
    171         limit = histo->bounds->data.F32[index];
     167        // Find the mode.  Since this is a Poisson distribution (more or less), this should also be the mean
     168        // and variance.
     169        int max = 0;                    // Index of the mode
     170        for (int i = 0; i < histo->nums->n; i++) {
     171            if (histo->nums->data.F32[i] > histo->nums->data.F32[max]) {
     172                max = i;
     173            }
     174        }
     175
     176        // Since the mode is most likely zero, we add one to get something realistic.  Then "thresh" is
     177        // negative, so we subtract instead of add.
     178        limit = max + 1.0 - thresh * sqrtf((float)max + 1.0);
     179
    172180    } else {
    173181        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
  • trunk/psModules/src/detrend/pmMaskBadPixels.h

    r10023 r10026  
    88/// @author Eugene Magnier, IfA
    99///
    10 /// @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11 /// @date $Date: 2006-11-17 00:50:39 $
     10/// @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11/// @date $Date: 2006-11-17 01:17:59 $
    1212///
    1313/// Copyright 2004 Institute for Astronomy, University of Hawaii
     
    5151/// Bad pixels are identified from the suspect pixels image (accumulated over a large number of images).
    5252/// Pixels marked as suspect in more than "thresh" standard deviations from the mean are identified as bad
    53 /// pixels (output image).  If "thresh" is negative, it is interpreted as a (base 10) logarithm of the
    54 /// fraction by which the number of pixels marked that many times must drop compared to the number of pixels
    55 /// with zero.
     53/// pixels (output image).  If "thresh" is negative, a Poisson is assumed.
    5654psImage *pmMaskIdentifyBadPixels(const psImage *suspects, ///< Accumulated suspect pixels image
    5755                                 float thresh, ///< Threshold for bad pixel (standard deviations)
Note: See TracChangeset for help on using the changeset viewer.