public void PerfectFilter(PointPairList h) { for (var i = 0; i < Data.Count; i++) { Data[i] = Analyser.PerfectFilter(Data[i], h); } }
public void PerfectFilterNoise(PointPairList h, double alpha) { for (var i = 0; i < Data.Count; i++) { Data[i] = Analyser.PerfectFilterNoise(Data[i], h, alpha); } }
public Complex[,] ReverseSpectreComplexes(Complex[,] Spectre) { var reverse_spec = new Complex[Spectre.GetLength(0), Spectre.GetLength(1)]; for (var i = 0; i < Spectre.GetLength(0); ++i) { var row_spec = new List <Complex>(); for (var j = 0; j < Spectre.GetLength(1); ++j) { row_spec.Add(Spectre[i, j]); } var column_reverse_spec = Analyser.ReverseSpectre(row_spec); for (var k = 0; k < Spectre.GetLength(1); ++k) { reverse_spec[i, k] = column_reverse_spec[k]; } } for (var i = 0; i < Spectre.GetLength(1); ++i) { var column_spec = new List <Complex>(); for (var j = 0; j < Spectre.GetLength(0); ++j) { column_spec.Add(reverse_spec[j, i]); } var columnSpectre = Analyser.ReverseSpectre(column_spec); for (var k = 0; k < columnSpectre.Count; ++k) { reverse_spec[k, i] = columnSpectre[k]; } } return(reverse_spec); }
public Complex[,] Spectre2D() { var row_spec = new Complex[Data.Count, Data[0].Count]; for (var i = 0; i < Data.Count; ++i) { var lineSpectre = Analyser.GetSpectre(Analyser.ListToComplex(Data[i])); for (var j = 0; j < lineSpectre.Count; ++j) { row_spec[i, j] = lineSpectre[j]; } } for (var i = 0; i < Data[0].Count; ++i) { var column_spec = new List <Complex>(); for (var j = 0; j < Data.Count; ++j) { column_spec.Add(row_spec[j, i]); } var columnSpectre = Analyser.GetSpectre(column_spec); for (var k = 0; k < columnSpectre.Count; ++k) { row_spec[k, i] = columnSpectre[k]; } } return(row_spec); }
public static void AntiShift(CurveItem ci) { var list = GraphConverter.GetPointPairListFromCurve(ci); var average = Analyser.GetAverageOnRange(list); Shift(ci, -average); }
public void PottersFilters(PointPairList ppl) { foreach (var line in Data) { var newLine = Analyser.GetConvolution(line, ppl); for (var i = 0; i < line.Count; i++) { line[i] = newLine[i + 64]; } } }
public static bool CheckStationary(PointPairList list, double percent = 2.5, int n = 10) { var min = list.Min(x => x.Y); var max = list.Max(x => x.Y); var part = list.Count / n; var averages = new List <double>(n); var sigmas = new List <double>(n); var meanSquares = new List <double>(n); var ans = new StringBuilder(); var isFirst = true; for (var i = 0; i < n; i++) { averages.Add(Analyser.GetAverageOnRange(list, i * part, Math.Min((i + 1) * part - 1, list.Count - 1)));; sigmas.Add(Analyser.GetSigmaOnRange(list, i * part, Math.Min((i + 1) * part - 1, list.Count - 1))); meanSquares.Add(Analyser.GetMeanSquare(list, i * part, Math.Min((i + 1) * part - 1, list.Count - 1))); ans.Append($"Range [{i + 1}/{n}]\n"); ans.Append($"Average: {averages[i] }\n"); ans.Append($"Dispersion: {sigmas[i] }\n"); ans.Append($"Mean Square: {meanSquares[i] }\n"); if (!isFirst) { ans.Append($"Average diff: {Analyser.GetPercentDiff(averages[i], averages[i - 1], min, max)}%\n"); ans.Append($"Dispersion diff: {Analyser.GetPercentDiff(sigmas[i], sigmas[i - 1], min, max)}%\n"); ans.Append($"Mean squares diff: {Analyser.GetPercentDiff(meanSquares[i], meanSquares[i - 1], min, max)}%\n"); } isFirst = false; } var adiff = Analyser.GetPercentDiff(averages.Min(), averages.Max(), min, max); var ddiff = Analyser.GetPercentDiff(sigmas.Min(), sigmas.Max(), min, max); var meandiff = Analyser.GetPercentDiff(meanSquares.Min(), meanSquares.Max(), min, max); ans.Append($"Globally:\nMax average diff: {adiff}%\nMax dispersion diff: {ddiff}%\nMax mean square diff: {meandiff}%\n"); return(adiff < percent * 2 && ddiff < percent * 2); }
public static void Trend(CurveItem ci, int SizeWindow) { var input_dots = GraphConverter.GetPointPairListFromCurve(ci); for (var i = 1; i < SizeWindow; i += 2) { var average = Analyser.GetAverageOnRange(input_dots, 0, i); ci.Points[i / 2].Y = average; } for (var i = 0; i < ci.Points.Count - SizeWindow; i++) { var average = Analyser.GetAverageOnRange(input_dots, i, i + SizeWindow); ci.Points[i + SizeWindow / 2].Y = average; } for (var i = SizeWindow; i >= 1; i -= 2) { var average = Analyser.GetAverageOnRange(input_dots, input_dots.Count - i - 1, input_dots.Count - 1); ci.Points[ci.Points.Count - 1 - i / 2].Y = average; } }
// x - частоты; y - амплитуды public void DeleteLinesRejectFilter() { var line_d = Analyser.Derivative(Data[0]); var sum = 0.0; var counter = 0; for (var i = 10; i < Data.Count; i += 10) { var lineDnext = Analyser.Derivative(Data[i]); lineDnext = Analyser.GetRxy(line_d, lineDnext); lineDnext = Analyser.GetSpectre(lineDnext); var lineMax = lineDnext.Count / 2; for (var j = lineMax; j < lineDnext.Count; ++j) { if (lineDnext[j].Y > lineDnext[lineMax].Y) { lineMax = j; } } sum += lineDnext[lineMax].X; counter++; } sum /= counter; var filter = Analyser.GetHarryPotter_BS(sum - 0.05, sum + 0.05, 32, 1); var newData = new List <PointPairList>(); foreach (var ppl in Data) { var newppl = Analyser.GetConvolution(ppl, filter); newppl.RemoveRange(0, 32); newppl.RemoveRange(ppl.Count, newppl.Count - ppl.Count); newData.Add(newppl); } Data = newData; }