Esempio n. 1
0
        /// <summary>获取校准曲线</summary>
        /// <param name="standard_papl">标样列表</param>
        /// <param name="peak_param">峰参数</param>
        /// <param name="am">分析参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static List <object> GetFittingPoint(List <PeakAndPointList> std_papl, AnalyzerMethod am)
        {
            if ((std_papl == null) || (std_papl.Count == 0))
            {
                return(null);
            }

            List <Peak> _standard_peaks = std_papl[0].PeakList.FindAll(CPeakFilter.FindCheckedPeak);

            if (_standard_peaks == null)
            {
                return(null);
            }

            List <Object> _obj_list = new List <object>();

            foreach (Peak _p in _standard_peaks)
            {
                List <Peak> _peak_list = CQuantificationFactory.GetStandardPeakList(std_papl, _p.Name, am.QuantificationMethod);
                if (_peak_list == null)
                {
                    continue;
                }

                List <PointF> _point_list = CQuantificationFactory.GetCalibrationCurve(_peak_list, am.QuantificationMethod);
                if (_point_list == null)
                {
                    continue;
                }

                List <Object> _obj = new List <object>();

                _obj.Add(_point_list);
                _obj.Add(_p.Name);

                _obj_list.Add(_obj);
            }

            return((_obj_list.Count > 0) ? _obj_list : null);
        }
Esempio n. 2
0
        public static QualitativeErrorInfo QA_CreateCalibrationCoeff(List <PeakAndPointList> standard_papl, List <Peak> peak_param, AnalyzerMethod am)
        {
            if ((standard_papl == null) || (standard_papl.Count == 0) || (peak_param == null) || (peak_param.Count == 0))
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;

            //计算标样的峰信息
            foreach (PeakAndPointList _papl in standard_papl)
            {
                _rc = CCalculationFactory.ComputePeakInfo(_papl.PeakList, _papl.PointList, am.CalculationMethod);
                if (_rc != QualitativeErrorInfo.Success)
                {
                    continue;
                }

                CIdentificationFactory.Identify(peak_param, _papl.PeakList, am.IdentificationMethod);
            }

            foreach (Peak _p in peak_param)
            {
                List <Peak> _peak_list = CQuantificationFactory.GetStandardPeakList(standard_papl, _p.Name, am.QuantificationMethod);
                if (_peak_list == null)
                {
                    continue;
                }

                _p.Coefficient = CQuantificationFactory.GetCoefficient(_peak_list, am.QuantificationMethod);
                if (_p.Coefficient == null)
                {
                    continue;
                }

                string _fitting_formula = CQuantificationFactory.GetFittingFormula(_p.Coefficient, am.QuantificationMethod);

                foreach (Peak _p0 in _peak_list)
                {
                    if ((_p0.InternalStandard == null) || _p0.InternalStandard.Trim() == "")
                    {
                        _p0.Coefficient    = _p.Coefficient.GetRange(0, _p.Coefficient.Count);
                        _p0.FittingFormula = _fitting_formula;
                    }
                }
            }
            return(_rc);
        }
