Index: trunk/archive/pslib/include/psStats.h
===================================================================
--- trunk/archive/pslib/include/psStats.h	(revision 160)
+++ trunk/archive/pslib/include/psStats.h	(revision 215)
@@ -5,16 +5,67 @@
 #include "psStdArrays.h"
 
+typedef enum {
+    PS_STAT_SAMPLE_MEAN           = 0x000001,
+    PS_STAT_SAMPLE_MEAN_ERROR     = 0x000002,
+    PS_STAT_SAMPLE_MEDIAN         = 0x000004,
+    PS_STAT_SAMPLE_MEDIAN_ERROR   = 0x000008,
+    PS_STAT_SAMPLE_STDEV          = 0x000010,
+    PS_STAT_SAMPLE_UQ 		  = 0x000020, 
+    PS_STAT_SAMPLE_LQ 		  = 0x000040,
+    PS_STAT_ROBUST_MEAN           = 0x000080,
+    PS_STAT_ROBUST_MEAN_ERROR     = 0x000100,
+    PS_STAT_ROBUST_MEAN_NVALUES   = 0x000200,
+    PS_STAT_ROBUST_MEDIAN         = 0x000400,
+    PS_STAT_ROBUST_MEDIAN_ERROR   = 0x000800,
+    PS_STAT_ROBUST_MEDIAN_NVALUES = 0x001000,
+    PS_STAT_ROBUST_STDEV          = 0x002000,
+    PS_STAT_ROBUST_UQ 		  = 0x004000, 
+    PS_STAT_ROBUST_LQ 		  = 0x008000,
+    PS_STAT_CLIPPED_MEAN          = 0x010000,
+    PS_STAT_CLIPPED_MEAN_ERROR    = 0x020000,
+    PS_STAT_CLIPPED_MEAN_NVALUES  = 0x040000,
+    PS_STAT_CLIPPED_MEAN_NSIGMA   = 0x080000,
+    PS_STAT_MAX     		  = 0x100000,     
+    PS_STAT_MIN     		  = 0x200000,
+    PS_STAT_NVALUES 		  = 0x400000
+} psStatsOptions;    			  
+
+/** generic statistics structure */
+typedef struct {
+    double sampleMean			//<! formal mean of sample
+    double sampleMeanError;		//<! error on formal mean
+    double sampleMedian			//<! formal median of sample
+    double sampleMedianError;		//<! error on formal median
+    double sampleStdev;			//<! standard deviation of sample
+    double sampleUQ;			//<! upper quartile of sample
+    double sampleLQ;			//<! lower quartile of sample
+    double robustMean			//<! robust mean of array
+    double robustMeanError;		//<! error on robust mean
+    int    robustMeanNvalues;		//<! number of measurements used for robust mean
+    double robustMedian			//<! robust median of array
+    double robustMedianError;		//<! error on robust median
+    int    robustMedianNvalues;		//<! number of measurements used for robust median
+    double robustStdev;			//<! robust standard deviation of array
+    double robustUQ;			//<! robust upper quartile
+    double robustLQ;			//<! robust lower quartile
+    double clippedMean			//<! Nsigma clipped mean
+    double clippedMeanError;		//<! error on clipped mean
+    int    clippedMeanNvalues;		//<! number of data points used for clipped mean
+    double clippedMeanNsigma;		//<! Nsigma clip used for clipped mean
+    double min;				//<! minimum data value in array
+    double max;				//<! maximum data value in array
+    int    nValues;			//<! number of data values in array
+    psStatsOptions options;		//<! bitmask of calculated values
+} psStats;
+
+
 /** Do Statistics on an array.  Returns a status value. */
-int
+psStats *
 psArrayStats(const psFloatArray *restrict myArray, //!< Array to be analysed
 	     const psIntArray *restrict maskArray, //!< Ignore elements where (maskArray & maskVal) != 0
 						   //!< May be NULL
 	     unsigned int maskVal,	//!< Only mask elements with one of these bits set in maskArray
-	     int numIter,	        //!< Number of clipping iterations (0 not to clip)
-	     float numSD,		//!< Number of s.d. to clip at
-	     float *restrict mean,	//!< Mean of array (or NULL)
-	     float *restrict sd,	//!< Standard deviation (or NULL)
-	     float *restrict med	//!< Median (or NULL)
-	     );
+	     psStats *stats		//!< stats structure defines stats to be calculated and how
+);
 
 /***********************************************************************************************************/
