0
したがって、ファイルから取得した値が特定の範囲内にあるかどうかを判断するコードを記述する必要があります。ファイルから取得した値が範囲内に入るかどうかを確認する
double averageMaximumX = query.Average(t => double.Parse(t.XMax));
double varianceMaximumX = query.Sum(t => Math.Pow(double.Parse(t.XMax) - averageMaximumX, 2));
varianceMaximumX /= query.Count();
double stdDevMaximumX = Math.Sqrt(varianceMaximumX);
double averageMinimumX = query.Average(t => double.Parse(t.XMin));
double varianceMinimumX = query.Sum(t => Math.Pow(double.Parse(t.XMin) - averageMinimumX, 2));
varianceMinimumX /= query.Count();
double stdDevMinimumX = Math.Sqrt(varianceMinimumX);
double averageMaximumY = query.Average(t => double.Parse(t.YMax));
double varianceMaximumY = query.Sum(t => Math.Pow(double.Parse(t.YMax) - averageMaximumY, 2));
varianceMaximumY /= query.Count();
double stdDevMaximumY = Math.Sqrt(varianceMaximumY);
double averageMinimumY = query.Average(t => double.Parse(t.YMin));
double varianceMinimumY = query.Sum(t => Math.Pow(double.Parse(t.YMin) - averageMinimumY, 2));
varianceMinimumY /= query.Count();
double stdDevMinimumY = Math.Sqrt(varianceMinimumY);
double averageMaximumZ = query.Average(t => double.Parse(t.ZMax));
double varianceMaximumZ = query.Sum(t => Math.Pow(double.Parse(t.ZMax) - averageMaximumZ, 2));
varianceMaximumZ /= query.Count();
double stdDevMaximumZ = Math.Sqrt(varianceMaximumZ);
double averageMinimumZ = query.Average(t => double.Parse(t.ZMin));
double varianceMinimumZ = query.Sum(t => Math.Pow(double.Parse(t.ZMin) - averageMinimumZ, 2));
varianceMinimumZ /= query.Count();
double stdDevMinimumZ = Math.Sqrt(varianceMinimumZ);
var results = from item in query
select new
{
XMaxResult = TryParseWithDefault(item.XMax, double.NaN) <= averageMaxX ? "pass" : "FAIL",
XMinResult = TryParseWithDefault(item.XMin, double.NaN) >= averageMinX ? "pass" : "FAIL",
YMaxResult = TryParseWithDefault(item.YMax, double.NaN) <= averageMaxY ? "pass" : "FAIL",
YMinResult = TryParseWithDefault(item.YMin, double.NaN) >= averageMinY ? "pass" : "FAIL",
ZMaxResult = TryParseWithDefault(item.ZMax, double.NaN) <= averageMaxZ ? "pass" : "FAIL",
ZMinResult = TryParseWithDefault(item.ZMin, double.NaN) >= averageMinZ ? "pass" : "FAIL"
};
私はそれぞれの条件のためにそれを試してみて、が良いように思わ見てみましょう。 –