예제 #1
0
파일: Plots.cs 프로젝트: Impassive/Badcode
 /// <summary>
 /// Procedure to build Correlation graphic
 /// </summary>
 /// <param name="points">result series where graphic will build</param>
 /// <param name="pointsFirst">first series to correlate</param>
 /// <param name="pointsSecond">second series to correlate</param>
 internal static void AutoCrossCorrelation(DataPointCollection points, DataPointCollection pointsFirst, DataPointCollection pointsSecond)
 {
     points.Clear();
     for (int i = minX; i < maxX; i++)
     {
         points.AddXY(i, Statistics.CrossCorrelation(pointsFirst, pointsSecond, i));
     }
 }
예제 #2
0
        public void Load(Meas[] _MMeas, double _gain, SignalViewPars _pars, Color _color_dead, double[] _borders, bool _IsOn)
        {
            pars = _pars;
            IsOn = _IsOn;
            DataPointCollection pp = series.Points;

            pp.Clear();
            box.Visible    = IsOn;
            series.Enabled = IsOn;
            bline.Visible  = IsOn;
            bline1.Visible = IsOn;
            if (!IsOn)
            {
                return;
            }

            series.Color   = _pars.SColor;
            series.Enabled = _pars.View;
            box.Checked    = _pars.View;
            box.ForeColor  = _pars.View ? _pars.SColor : Color.Black;
            if (_MMeas == null)
            {
                return;
            }
            for (int i = 0; i < _MMeas.Length; i++)
            {
                double v = 0;
                Meas   m = _MMeas[i];
                switch (type)
                {
                case EType.Source:
                    v = m.Source;
                    break;

                case EType.Median:
                    v = m.Median;
                    break;

                case EType.Filter:
                    v = m.Filter;
                    break;

                case EType.FilterIn:
                    v = -m.FilterIn;
                    break;
                }
                v *= _gain;
                DataPoint p = new DataPoint(i, v);
                p.Color = m.Dead ? _color_dead : _pars.SColor;
                pp.Add(p);
            }
            bline.SetBorders(_borders);
            bline.Visible = box.Checked;
            bline1.SetBorders(new double[2] {
                -_borders[0], -_borders[1]
            });
            bline1.Visible = box.Checked;
        }
예제 #3
0
        private void cut_chart(DataPointCollection point_arr, int cut)
        {
            var point_temp = point_arr.Skip(cut).ToArray();

            point_arr.Clear();
            //point_arr.Add(point_temp);

            Console.WriteLine(point_arr.Count);
        }
예제 #4
0
 void Clear()
 {
     mpI.Clear();
     mpU.Clear();
     mpB.Clear();
     mpD0.Clear();
     mpD1.Clear();
     mpD2.Clear();
 }
예제 #5
0
        public static void HisToPoints(CHisElo he, DataPointCollection po)
        {
            po.Clear();
            int x = 100 - he.list.Count;

            foreach (double v in he.list)
            {
                po.AddXY(x++, v);
            }
        }
예제 #6
0
파일: Plots.cs 프로젝트: Impassive/Badcode
        internal static void Trends(DataPointCollection points, string location, double a = 1, double b = 0)
        {
            switch (location)
            {
            case "ChartAreaTopLeft":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, a * i + b);
                }
                break;

            case "ChartAreaTopRight":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, a * i + b);
                }
                break;

            case "ChartAreaBottomLeft":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, b * Math.Pow(Math.E, (-a) * i));
                }
                break;

            case "ChartAreaBottomRight":
                points.Clear();
                for (int i = minX; i < maxX - 5; i++)
                {
                    points.AddXY(i, b * Math.Pow(Math.E, (-a) * i));
                }
                break;

            default:
                break;
            }
        }
예제 #7
0
파일: Plots.cs 프로젝트: Impassive/Badcode
        public static void Test(DataPointCollection points, string location)
        {
            switch (location)
            {
            case "ChartAreaTopLeft":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, 15 * Math.Sin(i));
                }
                Spike(points, 0.025, 20);
                break;

            case "ChartAreaTopRight":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, 15 * Math.Sin(i));
                }
                Spike(points, 0.03);
                break;

            case "ChartAreaBottomLeft":
                points.Clear();
                for (int i = minX; i < maxX; i++)
                {
                    points.AddXY(i, 15 * Math.Sin(i));
                }
                AntiShift(points);
                break;

            case "ChartAreaBottomRight":
                points.Clear();

                break;

            default:
                break;
            }
        }
