Esempio n. 1
0
        /// <summary>
        /// 格式化分析方法
        /// </summary>
        /// <param name="qm"></param>
        /// <param name="?"></param>
        /// <param name="cp"></param>
        /// <returns></returns>
        public static AnalyzerMethod FormatAnalyzerMethod(QualitativeMode qm, CalculateParameter cp, List <PeakAndPointList> stdsample)
        {
            AnalyzerMethod am        = new AnalyzerMethod();
            float          deltatime = 0.5f;

            if (cp != null)
            {
                deltatime = cp.TimePrecision;
            }
            am.IdentificationMethod.TimeBand    = deltatime;
            am.IdentificationMethod.Time_Method = PeakIdentificationMethod.TimeMethod.tm_band;

            am.QuantificationMethod.ZeroPassage = cp.ZeroPoint;
            switch (cp.Degree)
            {
            case 1:
                am.QuantificationMethod.CurveFitting_Method = PeakQuantificationMethod.CurveFittingMethod.cfm_linear;
                break;

            case 2:
                am.QuantificationMethod.CurveFitting_Method = PeakQuantificationMethod.CurveFittingMethod.cfm_quadratic;
                break;

            case 3:
            default:
                am.QuantificationMethod.CurveFitting_Method = PeakQuantificationMethod.CurveFittingMethod.cfm_cubic;
                break;
            }
            if (cp.Logarithm)
            {
                am.QuantificationMethod.CurveFitting_Method = PeakQuantificationMethod.CurveFittingMethod.cfm_log;
            }
            am.QuantificationMethod.Qualitative_Method = (PeakQuantificationMethod.QualitativeMethod)qm;

            //确定是否为内标
            if (stdsample != null && stdsample.Count > 0)
            {
                foreach (PeakAndPointList pp in stdsample)
                {
                    if (pp == null || pp.PeakList == null || pp.PeakList.Count == 0)
                    {
                        continue;
                    }
                    for (int i = 0; i < pp.PeakList.Count; i++)
                    {
                        if (pp.PeakList[i].Checked && pp.PeakList[i].InternalStandard.Trim() != "")
                        {
                            am.QuantificationMethod.Calibration_Method = PeakQuantificationMethod.CalibrationMethod.cm_InternalStandard;
                            break;
                        }
                    }
                    if (am.QuantificationMethod.Calibration_Method == PeakQuantificationMethod.CalibrationMethod.cm_InternalStandard)
                    {
                        break;
                    }
                }
            }
            return(am);
        }
Esempio n. 2
0
        /// <summary>
        /// 定量计算
        /// </summary>
        /// <param name="cm">定量方法</param>
        /// <param name="qm">定量依据</param>
        /// <param name="cp">计算参数</param>
        /// <param name="stdsample">标样列表</param>
        public static bool Calculate(PeakAndPointList test, CalculateMethods cm, QualitativeMode qm, CalculateParameter cp, List <PeakAndPointList> stdsample)
        {
            try
            {
                AnalyzerMethod am = Graph.FormatAnalyzerMethod(qm, cp, stdsample);
                switch (cm)
                {
                case CalculateMethods.cm_Normalizing:
                    //QualitativeAnalyzer.ComputeNormalization(test, qm,false);
                    QualitativeAnalyzer.QA_ComputePeakInfo(test, am);
                    QualitativeAnalyzer.QA_Normalization(test, am);
                    break;

                case CalculateMethods.cm_CNormalizing:
                    if (stdsample == null || stdsample.Count == 0)
                    {
                        return(false);
                    }
                    //QualitativeAnalyzer.ComputeAjustNormalization(stdsample[0], test, qm, deltatime);
                    ClearPeakText(test.PeakList);
                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //20141221:校正归一计算中,计算Dll中根据参数选择调用函数
                    am.QuantificationMethod.Calibration_Method = PeakQuantificationMethod.CalibrationMethod.cm_CorrectedNormalization;
                    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    QualitativeAnalyzer.QA_CorrectedNormalization(stdsample[0], test, am);
                    UnCalculatePeak(stdsample[0], test);
                    break;

                case CalculateMethods.cm_SCorrection:
                    if (stdsample == null || stdsample.Count == 0)
                    {
                        return(false);
                    }
                    //QualitativeAnalyzer.SinglePointFitting(stdsample[0], test, qm, deltatime);
                    ClearPeakText(test.PeakList);
                    QualitativeAnalyzer.QA_SinglePointFitting(stdsample, test, am);
                    UnCalculatePeak(stdsample[0], test);
                    break;

                case CalculateMethods.cm_MCorrection:
                    if (stdsample == null || stdsample.Count <= 1)
                    {
                        return(false);
                    }
                    //QualitativeAnalyzer.MultiPointFitting(stdsample, test, qm, deltatime, cp.Degree, cp.ZeroPoint, cp.Logarithm);
                    ClearPeakText(test.PeakList);
                    QualitativeAnalyzer.QA_MultiPointFitting(stdsample, test, am);
                    UnCalculatePeak(stdsample[0], test);
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex);
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 定量计算
 /// </summary>
 /// <param name="cm">定量方法</param>
 /// <param name="qm">定量依据</param>
 /// <param name="cp">计算参数</param>
 /// <param name="stdsample">标样列表</param>
 public bool Calculate(CalculateMethods cm, QualitativeMode qm, CalculateParameter cp, List <PeakAndPointList> stdsample)
 {
     try
     {
         //if (cm== CalculateMethods.cm_Normalizing && !Calculated) return true;
         PeakAndPointList test = new PeakAndPointList(_peakhelper.Peaks, _datahelper.List);
         bool             rs   = Calculate(test, cm, qm, cp, stdsample);
         //FormatPeakList(test.PeakList, WaveCanvas.VerticalCoordinate.DataMultiple);
         Calculated = false;
         return(rs);
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(ex);
         return(false);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 格式化分析方法
 /// </summary>
 /// <param name="qm"></param>
 /// <param name="?"></param>
 /// <param name="cp"></param>
 /// <returns></returns>
 public static AnalyzerMethod FormatAnalyzerMethod(QualitativeMode qm, CalculateParameter cp)
 {
     return(FormatAnalyzerMethod(qm, cp, null));
 }