static void TestAverages() { Timer totalTimer = new Timer("Total execution"); Timer parseTimer = new Timer("Parsing CSV content"); Timer strengthTimer = new Timer("Calculating handstrength"); Timer outputTimer = new Timer("Writing output"); totalTimer.start(); ReportReader reader = new ReportReader("E:\\PIOprocessing\\Reports"); outputTimer.start(); OutputFile testOutput = new OutputFile("E:\\PIOprocessing\\test.csv"); outputTimer.stop(); foreach (Report report in reader.Reports) { // outputTimer.start(); report.GenerateHandsFile(testOutputDir); // outputTimer.stop(); string reportName = report.GetReportDirectory(); foreach (KeyValuePair <HandType, HandGroup> handType in report.HandTypes) { foreach (string freqLabel in handType.Value.GetFrequencyLabels()) { FrequencyValues freqValues = handType.Value.GetFrequencyValues(freqLabel); string[] outputLine = new string[freqValues.GetHandStrengthOrders().Length + 3]; outputLine[0] = reportName; outputLine[1] = handType.Key.ToString(); outputLine[2] = freqLabel; int index = 3; foreach (int order in freqValues.GetHandStrengthOrders()) { outputLine[index] = freqValues.GetFrequency(order).ToString(); index++; } testOutput.writeCsvLine(outputLine); } } } totalTimer.stop(); totalTimer.log(); }
public void LoadPlotModel(HandType type) { string title = $"{Report.Spot.Action} {Report.Spot.AggPos}vs{Report.Spot.CllPos} {Report.Spot.BoardType} {Report.Spot.BoardSubtype} {type}"; PlotModel = new PlotModel { Title = title, TitleColor = ThemeModel.OxyForegroundColour, TextColor = ThemeModel.OxyForegroundColour, LegendTextColor = ThemeModel.OxyForegroundColour, PlotAreaBorderColor = ThemeModel.OxyForegroundColour }; OxyPlot.Axes.LinearAxis yAxis = new OxyPlot.Axes.LinearAxis { Position = AxisPosition.Left, MajorStep = 10, MinorStep = 10, Minimum = 0, Maximum = 100, AxislineColor = ThemeModel.OxyForegroundColour, TextColor = ThemeModel.OxyForegroundColour }; OxyPlot.Axes.LinearAxis xAxis = new OxyPlot.Axes.LinearAxis { Position = AxisPosition.Bottom, MajorStep = 1, MinorStep = 1, AxislineColor = ThemeModel.OxyForegroundColour, TextColor = ThemeModel.OxyForegroundColour }; // CategoryAxis catAxis = new CategoryAxis( {Position = AxisPosition.Bottom, MajorStep = 1, MinorStep = 1); xAxis.LabelFormatter = getXLabel; PlotModel.Axes.Add(xAxis); PlotModel.Axes.Add(yAxis); handGroup = Report.GetHandGroup(type); string[] frequencyLabels = handGroup.GetFrequencyLabels(); foreach (string frequencyLabel in frequencyLabels) { List <DataPoint> pointsList = new List <DataPoint>(); FrequencyValues freqValues = handGroup.GetFrequencyValues(frequencyLabel); foreach (int order in freqValues.GetHandStrengthOrders()) { pointsList.Add(new DataPoint(order, freqValues.GetFrequency(order))); } LineSeries series = new LineSeries() { InterpolationAlgorithm = InterpolationAlgorithms.CanonicalSpline, Title = frequencyLabel, ItemsSource = pointsList, MarkerSize = 5, MarkerType = MarkerType.Circle }; PlotModel.Series.Add(series); } }