IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 8, 2006, 1:38:54 AM (19 years ago)
Author:
magnier
Message:
  • moved psHistogram functions to psHistogram.c,h (pslib_strict.h, MAkefile.am, psMemory.c)
  • changed psVectorStats return value to bool (psImageGeomManip.c, psImagePixelExtract.c, psImageStats.c, psMinPoly.c,
  • added FITTED_MEAN,STDEV_V2 (quadratic fit to log-peak)
  • added stats->results
  • set stats->results when stats are measured
  • return stats calculated even if not requested
  • moved vectorFittedStats call out of vectorRobustStats to psVectorStats
  • internal calls to private stats function XXX now tests stats->results for the corresponding flag, NOT if value of stats->XXX == NAN.
  • dropped unused function NonEmpty (commented out)
  • rolled up vectorSampleMedian with if tests in the loop
  • rolled up vectorSampleStdev with if tests in the loop
  • call psError on failure for any internal stats call (the user should call psErrorClear if they ignore errors from psVectorStats)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psStats.h

    r8468 r10550  
    77 *  on those data structures.
    88 *
    9  *  XXX: The following stats members are never used, or set in this code.
    10  *      stats->robustN50
    11  *      stats->clippedNvalues
    12  *      stats->binsize
    13  *
    149 *  @author GLG, MHPCC
    1510 *
    16  *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2006-08-22 15:02:08 $
     11 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-12-08 11:38:54 $
    1813 *
    1914 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    2015 */
     16
    2117#ifndef PS_STATS_H
    2218#define PS_STATS_H
    2319
    24 #include "psVector.h"
     20// #include "psVector.h"
    2521
    2622/// @addtogroup Stats
     
    3531 *  @see psStats, psVectorStats, psImageStats
    3632 */
    37 // XXX: Is PS_STAT_ROBUST_FOR_SAMPLE obsolete?
    3833typedef enum {
     34    PS_STAT_NONE            = 0x000000, ///< Empty set
    3935    PS_STAT_SAMPLE_MEAN     = 0x000001, ///< Sample Mean
    4036    PS_STAT_SAMPLE_MEDIAN   = 0x000002, ///< Sample Median
     
    5147    PS_STAT_MIN             = 0x001000, ///< Minumum
    5248    PS_STAT_USE_RANGE       = 0x002000, ///< Range
    53     PS_STAT_USE_BINSIZE     = 0x004000  ///< Binsize
     49    PS_STAT_USE_BINSIZE     = 0x004000, ///< Binsize
     50    PS_STAT_FITTED_MEAN_V2  = 0x008000, ///< Fitted Mean
     51    PS_STAT_FITTED_STDEV_V2 = 0x010000, ///< Fitted Standard Deviation
    5452} psStatsOptions;
    5553
     
    8179    double binsize;                    ///< binsize for robust fit (input/ouput)
    8280    long nSubsample;                   ///< maxinum number of measurements (input)
    83     psStatsOptions options;            ///< bitmask of calculated values
     81    psStatsOptions options;            ///< bitmask of values requested
     82    psStatsOptions results;            ///< bitmask of values calculated
    8483}
    8584psStats;
     
    8988 *  @return psStats*    the statistical results as specified by stats->options
    9089 */
    91 psStats* psVectorStats(
     90bool psVectorStats(
    9291    psStats* stats,                    ///< stats structure defines stats to be calculated and how
    9392    const psVector* in,                ///< Vector to be analysed.
     
    117116);
    118117
    119 
    120 /******************************************************************************
    121     Histogram functions and data structures.
    122  *****************************************************************************/
    123 
    124 /** The basic histogram structure which contains bounds and bins.
    125  *
    126  *  In this structure, the vector bounds specifies the boundaries of the
    127  *  histogram bins, and must of type psF32, while nums specifies the number
    128  *  of entries in the bin, and must of type psU32. The value of bounds.n must
    129  *  therefore be 1 greater than than nums.n. The two values minNum and maxNum
    130  *  are the number of data values which fell below the lower limit bound or
    131  *  above the upper limit bound, respectively.
    132  */
    133 typedef struct
    134 {
    135     const psVector* bounds;            ///< Bounds for the bins (type F32)
    136     psVector* nums;                    ///< Number in each of the bins (INT)
    137     int minNum;                        ///< Number below the minimum
    138     int maxNum;                        ///< Number above the maximum
    139     bool uniform;                      ///< Is it a uniform distribution?
    140 }
    141 psHistogram;
    142 
    143 /** Allocator for psHistogram where the bounds of the bins are implicitly
    144  *  specified through simply specifying an upper and lower limit along with
    145  *  the size of the bins.
    146  *
    147  *  @return psHistogram*    Newly allocated psHistogram
    148  */
    149 psHistogram* psHistogramAlloc(
    150     float lower,                       ///< Lower limit for the bins
    151     float upper,                       ///< Upper limit for the bins
    152     int n                              ///< Number of bins
    153 );
    154 
    155 
    156 /** Checks the type of a particular pointer.
    157  *
    158  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
    159  *
    160  *  @return bool:       True if the pointer matches a psHistogram structure, false otherwise.
    161  */
    162 bool psMemCheckHistogram(
    163     psPtr ptr                          ///< the pointer whose type to check
    164 );
    165 
    166 
    167 /** Allocator for psHistogram where the bounds of the bins are explicitly
    168  *  specified.
    169  *
    170  *  @return psHistogram*    Newly allocated psHistogram
    171  */
    172 psHistogram* psHistogramAllocGeneric(
    173     const psVector* bounds             ///< Bounds for the bins
    174 );
    175 
    176 /** Calculate a histogram
    177  *
    178  *  The following function populates the histogram bins from the specified
    179  *  vector (in). It alters and returns the histogram out structure. The input
    180  *  vector may be of types psU8, psU16, psF32, psF64.
    181  *
    182  *  @return psHistogram*   histogram result
    183  */
    184 psHistogram* psVectorHistogram(
    185     psHistogram* out,                  ///< Histogram data
    186     const psVector* values,            ///< Vector to analyse
    187     const psVector* errors,            ///< Errors
    188     const psVector* mask,              ///< Mask dat for input vector
    189     psMaskType maskVal                 ///< Mask value
    190 );
    191 
    192 
    193118// Get the statistics option from a string
    194119psStatsOptions psStatsOptionFromString(const char *string);
     
    207132
    208133#endif // #ifndef PS_STATS_H
     134
     135/*
     136 * private stats functions used in psStats.c:
     137 *
     138 * vectorSampleMean
     139   (none)
     140 * vectorMinMax
     141   (none)
     142 * vectorSampleMedian (also yields SAMPLE_QUARTILE)
     143   (none)
     144 * vectorSampleStdev
     145   (vectorSampleMean)
     146 * vectorClippedStats
     147   (vectorSampleMedian)
     148   (vectorSampleMean (*also subset))
     149   (vectorSampleStdev (*also subset))
     150 * vectorRobustStats
     151   (vectorMinMax (*only subset))
     152 * vectorFittedStats
     153   (vectorRobustStats)
     154 
     155 * private stats functions called by other private stats functions are automatically called by
     156 * those functions.  since they set the stats->results flags, they are not called multiple
     157 * times.
     158 
     159 * the private stats functions do not test for their corresponding stats flags: it is not
     160 * necessary to request them if they are called within this function.
     161 
     162*/
Note: See TracChangeset for help on using the changeset viewer.