/// <summary> /// 一枚の写真中の複数のピークを同時に渡してその加重平均から波長と誤差を計算する (FindWaveLength2を内部的に呼び出す) /// </summary> /// <param name="p"></param> /// <param name="WaveLength"></param> /// <param name="WaveLengthDev"></param> public static void FindWaveLengthFromMultiPeaks(List <EllipseParameter> ellipses, ref double WaveLength, ref double WaveLengthDev) { if (ellipses == null || ellipses.Count < 1) { return; } double tempTotal = 0; double temp, sigma1, sigma2, weight; double weightTotal = 0; List <double> WL = new List <double>(); for (int i = 0; i < ellipses.Count; i++) { for (int j = i + 1; j < ellipses.Count; j++) { for (int k = 0; k < ellipses[i].millimeters.Count; k++) { if (!double.IsNaN(ellipses[i].millimeters[k]) && !double.IsNaN(ellipses[j].millimeters[k])) { double obs1 = ellipses[i].millimeters[k]; double obs2 = ellipses[j].millimeters[k]; double d1 = ellipses[i].d; double d2 = ellipses[j].d; temp = FindParameter.FindWaveLength2(obs1, obs2, d1, d2, WaveLength); sigma1 = (FindParameter.FindWaveLength2(obs1 + 0.1, obs2, d1, d2, WaveLength) - temp); sigma2 = (FindParameter.FindWaveLength2(obs1, obs2 + 0.1, d1, d2, WaveLength) - temp); if (sigma1 != 0 || sigma2 != 0) { weight = 1 / (sigma1 * sigma1 + sigma2 * sigma2); weightTotal += weight; tempTotal += weight * temp; WL.Add(temp); } } } } } if (weightTotal > 0 && !double.IsInfinity(weightTotal)) { WaveLength = tempTotal / weightTotal; WaveLengthDev = Statistics.Deviation(WL.ToArray()) / Math.Sqrt(Math.Sqrt(2 * WL.Count)); } }
/// <summary> /// 一枚の写真中の複数のピークを同時に渡してその加重平均から波長と誤差を計算する (FindWaveLength2を内部的に呼び出す) /// </summary> /// <param name="p"></param> /// <param name="WaveLength"></param> /// <param name="WaveLengthDev"></param> public static void FindWaveLengthFromMultiPeaks(List <Plane> plane, ref double WaveLength, ref double WaveLengthDev) { if (plane == null) { return; } double tempTotal = 0; double temp, sigma1, sigma2, weight; double weightTotal = 0; List <double> WL = new List <double>(); for (int i = 0; i < plane.Count; i++) { for (int j = i + 1; j < plane.Count; j++) { if (!double.IsNaN(plane[i].MillimeterObs) && !double.IsNaN(plane[j].MillimeterObs) && plane[i].IsFittingChecked && plane[j].IsFittingChecked) { double obs1 = plane[i].MillimeterObs; double obs2 = plane[j].MillimeterObs; double d1 = plane[i].d; double d2 = plane[j].d; temp = FindParameter.FindWaveLength2(obs1, obs2, d1, d2, WaveLength); sigma1 = (FindParameter.FindWaveLength2(obs1 + 0.1, obs2, d1, d2, WaveLength) - temp); sigma2 = (FindParameter.FindWaveLength2(obs1, obs2 + 0.1, d1, d2, WaveLength) - temp); if (sigma1 != 0 || sigma2 != 0) { weight = 1 / (sigma1 * sigma1 + sigma2 * sigma2); weightTotal += weight; tempTotal += weight * temp; WL.Add(temp); } } } } if (weightTotal > 0 && !double.IsInfinity(weightTotal)) { WaveLength = tempTotal / weightTotal; WaveLengthDev = Statistics.Deviation(WL.ToArray()) / Math.Sqrt(Math.Sqrt(2 * WL.Count)); } }
public static void FindSphericalCorrection(List <EllipseParameter> ellipses, double waveLength, double filmDistance, ref double radiusInverse, ref double radiusInverseDev) { double weightTotal = 0; double tempRtotal = 0; List <double> r = new List <double>(); for (int i = 0; i < ellipses.Count; i++) { for (int j = i + 1; j < ellipses.Count; j++) { for (int k = 0; k < ellipses[i].millimeters.Count; k++) { if (!double.IsNaN(ellipses[i].millimeters[k]) && !double.IsNaN(ellipses[j].millimeters[k])) { double obs1 = ellipses[i].millimeters[k]; double obs2 = ellipses[j].millimeters[k]; double d1 = ellipses[i].d; double d2 = ellipses[j].d; double tempR = FindParameter.FindSphericalCorrection(obs1, obs2, d1, d2, waveLength, filmDistance); double sigma1 = FindParameter.FindSphericalCorrection(obs1, obs2 + 0.01, d1, d2, waveLength, filmDistance) - tempR; if (sigma1 != 0) { weightTotal += 1 / (sigma1 * sigma1); tempRtotal += tempR / (sigma1 * sigma1); r.Add(tempR); } } } } } if (weightTotal > 0 && !double.IsInfinity(weightTotal)) { radiusInverse += tempRtotal / weightTotal; radiusInverseDev = Statistics.Deviation(r.ToArray()) / Math.Sqrt(Math.Sqrt(2 * r.Count)); } }