/// <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); }
/// <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); }
private static List <Peak> GetAverStandardPeakList(List <PeakAndPointList> unknown_std_papl, List <Peak> standard_list, PeakIdentificationMethod pim, PeakQuantificationMethod pqm) { QualitativeErrorInfo _rc = QualitativeErrorInfo.Success; if ((unknown_std_papl == null) || (unknown_std_papl.Count == 0) || (standard_list == null) || (standard_list.Count == 0)) { return(null); } int[] _std_count = new int[standard_list.Count]; double[] _std_rt = new double[standard_list.Count]; List <Peak> _aver_std_list = new List <Peak>(); for (int i = 0; i < standard_list.Count; i++) { _std_count[i] = 0; _std_rt[i] = 0; Peak _p = new Peak(); _p.Name = standard_list[i].Name; _p.Checked = true; _p.Index = i; _aver_std_list.Add(_p); } foreach (PeakAndPointList _papl in unknown_std_papl) { List <Peak> _unknown_std_list = _papl.PeakList.FindAll(CPeakFilter.FindNaturalPeak); if (_unknown_std_list == null) { continue; } //定性标样峰 List <Peak> _target_list = CIdentificationFactory.Identify(standard_list, _unknown_std_list, pim); if (_target_list == null) { continue; } _rc = CQuantificationFactory.GetAdjustFactor(_target_list, pqm); //计算校正因子 if (_rc != QualitativeErrorInfo.Success) { continue; } foreach (Peak _p in _aver_std_list) { foreach (Peak _p0 in _target_list) { if (_p.Name == _p0.Name) { _p.Capacity += _p0.Capacity; _p.PeakHeight += _p0.PeakHeight; _p.PeakArea += _p0.PeakArea; _p.AdjustFactor += _p0.AdjustFactor; _std_count[_p.Index]++; _std_rt[_p.Index] += _p0.PeakPoint.X; _target_list.Remove(_p0); break; } } } } foreach (Peak _p in _aver_std_list) { int _count = _std_count[_p.Index]; _std_rt[_p.Index] /= _count; _p.Capacity /= _count; _p.PeakHeight /= _count; _p.PeakArea /= _count; _p.AdjustFactor /= _count; _p.PeakPoint = new PointF((float)_std_rt[_p.Index], 0); } return((_aver_std_list.Count > 0) ? _aver_std_list : null); }