Exemple #1
0
        /// <summary>从多个标样峰列表中找出特定物质的多浓度标样峰</summary>
        /// <param name="std_papl">多个标样峰列表</param>
        /// <param name="std_name">标样名称</param>
        /// <param name="pqm">定量参数</param>
        /// <returns>同种物质的标样峰</returns>
        public static List <Peak> GetStandardPeakList(List <PeakAndPointList> std_papl, string std_name)
        {
            List <Peak> _peak_list = new List <Peak>();

            foreach (PeakAndPointList _papl in std_papl)
            {
                Peak _isp = _papl.PeakList.Find(CPeakFilter.FindInternalStandardPeak);
                if (_isp == null)
                {
                    continue;
                }

                foreach (Peak _p in _papl.PeakList)
                {
                    if (!CPeakFilter.FindCheckedPeak(_p))
                    {
                        continue;
                    }

                    if (_p.Name == std_name)
                    {
                        _peak_list.Add(_p);
                        _peak_list.Add(_isp);
                    }
                }
            }

            return((_peak_list.Count > 0) ? _peak_list : null);
        }
Exemple #2
0
        /// <summary>计算峰列表中峰对象所对应的物质的量</summary>
        /// <param name="peak_list">峰对象列表</param>
        /// <param name="capacity">物质的量</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo Quantitate(List <Peak> peak_list, PeakQuantificationMethod pqm)
        {
            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;
            double _capacity         = 0.0;

            if (pqm.Calibration_Method != PeakQuantificationMethod.CalibrationMethod.cm_ExternalStandard)
            {
                return(QualitativeErrorInfo.CalibrationMethodError);
            }

            //外标定量
            foreach (Peak _p in peak_list)
            {
                if (!CPeakFilter.FindCheckedPeak(_p))
                {
                    continue;
                }

                _capacity = 0.0;

                _rc = GetCapacity(_p, pqm, ref _capacity);
                if (_rc == QualitativeErrorInfo.Success)
                {
                    _p.Capacity = _capacity;
                }
            }
            return(_rc);
        }
Exemple #3
0
        /// <summary>归一法</summary>
        /// <param name="std_peak_list">峰对象列表</param>
        /// <param name="qm">定量参数</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo Quantitate(List <Peak> peak_list, PeakQuantificationMethod pqm)
        {
            if (peak_list == null)
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;

            double _sum = GetResponseSum(peak_list, pqm.Qualitative_Method, PeakQuantificationMethod.SumMethod.sm_absolute_adjust);

            if (_sum == 0)
            {
                return(QualitativeErrorInfo.CapacityError);
            }

            //归一法首先需要定性,以确定校准因子
            foreach (Peak _p in peak_list)
            {
                if (!CPeakFilter.FindCheckedPeak(_p))
                {
                    continue;
                }

                _p.Capacity = _p.AdjustFactor * GetResponseValue(_p, pqm.Qualitative_Method) / _sum;
            }

            return(_rc);
        }
Exemple #4
0
        /// <summary>计算峰列表中每个有效峰的相对校正因子</summary>
        /// <param name="std_peak_list">标准峰对象列表</param>
        /// <param name="qm">响应值类型选择</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo GetAdjustFactor(List <Peak> std_peak_list, PeakQuantificationMethod.QualitativeMethod qm)
        {
            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;
            double _factor           = 0.0;

            if (std_peak_list == null)
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            //至少包含一个内标物和被测物
            if (std_peak_list.Count < 2)
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            //查找内标物
            Peak _internal_standard_peak = std_peak_list.Find(CPeakFilter.FindInternalStandardPeak);

            if (_internal_standard_peak == null)
            {
                return(QualitativeErrorInfo.InternalStandardError);
            }

            //计算内标物的绝对校正因子
            _rc = CQuantificationBase.ComputeAbsoluteAdjustFactor(_internal_standard_peak, qm, ref _factor);
            if (_rc != QualitativeErrorInfo.Success)
            {
                return(QualitativeErrorInfo.InternalStandardError);
            }

            _internal_standard_peak.AdjustFactor = _factor;

            //计算未知物的校正因子(注意未知物列表要剔除内标物)
            foreach (Peak _p in std_peak_list)
            {
                if (!CPeakFilter.FindCheckedPeak(_p) || ((_p.InternalStandard != null) && (_p.InternalStandard != "")))
                {
                    continue;
                }

                _factor = 0.0;

                _rc = CQuantificationBase.ComputeRelativeAdjustFactor(_p, _internal_standard_peak, qm, ref _factor);
                if (_rc == QualitativeErrorInfo.Success)
                {
                    _p.AdjustFactor = _factor;
                }
            }

            return(_rc);
        }
Exemple #5
0
 /// <summary>
 /// 判断样品是否有浓度不符合要求的组分
 /// </summary>
 /// <param name="pList">峰列表(组分列表)</param>
 /// <returns>true or false</returns>
 private static bool CapacityIsError(List <Peak> peak_list)
 {
     foreach (Peak _p in peak_list)
     {
         if (!CPeakFilter.FindCheckedPeak(_p))
         {
             continue;
         }
         if (Double.IsNaN(_p.Capacity) || Double.IsInfinity(_p.Capacity))
         //if (Double.IsNaN(_p.Capacity) || Double.IsInfinity(_p.Capacity) || _p.Capacity == 0)
         {
             //Debug.Write("The peak " + "(" + _p.PeakPoint.X + ")" + " is checked, but its concentration is: " + _p.Capacity + ", ");
             return(true);
         }
     }
     return(false);
 }
Exemple #6
0
        /// <summary>计算峰列表中所有有效峰对应的物质的量</summary>
        /// <param name="peak_list">峰对象列表</param>
        /// <param name="capacity">物质的量</param>
        /// <returns>QualitativeErrorInfo枚举值</returns>
        public static QualitativeErrorInfo Quantitate(List <Peak> peak_list, PeakQuantificationMethod pqm)
        {
            QualitativeErrorInfo _rc = QualitativeErrorInfo.Success;
            double _capacity         = 0.0;

            if (pqm.Calibration_Method != PeakQuantificationMethod.CalibrationMethod.cm_InternalStandard)
            {
                return(QualitativeErrorInfo.CalibrationMethodError);
            }

            //内标定量
            Peak _internal_standard_peak = peak_list.Find(CPeakFilter.FindInternalStandardPeak);

            //if ((_internal_standard_peak == null) || (_internal_standard_peak.AdjustFactor == 0))
            if (_internal_standard_peak == null)
            {
                return(QualitativeErrorInfo.InternalStandardError);
            }

            foreach (Peak _p in peak_list)
            {
                if (!CPeakFilter.FindCheckedPeak(_p) || ((_p.InternalStandard != null) && (_p.InternalStandard != "")))
                {
                    continue;
                }

                _capacity = 0.0;

                _rc = GetCapacity(_p, _internal_standard_peak, pqm, ref _capacity);
                if (_rc == QualitativeErrorInfo.Success)
                {
                    _p.Capacity = _capacity;
                }
            }

            return(_rc);
        }