protected void GettingCurvingPointsandFitting(Attennuator tempAtten, ErrorDetector tempED) { lock (tempAtten) { try { double intercept; double slope; byte tmepCount = 0; Log.SaveLogToTxt("Step6...SerchCoefPoints"); { SerchCoefPoints(tempAtten, tempED, attPoint, ber_erp, testBerStruct.CoefCsenAddStep, testBerStruct.CoefCsenSubStep, out attPoints, out berPoints); tmepCount = (byte)Math.Min(attPoints.Count, berPoints.Count); double[] tempattPoints = new double[tmepCount]; double[] tempberPoints = new double[tmepCount]; for (byte i = 0; i < tmepCount; i++) { tempattPoints[i] = double.Parse(attPoints[i].ToString()); tempberPoints[i] = double.Parse(berPoints[i].ToString()); Log.SaveLogToTxt("attPoints[ " + i.ToString() + "]" + double.Parse(attPoints[i].ToString()) + " " + "berPoints[ " + i.ToString() + "]" + double.Parse(berPoints[i].ToString())); } Algorithm.LinearRegression(Algorithm.Getlog10(Algorithm.GetNegative(Algorithm.Getlog10(tempberPoints))), tempattPoints, out slope, out intercept); sensitivityPoint = slope + (intercept * System.Math.Log10(System.Math.Log10(ber_erp) * (-1))); Log.SaveLogToTxt("LinearSlope=" + intercept + " LinearOffset= " + slope);// 因为Offset 和 Slope 的幅值颠倒 Leo } } catch (System.Exception ex) { throw ex; } } }