Example #1
0
        /// <summary>
        /// 已知三角形的三个顶点坐标,计算三角形的高
        /// </summary>
        /// <param name="A">顶点</param>
        /// <param name="B">左顶点</param>
        /// <param name="C">右顶点</param>
        /// <returns>高</returns>
        //private Double ComputePeakHeight(PointF A, PointF B, PointF C)
        //{
        //    Double height = 0;
        //    //垂直基线求高
        //    //Double a = Math.Sqrt(Math.Pow((C.Y - B.Y), 2) + Math.Pow((C.X - B.X), 2));
        //    //Double b = Math.Sqrt(Math.Pow((A.Y - C.Y), 2) + Math.Pow((A.X - C.X), 2));
        //    //Double c = Math.Sqrt(Math.Pow((B.Y - A.Y), 2) + Math.Pow((B.X - A.X), 2));
        //    //Double p = 0.5 * (a + b + c);
        //    //height = Math.Sqrt(p * (p - a) * (p - b) * (p - c)) * 2 / a;

        //    //顶点纵坐标值求高
        //    //height = A.Y - B.Y;

        //    //垂线与基线相交求高
        //    Double factor = (C.Y - B.Y) / (C.X - B.X);
        //    Double _y = (A.X - B.X) * factor + B.Y;
        //    height = A.Y - _y;
        //    //如果采用第一种求高未获取结果,采用如下第二种处理方法
        //    if (double.IsNaN(height) || height == 0)
        //    {
        //        height = Math.Min(Math.Abs(B.Y - A.Y), Math.Abs(C.Y - A.Y));
        //        height += Math.Abs(B.Y - C.Y) / 2;
        //    }
        //    return height;
        //}
        #endregion

        #endregion

        #region 原有代码
        //#region 计算半峰宽
        ///// <summary>
        ///// 已知峰对象的高、峰曲线列表、基线起点和基线终点,计算半峰高宽
        ///// </summary>
        ///// <param name="height">峰高</param>
        ///// <param name="pList">峰曲线列表</param>
        ///// <param name="startBase">基线起点</param>
        ///// <param name="endBase">基线终点</param>
        ///// <returns>半峰宽</returns>
        //private Double ComputeAnyHeightWidth(Double height, List<PointF> pList, Peak peak)
        //{
        //    Double semiWidth = -1;
        //    List<PointF> _tmp = GetAnyPeakWidthPoint(peak, pList, height);
        //    semiWidth = Math.Abs(_tmp[2].X - _tmp[1].X);
        //    //semiWidth = Math.Sqrt(Math.Pow((_tmp[2].X - _tmp[1].X), 2) + Math.Pow((_tmp[2].Y - _tmp[1].Y), 2));
        //    return semiWidth;
        //}
        //#endregion
        #endregion

        #region 死时间
        protected double GetDeadTime(List <Peak> peak_list, PeakCalculationMethod pcm)
        {
            double _dead_time = 0.0;

            if (pcm.DeadTime_Method == PeakCalculationMethod.DeadTimeMethod.dtm_first_peak)
            {
                Peak _first_peak = peak_list.Find(CPeakFilter.FindNaturalPeak);
                if (_first_peak != null)
                {
                    _dead_time = _first_peak.PeakPoint.X;
                }
                else
                {
                    _dead_time = pcm.DeadTime;
                }
            }
            else
            {
                _dead_time = pcm.DeadTime;
            }

            return(_dead_time);
        }
Example #2
0
        /// <summary>计算峰对象列表中所有峰对象的属性</summary>
        /// <param name="peak_list">峰对象列表</param>
        /// <param name="peak_group_curve">峰组曲线点列表</param>
        /// <param name="pcm">计算方法参数</param>
        /// <param name="filterMethod">过滤器方法</param>
        /// <returns>QualitativeErrorInfo枚举</returns>
        public QualitativeErrorInfo ComputePeakInfo(List <Peak> peak_list, List <PointF> peak_group_curve, PeakCalculationMethod pcm, System.Predicate <Peak> filterMethod)
        {
            if ((peak_list == null) || (peak_list.Count == 0) || (peak_group_curve == null))
            {
                return(QualitativeErrorInfo.PeakListError);
            }

            //获得需要计算的峰列表
            List <Peak> _valid_peak_list = null;

            if (filterMethod != null)
            {
                //_valid_peak_list = peak_list.FindAll(CPeakFilter.FindNaturalPeak);
                _valid_peak_list = peak_list.FindAll(filterMethod);
                if (_valid_peak_list == null)
                {
                    return(QualitativeErrorInfo.PeakListError);
                }
            }
            else
            {
                _valid_peak_list = peak_list;
            }

            //死时间
            double _dead_time = GetDeadTime(peak_list, pcm);

            //依次计算每个峰(有效峰)
            foreach (Peak _p in _valid_peak_list)
            {
                ComputePeakInfo(_p, _dead_time, peak_group_curve);
            }

            //计算分离度,相邻两组分的色谱峰保留值之差与峰底宽总和一半的比值
            ComputeResolution(_valid_peak_list);

            return(QualitativeErrorInfo.Success);
        }
Example #3
0
        public static QualitativeErrorInfo ComputePeakInfo(List <Peak> peak_list, List <PointF> curve_point, PeakCalculationMethod pcm, System.Predicate <Peak> filterMethod)
        {
            CCalculationBase _calculation = null;

            switch (pcm.Pharmacopeia_Method)
            {
            case PeakCalculationMethod.PharmacopeiaMethod.pm_china:
                _calculation = mCChina;
                break;

            case PeakCalculationMethod.PharmacopeiaMethod.pm_japan:
                _calculation = mCJP;
                break;

            case PeakCalculationMethod.PharmacopeiaMethod.pm_japan2:
                _calculation = mCJP2;
                break;

            case PeakCalculationMethod.PharmacopeiaMethod.pm_usp:
            default:
                _calculation = mCUSP;
                break;
            }

            return(_calculation.ComputePeakInfo(peak_list, curve_point, pcm, filterMethod));
        }
Example #4
0
 public static QualitativeErrorInfo ComputePeakInfo(List <Peak> peak_list, List <PointF> curve_point, PeakCalculationMethod pcm)
 {
     return(ComputePeakInfo(peak_list, curve_point, pcm, CPeakFilter.FindNaturalPeak));
 }