private void PlotRoadProfile(Plot2DPanel roadProfilePlot2DPanel) { roadProfilePlot2DPanel.Clear(); string selectedItem = "Road profile"; List <double> horizentalAxisData = new List <double>(); List <double> verticalAxisData = new List <double>(); double xMin = metricMap.RoadPointList[0].X; double xMax = metricMap.RoadPointList.Last().X; // It is assumed that there are only one SegmentSpeedProfile for (int i = 0; i < metricMap.MapSegmentList[0].NaturalCubicSplineList.Count; i++) { for (double u = 0; u <= 1; u += 0.1) { double x = metricMap.MapSegmentList[0].NaturalCubicSplineList[i].GetPoint(u).CoordinateList[0]; double z = metricMap.MapSegmentList[0].NaturalCubicSplineList[i].GetPoint(u).CoordinateList[2]; horizentalAxisData.Add(x); verticalAxisData.Add(z); } } double finalX = metricMap.MapSegmentList[0].NaturalCubicSplineList.Last().GetPoint(1).CoordinateList[0]; double finalZ = metricMap.MapSegmentList[0].NaturalCubicSplineList.Last().GetPoint(1).CoordinateList[2]; horizentalAxisData.Add(finalX); verticalAxisData.Add(finalZ); DataSeries roadProfileDataSeries = new DataSeries(); roadProfileDataSeries.Generate(selectedItem, horizentalAxisData, verticalAxisData); roadProfileDataSeries.SetLineColor(Color.Navy); roadProfileDataSeries.SetPointColor(Color.Blue); roadProfileDataSeries.ConnectRange(xMin, xMax); roadProfileDataSeries.SetPointVisibilityState(false); roadProfileDataSeries.SetLineWidth(0.0035); double horizentalDataRange = horizentalAxisData.Max() - horizentalAxisData.Min(); double verticalDataRange = verticalAxisData.Max() - verticalAxisData.Min(); roadProfilePlot2DPanel.MajorHorizontalTickMarkSpacing = horizentalDataRange / 10; roadProfilePlot2DPanel.MajorVerticalTickMarkSpacing = verticalDataRange / 4; roadProfilePlot2DPanel.AxisColor = Color.Black; roadProfilePlot2DPanel.VerticalAxisVisible = true; roadProfilePlot2DPanel.HorizontalAxisVisible = true; roadProfilePlot2DPanel.HorizontalAxisMarkingsVisible = true; roadProfilePlot2DPanel.GridVisible = true; roadProfilePlot2DPanel.SetHorizontalPlotRange(horizentalAxisData.Min(), horizentalAxisData.Max()); roadProfilePlot2DPanel.SetVerticalPlotRange(verticalAxisData.Min(), verticalAxisData.Max()); // Hardcoded range for the speed profile, need to be fixed. roadProfilePlot2DPanel.HorizontalAxisLabel = "X"; roadProfilePlot2DPanel.HorizontalAxisLabelFontSize = 14; roadProfilePlot2DPanel.VerticalAxisLabel = "Elevation"; roadProfilePlot2DPanel.VerticalAxisLabelFontSize = 14; roadProfilePlot2DPanel.HorizontalAxisMarkingsFormatString = "0"; roadProfilePlot2DPanel.VerticalAxisMarkingsFormatString = "0"; roadProfilePlot2DPanel.AddDataSeries(roadProfileDataSeries); }
private void ShowTestSoundFeature(SoundFeature soundFeature) { featureComparisonPlotPanel.Clear(); featureComparisonPlotPanel.VerticalAutoRange = true; DataSeries dataSeries = new DataSeries(); dataSeries.Generate(soundFeature.Name, soundFeature.TimeList, soundFeature.ValueList); dataSeries.SetPointVisibilityState(true); dataSeries.SetPointConnectionState(true); dataSeries.SetLineColor(Color.Cyan); dataSeries.SetPointColor(Color.Blue); featureComparisonPlotPanel.AddDataSeries(dataSeries); }
private void ShowComparisonSoundFeature(SoundFeature comparisonSoundFeature) { DataSeries dataSeries = new DataSeries(); dataSeries.Generate(comparisonSoundFeature.Name, comparisonSoundFeature.TimeList, comparisonSoundFeature.ValueList); dataSeries.SetPointVisibilityState(true); dataSeries.SetPointConnectionState(true); dataSeries.SetLineColor(Color.Black); dataSeries.SetPointColor(Color.Red); List <double> verticalErrorBarList = new List <double>(); for (int ii = 0; ii < comparisonSoundFeature.VarianceList.Count; ii++) { double standardDeviation = Math.Sqrt(comparisonSoundFeature.VarianceList[ii]); verticalErrorBarList.Add(standardDeviation); } dataSeries.AddSymmetricVerticalErrorBars(verticalErrorBarList); dataSeries.SetVerticalErrorBarSerifVisibilityState(true); dataSeries.SetErrorBarRelativeSerifLength(0.002); dataSeries.SetVerticalErrorBarsVisibilityState(true); featureComparisonPlotPanel.AddDataSeries(dataSeries); }
private void AppendFeatureSeries(int selectedSoundIndex, int selectedFeatureIndex) { SoundFeature averageSoundFeature = recognizer.AverageSoundFeatureSetList[selectedSoundIndex].FeatureList[selectedFeatureIndex]; string featureName = averageSoundFeature.Name; DataSeries dataSeries = new DataSeries(); dataSeries.Generate(featureName, averageSoundFeature.TimeList, averageSoundFeature.ValueList); dataSeries.SetPointVisibilityState(true); dataSeries.SetPointConnectionState(true); dataSeries.SetLineColor(Color.Black); dataSeries.SetPointColor(Color.Red); List <double> verticalErrorBarList = new List <double>(); for (int ii = 0; ii < averageSoundFeature.VarianceList.Count; ii++) { double standardDeviation = Math.Sqrt(averageSoundFeature.VarianceList[ii]); verticalErrorBarList.Add(standardDeviation); } dataSeries.AddSymmetricVerticalErrorBars(verticalErrorBarList); dataSeries.SetVerticalErrorBarSerifVisibilityState(true); dataSeries.SetErrorBarRelativeSerifLength(0.002); featurePlotPanel.AddDataSeries(dataSeries); }
private void PlotData(Plot2DPanel plotPanel, List <double> horizontalAxisData, List <double> verticalAxisData) { Color lineColor = Color.Navy; Color pointColor = Color.Blue; plotPanel.Clear(); DataSeries speedProfileDataSeries = new DataSeries(); speedProfileDataSeries.Generate("Logged data", horizontalAxisData, verticalAxisData); speedProfileDataSeries.SetLineColor(lineColor); speedProfileDataSeries.SetPointColor(pointColor); speedProfileDataSeries.ConnectRange(horizontalAxisData.Min(), horizontalAxisData.Max()); speedProfileDataSeries.SetPointVisibilityState(false); speedProfileDataSeries.SetLineWidth(0.0035); double horizentalDataRange = horizontalAxisData.Max() - horizontalAxisData.Min(); double verticalDataRange = optimizationSettings.MaximumSpeedValue - optimizationSettings.MinimumSpeedValue; plotPanel.MajorHorizontalTickMarkSpacing = horizentalDataRange / 10; plotPanel.MajorVerticalTickMarkSpacing = verticalDataRange / 4; plotPanel.AxisColor = Color.Black; plotPanel.VerticalAxisVisible = true; plotPanel.HorizontalAxisVisible = true; plotPanel.HorizontalAxisMarkingsVisible = true; plotPanel.GridVisible = true; plotPanel.SetHorizontalPlotRange(horizontalAxisData.Min(), horizontalAxisData.Max()); plotPanel.SetVerticalPlotRange(optimizationSettings.MinimumSpeedValue, optimizationSettings.MaximumSpeedValue); // Hardcoded range for the speed profile, need to be fixed. plotPanel.HorizontalAxisLabel = "X"; plotPanel.HorizontalAxisLabelFontSize = 14; plotPanel.VerticalAxisLabel = "Speed"; plotPanel.VerticalAxisLabelFontSize = 14; plotPanel.HorizontalAxisMarkingsFormatString = "0"; plotPanel.VerticalAxisMarkingsFormatString = "0.0"; plotPanel.AddDataSeries(speedProfileDataSeries); }
private void PlotSpeedProfile(Plot2DPanel speedProfilePlot2DPanel, PiecewiseLinearSpeedProfile speedProfile, string selectedItem) { if (selectedItem == "Batch run") { } else if (speedProfilePlot2DPanel.HorizontalAxisLabel != "") { speedProfilePlot2DPanel.RemoveSeries(selectedItem); } Color lineColor = Color.Navy; Color pointColor = Color.Blue; if (selectedItem == "Best individual") { lineColor = Color.DarkRed; pointColor = Color.DarkRed; } else if (selectedItem == "Selected individual") { lineColor = Color.DarkGreen; pointColor = Color.DarkGreen; } List <double> horizentalAxisData = new List <double>(); List <double> verticalAxisData = new List <double>(); double xMin = 0; double xMax = speedProfile.ConnectionPointsList.Last()[1]; double entryDistance = 0; double exitDistance = 0; // It is assumed that there are only one SegmentSpeedProfile for (int i = 0; i < speedProfile.ConnectionPointsList.Count; i++) { exitDistance = speedProfile.ConnectionPointsList[i][1]; for (double u = 0; u <= 1; u += 0.1) { double x = entryDistance + u * (exitDistance - entryDistance); double speed = speedProfile.SegmentLinearSpeedProfileList[0].LinearBezierSplineList[i].GetPoint(u).CoordinateList[0]; horizentalAxisData.Add(x); verticalAxisData.Add(speed); } entryDistance = exitDistance; } DataSeries speedProfileDataSeries = new DataSeries(); speedProfileDataSeries.Generate(selectedItem, horizentalAxisData, verticalAxisData); speedProfileDataSeries.SetLineColor(lineColor); speedProfileDataSeries.SetPointColor(pointColor); speedProfileDataSeries.ConnectRange(xMin, xMax); speedProfileDataSeries.SetPointVisibilityState(false); speedProfileDataSeries.SetLineWidth(0.0035); double horizentalDataRange = horizentalAxisData.Max() - horizentalAxisData.Min(); double verticalDataRange = optimizationSettings.MaximumSpeedValue - optimizationSettings.MinimumSpeedValue; speedProfilePlot2DPanel.MajorHorizontalTickMarkSpacing = horizentalDataRange / 10; speedProfilePlot2DPanel.MajorVerticalTickMarkSpacing = verticalDataRange / 4; speedProfilePlot2DPanel.AxisColor = Color.Black; speedProfilePlot2DPanel.VerticalAxisVisible = true; speedProfilePlot2DPanel.HorizontalAxisVisible = true; speedProfilePlot2DPanel.HorizontalAxisMarkingsVisible = true; speedProfilePlot2DPanel.GridVisible = true; speedProfilePlot2DPanel.SetHorizontalPlotRange(horizentalAxisData.Min(), horizentalAxisData.Max()); speedProfilePlot2DPanel.SetVerticalPlotRange(optimizationSettings.MinimumSpeedValue, optimizationSettings.MaximumSpeedValue); // Hardcoded range for the speed profile, need to be fixed. speedProfilePlot2DPanel.HorizontalAxisLabel = "X"; speedProfilePlot2DPanel.HorizontalAxisLabelFontSize = 14; speedProfilePlot2DPanel.VerticalAxisLabel = "Speed"; speedProfilePlot2DPanel.VerticalAxisLabelFontSize = 14; speedProfilePlot2DPanel.HorizontalAxisMarkingsFormatString = "0"; speedProfilePlot2DPanel.VerticalAxisMarkingsFormatString = "0.0"; speedProfilePlot2DPanel.AddDataSeries(speedProfileDataSeries); //speedProfilePlot2DPanel.AddDataSeries(vehicleSpeedDataSeries); }