예제 #8
0
        public void DrawGoodArea()
        {
            if (RK.ST.result == null)
            {
                return;
            }
            SumResult sumResult = RK.ST.result.Sum;

            uSelectResult1.Enabled = true;
            uSelectResult1.RClass  = sumResult.RClass;
            mp1.Clear();
            SumResult.PP pp = sumResult.MaxGood;
            if (pp == null)
            {
                return;
            }
            double pos = pp.index;

            pos *= K;
            mp1.Add(new DataPoint(pos, 1.2));
            pos  = pp.index + pp.count;
            pos *= K;
            mp1.Add(new DataPoint(pos, 1.2));
        }
예제 #9
0
파일: Plots.cs 프로젝트: Impassive/Badcode
 public static void PrepareDPF(DataPointCollection points)
 {
     //Generate function
     points.Clear();
     //Random r = new Random(51);
     //CustomRandom r = new CustomRandom(111);
     for (int i = minX; i < maxX; i++)
     {
         //3 гармоники
         points.AddXY(i, SignalFunc(20, 5, i) + SignalFunc(100, 57, i) + SignalFunc(35, 190, i));
         //линейная ф-ия
         //points.AddXY(i, i);
         //Рандом
         //points.AddXY(i, r.Next()*2-1);
         //Спайки
         //points.AddXY(i, 0);
     }
     //Shift(points, 100 );//points.Select(y => y.YValues[0]).Max());
     //Calculating
     FourierArr = new Complex[points.Count];
     CalculateDPF(FourierArr, points);
 }
예제 #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            /// Пишем код здесь
            ///

            // получаем точки серии
            DataPointCollection pts = this.chart1.Series[0].Points;

            // чистим старое содержимое
            pts.Clear();

            // генератор случайных чисел, начальное число зависит от времени
            Random r = new Random();

            // N - количество точек графика
            // случайно от 100 до 500
            int N = r.Next(100, 500);

            // цикл добавления точек
            for (int i = 0; i < N; i++)
            {
                pts.AddXY(i, r.NextDouble());
            }

            /*
             * double[] y = { 483, 655, 945, 1444, 2120, 2926, 5567, 6197, 8288, 11302, 13950,
             *                  16758, 17498, 23865, 28276, 30814, 34375, 37111, 37598, 40632,
             *                      43145, 48076, 60414, 64474, 67195, 69289, 71450, 73439 };
             * int N1 = y.Length;
             * // цикл добавления точек
             * for (int i = 0; i < N1; i++)
             * {
             *  pts.AddXY(i, y[i]);
             * }
             */
        }
예제 #11
0
파일: Plots.cs 프로젝트: Impassive/Badcode
        internal static void AddVoiceFilter(DataPointCollection points, string location, double fcut, int m, double dt)
        {
            //build charts:
            switch (location)
            {
            case "ChartAreaTopLeft":
                points.Clear();
                for (int i = 0; i < maxX; i++)
                {
                    points.AddXY(i, 1);
                }
                break;

            case "ChartAreaTopRight":
                points.Clear();
                List <double> lpw_lpf = LPF_Filter(fcut, m, dt);
                for (int k = minX; k < maxX; k++)
                {
                    double y = 0;
                    for (int l = minX; l < 1; l++)
                    {
                        if (k >= l && (k - l) < lpw_lpf.Count)
                        {
                            y += lpw_lpf[k - l] * 1;
                        }
                    }
                    points.AddXY(k, y);
                }
                break;

            case "ChartAreaBottomLeft":
                points.Clear();
                List <double> lpw_hpf = HPF_Filter(fcut, m, dt);
                for (int k = minX; k < maxX; k++)
                {
                    double y = 0;
                    for (int l = minX; l < 1; l++)
                    {
                        if (k >= l && (k - l) < lpw_hpf.Count)
                        {
                            y += lpw_hpf[k - l] * 1;
                        }
                    }
                    points.AddXY(k, y);
                }
                break;

            case "ChartAreaBottomRight":
                points.Clear();
                List <double> lpw_bpf = BPF_Filter(fcut, 210, m, dt);
                for (int k = minX; k < maxX; k++)
                {
                    double y = 0;
                    for (int l = minX; l < 1; l++)
                    {
                        if (k >= l && (k - l) < lpw_bpf.Count)
                        {
                            y += lpw_bpf[k - l] * 1;
                        }
                    }
                    points.AddXY(k, y);
                }
                break;

            default:
                break;
            }
        }
