Пример #1
0
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            List <NamedIndexedList> filesWithValues = files.SelectMany(file => CsvHelper.ParseFileToNamedIndexedLists(file, false)).ToList();
            var i = 0;

            result = new NamedIndexedList("combined")
            {
                IndexedValues = filesWithValues.Select(fv => fv.OnlyValues())
                                .Aggregate((list1, list2) => list1.Intersect(list2).ToList())
                                .ToDictionary(val => i++)
            };
            return(new List <NamedIndexedList> {
                result
            });
        }
Пример #2
0
        // use result of convertion by SumDistance strategy
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            result = new List <NamedIndexedList>();
            int values_number = int.Parse(parameters);
            List <NamedIndexedList> parsedFiles = files.SelectMany(file => CsvHelper.ParseFileToNamedIndexedLists(file, true)).ToList();

            foreach (var fileWithValues in parsedFiles)
            {
                var i = 0;
                result.Add(new NamedIndexedList(fileWithValues.Name)
                {
                    IndexedValues = fileWithValues.IndexedValues.OrderByDescending(kvPair => kvPair.Value)
                                    .Take(values_number)
                                    .ToDictionary(kvPair => i++, kvPair => (double)kvPair.Key)
                });
            }
            return(result);
        }
Пример #3
0
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            List <NamedIndexedList> filesWithValues = files.SelectMany(file => CsvHelper.ParseFileToNamedIndexedLists(file, false)).ToList();

            foreach (var fileWithValues in filesWithValues)
            {
                foreach (int value in fileWithValues.OnlyValues())
                {
                    valuesCounts.TryGetValue(value, out int count);
                    valuesCounts[value] = ++count;
                }
            }
            return(new List <NamedIndexedList> {
                new NamedIndexedList("count")
                {
                    IndexedValues = valuesCounts.OrderByDescending(kvPair => kvPair.Value)
                                    .ToDictionary(kvPair => kvPair.Key, kvPair => (double)kvPair.Value)
                }
            });
        }
Пример #4
0
 private void CreatePointsIfNeeded()
 {
     if (_points.Count == 0)
     {
         List <double> fscores  = CsvHelper.ParseFileToNamedIndexedLists("C:\\KinectData\\converted\\f_scores.csv", true, ',')[0].OnlyValues();
         double        maxscore = fscores.Max();
         List <Color>  gradient = CreateGradient(Colors.Yellow, Colors.Red);
         bool          special;
         for (int index = 0; index < POINTS_COUNT; index++)
         {
             special = new List <int> {
                 3529, 3015
             }.Select(n => n % 1347).Contains(index);
             Ellipse ellipse = new Ellipse
             {
                 Width  = special ? 6 : 2,
                 Height = special ? 6 : 2,
                 Fill   = new SolidColorBrush(special ? Colors.LightBlue : gradient[(int)(fscores[index] / maxscore * 100)])
             };
             _points.Add(ellipse);
             mainWindow.AddPlayerPoint(ellipse);
         }
     }
 }