示例#1
0
 private ColumnStats GetColumnStatsXYZ(DataColumn<float> col)
 {
     ColumnStats stats = new ColumnStats();
     //float total = 0;
     float min = float.MaxValue;
     float max = float.MinValue;
     int ct = 0;
     foreach (float cv in col.GetDataList())
     {
         ct++;
         min = Math.Min(cv, min);
         max = Math.Max(cv, max);
       //  total += cv;
     }
     float diff = max - min;
     stats.min = min;
     stats.max = max;
     stats.diff = diff;
     stats.count = ct;
     stats.message = "Min " + min + ", max " + max + ", length: " + diff + " ,samples counted " + ct;
     
     return stats;
 }
示例#2
0
        private ColumnStats GetColumnStatsXYZ(DataColumn<string> col)
        {
            ColumnStats stats = new ColumnStats();
            List<float> vals = new List<float>();
            // try convert to float columns then run stats
            foreach (string v in col.GetDataList()) {
                float val = float.MinValue;
                bool parsed = float.TryParse(v, out val);
                if (parsed) {
                    vals.Add(val);
                }
            }
            if (vals.Count > 0) {
                DataColumn<float> dcf = new DataColumn<float>("tmp");
                dcf.SetDataList(vals);
                stats = GetColumnStatsXYZ(dcf);
            }
            

            return stats;
        }