예제 #12
0
        DataPointCollection ShowPoint2; ///用来显示的点集2

        private void SATest1BTN_Click(object sender, EventArgs e)
        {
            NowQueenSolve = Form1.ThisQueenSolve;
            NowQueenSolve.ChessLocationList = Form1.QueenChessLocation;

            NowQueenSolve.QueenLocationList = new List <Point>();
            for (int i = 0; i < 8; i++)
            {
                NowQueenSolve.QueenLocationList.Add(new Point(i, NowQueenSolve.EightQueenResult[0, i] - 1));
            }

            SimulateAnneal.Annealing.SAMode UsedSAMode = SimulateAnneal.Annealing.SAMode.SA;
            double InitTemp = 0, alpha = 0, SALenght = 0, FSAh = 0;
            int    TestNum = 0;

            try
            {
                InitTemp = Convert.ToDouble(InitTempTB.Text);
                alpha    = Convert.ToDouble(AlphaTB.Text);
                SALenght = Convert.ToDouble(SALenghtTB.Text);
                FSAh     = Convert.ToDouble(FSAhTB.Text);
                TestNum  = Convert.ToInt32(TestNumSetTB.Text);

                if (SAModeSetTB.SelectedIndex == 0)//SA
                {
                    UsedSAMode = SimulateAnneal.Annealing.SAMode.SA;
                }
                else
                {
                    UsedSAMode = SimulateAnneal.Annealing.SAMode.FastSA;
                }
            }
            catch (Exception)
            {
                throw;
            }

            Chart1.Series[0].ChartType           = SeriesChartType.Line;
            Chart1.Series[0].MarkerSize          = 0;
            Chart1.Series[0].IsValueShownAsLabel = false;
            Chart1.Series[0].ToolTip             = "第#VALX次模拟退火中\r\n局部最短路径为:#VAL";
            //Chart1.ChartAreas[0].AxisY.Maximum = 1;
            //Chart1.ChartAreas[0].AxisY.Minimum = 30;
            Chart1.ChartAreas[0].AxisY.MajorGrid.Enabled      = false;
            Chart1.ChartAreas[0].AxisY.MinorGrid.Enabled      = false;
            Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled      = false;
            Chart1.ChartAreas[0].AxisX.MinorGrid.Enabled      = false;
            Chart1.ChartAreas[0].AxisX.MajorTickMark.Interval = 5;
            Chart1.ChartAreas[0].AxisX.MinorTickMark.Interval = 1;

            Chart1.Series[1].ChartType           = SeriesChartType.Line;
            Chart1.Series[1].MarkerSize          = 0;
            Chart1.Series[1].IsValueShownAsLabel = false;
            Chart1.Series[1].ToolTip             = "第#VALX次模拟退火中\r\n局部最短路径为:#VAL";

            string TestStr = NowQueenSolve.Test_SAParameter(
                InitTemp, alpha, SALenght, FSAh, UsedSAMode, TestNum);

            ShowPoint.Clear();

            List <double> DisList = NowQueenSolve.TestDisList.ToList();
            List <double> UsedTimeList = NowQueenSolve.TestUsedTime.ToList();

            for (int i = 0; i < NowQueenSolve.TestDisList.Count; i++)
            {
                ShowPoint.Add(new DataPoint(i, DisList[i]));
            }
            ShowPoint2.Clear();
            for (int i = 0; i < NowQueenSolve.TestUsedTime.Count; i++)
            {
                //ShowPoint2.Add(new DataPoint(i, UsedTimeList[i]));
            }

            InfoPrintTB.Text = TestStr;
        }
예제 #13
0
파일: USum.cs 프로젝트: andreyV512/rag
 public void Clear()
 {
     mp.Clear();
 }