Beispiel #1
0
        public void SaveAutocorrelations(Person person, string toFilePath = null, int shiftBy = 0)
        {
            if (String.IsNullOrEmpty(toFilePath))
            {
                toFilePath = String.Concat(person.Id, "Autocorrelations_",
                                           shiftBy, "_shiftPoints_",
                                           person.CheckpointRate.ToReadableString(),
                                           ".csv");
            }

            var result = calculationService.GetAutoCorrelationsForShifts(person, shiftBy);

            correlationService.SaveOne(result, toFilePath);
        }
Beispiel #2
0
        public IEnumerable <string> SaveAutocorrelations(Group group,
                                                         int shiftBy                   = 0,
                                                         int degreeOfParallelism       = 2,
                                                         bool performDataRandomization = false)
        {
            var bag = new ConcurrentBag <string>();

            var options = new ParallelOptions
            {
                MaxDegreeOfParallelism = degreeOfParallelism
            };

            Parallel.ForEach(group.People, options, person =>
            {
                string toFilePath = String.Concat(person.Id,
                                                  "Autocorrelations_",
                                                  shiftBy, "_shiftPoints_",
                                                  person.CheckpointRate.ToReadableString(),
                                                  ".csv");
                var result = _personCalcService.GetAutoCorrelationsForShifts(
                    person, shiftBy, performDataRandomization);
                string output = _correlationService.SaveOne(result, toFilePath);
                bag.Add(output);
            });

            return(bag.AsEnumerable());
        }