public void getAllPoints() { if (!Initialized) { return; } List <float> x = getVectorByName(TS_anomalyFlight, Selected); List <float> y = getVectorByName(TS_anomalyFlight, Correlated[Selected]); Tuple <string, string> p = new Tuple <string, string>(Selected, Correlated[Selected]); float x_min = x.Min(); float x_max = x.Max(); if (currentLinePlaying % 300 == 0 && currentLinePlaying != 0) { this.regularPoint.Clear(); this.AnomalyPoints.Clear(); for (int i = currentLinePlaying - 300; i < currentLinePlaying; i++) { KeyValuePair <float, float> point = new KeyValuePair <float, float>(x[i], y[i]); if (Anomalys.ContainsKey(p) && Anomalys[p].Contains(i)) { AnomalyPoints.Add(point); } else { RegularPoints.Add(point); } } } // add linear reg line: if (!Switched) { linearReg.Clear(); if (lin_reg_eq.ContainsKey(p)) { Tuple <float, float> current = lin_reg_eq[p]; float a = current.Item1; float b = current.Item2; float y_min = a * x_min + b; float y_max = a * x_max + b; linearReg.Add(new KeyValuePair <float, float>(x_min, y_min)); linearReg.Add(new KeyValuePair <float, float>(x_max, y_max)); } } }
public void parseAnomalys() { string filePath = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory); filePath += "\\Anomalies.txt"; string[] lines = System.IO.File.ReadAllLines(filePath); foreach (string line in lines) { string[] vars = line.Split(' '); string f1 = vars[0]; string f2 = vars[1]; int line_num = Int32.Parse(vars[2]); Tuple <string, string> p = new Tuple <string, string>(f1, f2); if (Anomalys.ContainsKey(p)) { Anomalys[p].Add(line_num); } else { Anomalys.Add(p, new List <int>()); Anomalys[p].Add(line_num); } } }