Esempio n. 3
0
        /// <summary>根据标样曲线,进行多点校正/// </summary>
        /// <param name="std_papl">标样列表</param>
        /// <param name="unknown_papl">未知样品</param>
        /// <param name="am">分析参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo QA_MultiPointFitting(List <PeakAndPointList> std_papl, PeakAndPointList unknown_papl, AnalyzerMethod am)
        {
            if (std_papl == null || std_papl.Count <= 0 || unknown_papl == null)
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;

            //检查标样的浓度是否正常
            if (SampleIsError(std_papl))
            {
                Debug.WriteLine("The sample doesn't meet the requirements for calculation.");
                return(QualitativeErrorInfo.ConcentrationEmpty);
            }

            //计算标样的峰信息
            _rc = CCalculationFactory.ComputePeakInfo(std_papl[0].PeakList, std_papl[0].PointList, am.CalculationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            List <Peak> _valid_standard_list = std_papl[0].PeakList.FindAll(CPeakFilter.FindCheckedPeak);

            if (_valid_standard_list == null)
            {
                return(QualitativeErrorInfo.StandardSampleError);
            }
            //计算校准曲线
            //List<PeakAndPointList> _unknown_std_papl = std_papl.GetRange(1, std_papl.Count - 1);
            //_rc = QA_CreateCalibrationCoeff(_unknown_std_papl, _valid_standard_list, am);
            _rc = QA_CreateCalibrationCoeff(std_papl, _valid_standard_list, am);

            //计算未知样的峰信息
            ResetPeakList(unknown_papl.PeakList);
            _rc = CCalculationFactory.ComputePeakInfo(unknown_papl.PeakList, unknown_papl.PointList, am.CalculationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            //定性未知峰
            List <Peak> _target_list = CIdentificationFactory.Identify(_valid_standard_list, unknown_papl.PeakList, am.IdentificationMethod);

            if (_target_list == null)
            {
                return(QualitativeErrorInfo.IdentifyPeakError);
            }

            //定量
            _rc = CQuantificationFactory.Quantitate(_target_list, am.QuantificationMethod);
            return(_rc);
        }
Esempio n. 4
0
        /// <summary>单点校正函数,此单点校正有不止一个标样,按多个标样的平均值计算。</summary>
        /// <param name="std_papl">标样列表</param>
        /// <param name="unknown_papl">未知样品</param>
        /// <param name="am">分析参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo QA_SinglePointFitting(List <PeakAndPointList> std_papl, PeakAndPointList unknown_papl, AnalyzerMethod am)
        {
            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;

            if (std_papl == null || std_papl.Count <= 0)
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            //计算标样的峰信息
            foreach (PeakAndPointList _papl in std_papl)
            {
                CCalculationFactory.ComputePeakInfo(_papl.PeakList, _papl.PointList, am.CalculationMethod);
            }

            List <Peak> _std_list = std_papl[0].PeakList.FindAll(CPeakFilter.FindCheckedPeak);

            if (_std_list == null)
            {
                return(QualitativeErrorInfo.StandardSampleError);
            }

            _rc = CQuantificationFactory.GetAdjustFactor(_std_list, am.QuantificationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            //如果存在多组标样,需要首先定性这些标样
            if (std_papl.Count > 1)
            {
                List <Peak> _aver_std_list = GetAverStandardPeakList(std_papl, _std_list, am.IdentificationMethod, am.QuantificationMethod);
                if (_aver_std_list != null)
                {
                    _std_list = _aver_std_list;
                }
            }
            //计算未知峰信息
            ResetPeakList(unknown_papl.PeakList);

            CCalculationFactory.ComputePeakInfo(unknown_papl.PeakList, unknown_papl.PointList, am.CalculationMethod);

            //定性未知样
            List <Peak> _target_list = CIdentificationFactory.Identify(_std_list, unknown_papl.PeakList, am.IdentificationMethod);

            if (_target_list == null)
            {
                return(QualitativeErrorInfo.IdentifyPeakError);
            }

            //定量未知样
            _rc = CQuantificationFactory.Quantitate(_target_list, am.QuantificationMethod);
            return(_rc);
        }
Esempio n. 5
0
        /// <summary>归一化法</summary>
        /// <param name="std_papl">标准样品</param>
        /// <param name="unknown_papl">未知样品</param>
        /// <param name="pcm">计算方法参数</param>
        /// <param name="pqm">定量方法参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo QA_CorrectedNormalization(PeakAndPointList std_papl, PeakAndPointList unknown_papl, AnalyzerMethod am)
        {
            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;

            //计算标样峰信息
            _rc = CCalculationFactory.ComputePeakInfo(std_papl.PeakList, std_papl.PointList, am.CalculationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            //计算标样校正因子
            _rc = CQuantificationFactory.GetAdjustFactor(std_papl.PeakList, am.QuantificationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            ResetPeakList(unknown_papl.PeakList);

            //计算未知样峰信息
            _rc = CCalculationFactory.ComputePeakInfo(unknown_papl.PeakList, unknown_papl.PointList, am.CalculationMethod);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(_rc);
            }

            //定性未知样
            List <Peak> _target_list = CIdentificationFactory.Identify(std_papl.PeakList, unknown_papl.PeakList, am.IdentificationMethod);

            if (_target_list == null)
            {
                return(QualitativeErrorInfo.IdentifyPeakError);
            }

            //未知样定量
            _rc = CQuantificationFactory.Quantitate(_target_list, am.QuantificationMethod);

            return(_rc);
        }
Esempio n. 6
0
        /// <summary>百分比法</summary>
        /// <param name="unknown_papl">PeakAndPointList对象</param>
        /// <param name="pcm">计算方法参数</param>
        /// <param name="pqm">定量方法参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo QA_Normalization(PeakAndPointList unknown_papl, AnalyzerMethod am, bool bfilter)
        {
            ClearPeakResult(unknown_papl.PeakList);
            am.QuantificationMethod.Calibration_Method = PeakQuantificationMethod.CalibrationMethod.cm_Normalization;

            if (bfilter)
            {
                CCalculationFactory.ComputePeakInfo(unknown_papl.PeakList, unknown_papl.PointList, am.CalculationMethod);
            }

            return(CQuantificationFactory.Quantitate(unknown_papl.PeakList, am.QuantificationMethod));
        }
Esempio n. 7
0
 /// <summary>百分比法</summary>
 /// <param name="unknown_papl">PeakAndPointList对象</param>
 /// <param name="pcm">计算方法参数</param>
 /// <param name="pqm">定量方法参数</param>
 /// <returns>QualitativeErrorInfo枚举值</returns>
 public static QualitativeErrorInfo QA_Normalization(PeakAndPointList unknown_papl, AnalyzerMethod am)
 {
     return(QA_Normalization(unknown_papl, am, true));
 }
Esempio n. 8
0
        public static QualitativeErrorInfo QA_ComputePeakInfo(PeakAndPointList unknown_papl, AnalyzerMethod am)
        {
            ClearPeakResult(unknown_papl.PeakList);

            return(CCalculationFactory.ComputePeakInfo(unknown_papl.PeakList, unknown_papl.PointList, am.CalculationMethod, CPeakFilter.FindValidPeak));
        }