/// <summary> 特殊計算の平均と標準偏差を求める </summary> public List <SpCalcMeanDev> CalcMeanDev(List <CalcSetting> settingDatas, List <SpCalcValue> collectDatas) { //容器を作成 var answers = new List <SpCalcMeanDev>(); var mathLibrary = new MathLibrary(); //指定注目測定点2点の平均・標準偏差を(collectDatas全体から)求める foreach (var settingData in settingDatas) { var data = collectDatas .Where(d => d.Inspect1 == settingData.Inspect1) .Where(d => d.Inspect2 == settingData.Inspect2) .Select(d => d.Value) .ToList(); //容器を作成 var answer = new SpCalcMeanDev { Inspect1 = settingData.Inspect1, Inspect2 = settingData.Inspect2, Operator = settingData.Operator, //平均 SpMeanValue = mathLibrary.CalcMean(data), //標準偏差 SpDevValue = mathLibrary.CalvDev(data) }; answers.Add(answer); } return(answers); }
/// <summary> 平均と標準偏差を求める </summary> public List <CalcValue> CalcMeanDev(InspectItem inspects, List <MeasuredValue> collectDatas) { //容器を作成 var answers = new List <CalcValue>(); //注目測定点名・項目が同じものを取り出し、それぞれ平均・標準偏差を求める foreach (var sInspection in inspects.Inspects) { foreach (var sItem in inspects.Items) { //容器の作成 var answer = new CalcValue(); //リストから同系のものを取り出す var dList = collectDatas .Where(d => d.Inspect == sInspection) .Where(d => d.Item == sItem) .Select(d => d.Value) .ToList(); //リストに格納 //測定点名・項目 answer.Inspect = sInspection; answer.Item = sItem; var mathLibrary = new MathLibrary(); //平均 answer.MeanValue = mathLibrary.CalcMean(dList); //標準偏差 answer.DevValue = mathLibrary.CalvDev(dList); answers.Add(answer); } } return(answers); }
//特殊計算の実行:距離算出 public List <SpCalcValue> SpCalc(List <CalcSetting> settingDatas, List <MeasuredValue> collectDatas) { //容器を作成 var answers = new List <SpCalcValue>(); //collectDatasの各要素ごとに距離算出を行い、リストに保存する foreach (var settingData in settingDatas) { //下記収集・計算をファイル毎に行う foreach (var fname in collectDatas.Select(d => d.Fname).Distinct()) { //測定点1のデータ収集 var instTarget1 = new SpCalcValue(); var target1 = ExtractXyz(settingData.Inspect1, fname, collectDatas); //測定点2のデータ収集 var instTarget2 = new SpCalcValue(); var target2 = ExtractXyz(settingData.Inspect2, fname, collectDatas); //距離計算 var mathLibrary = new MathLibrary(); var distance = mathLibrary.CalcDistance(target1, target2); //リストに格納 var answer = new SpCalcValue { FileName = fname, Inspect1 = settingData.Inspect1, Inspect2 = settingData.Inspect2, Value = distance }; answers.Add(answer); } } return(answers); }