Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <double>  signal1         = new List <double>();
            List <double>  signal2         = new List <double>();
            List <Complex> signal1_complex = new List <Complex>();
            List <Complex> signal2_complex = new List <Complex>();
            data           data_object     = new data();
            string         s1 = textBox1.Text;
            string         s2 = textBox2.Text;

            signal1 = data_object.read_data_file(s1);
            signal2 = data_object.read_data_file(s2);

            string s1_CX = textBox1.Text;
            string s2_CX = textBox2.Text;

            //signal1_complex = data_object.read_data_file_Complex(s1_CX);
            //signal2_complex = data_object.read_data_file_Complex(s2_CX);

            ///////////////////////////////////////////
            #region convelution_Directe " true "
            if (checkBox10.Checked == true)
            {
                List <double> direct_convelution_out = convelution_Directe(signal1, signal2);
            }
            #endregion

            #region convelution_fast " false "
            if (checkBox9.Checked == true)
            {
                List <double> convelution_fast_out = convelution_fast(signal1_complex, signal2_complex);
            }
            #endregion
            ////////////////////////////////////////////

            #region direct correlation true
            if (checkBox4.Checked == true)     // direct correlation
            {
                if (checkBox2.Checked == true) // cross
                {
                    List <double> sl = new List <double>();
                    sl.AddRange(signal1);
                    List <double> sl2 = new List <double>();
                    sl2.AddRange(signal2);

                    List <double> direct_correlation = correlation_Directe(signal1, signal2);
                    double        norm = Normalization(sl, sl2, direct_correlation.Count);
                    for (int i = 0; i < direct_correlation.Count; i++)
                    {
                        direct_correlation[i] = direct_correlation[i] / norm;
                    }
                }
                if (checkBox1.Checked == true) // auto
                {
                    List <double> sl = new List <double>();
                    sl.AddRange(signal1);
                    List <double> sl2 = new List <double>();
                    sl2.AddRange(signal1);

                    List <double> direct_correlation1 = correlation_Directe_auto(signal1, signal1);
                    double        norm = Normalization(sl, sl2, direct_correlation1.Count);
                    for (int i = 0; i < direct_correlation1.Count; i++)
                    {
                        direct_correlation1[i] = direct_correlation1[i] / norm;
                    }
                }
            }

            #endregion

            #region fast correlation
            if (checkBox3.Checked == true)  // fast correlation " auto "t" _____ cross "f" "
            {
                List <Complex> sl = new List <Complex>();
                sl.AddRange(signal1_complex);
                List <Complex> sl2 = new List <Complex>();
                sl2.AddRange(signal2_complex);
                List <double> list_correlation_fast = correlation_fast(signal1_complex, signal2_complex);
                double        norm = Normalization_Complex(sl, sl2, list_correlation_fast.Count);
                for (int i = 0; i < list_correlation_fast.Count; i++)
                {
                    list_correlation_fast[i] = list_correlation_fast[i] / norm;
                }
            }
            #endregion
        }
        private void button2_Click(object sender, EventArgs e)
        {
            data data_object = new data();

            if (flag == 0)
            {
                string s = textBox2.Text;
                l1   = data_object.read_data_file(s);
                flag = 1;
            }
            List <double> l2 = new List <double>();

            if (checkBox1.Checked == true)
            {
                zedGraphControl1.GraphPane.CurveList.Clear();
                zedGraphControl1.GraphPane.GraphObjList.Clear();
                string s2 = textBox4.Text;
                l2 = data_object.read_data_file(s2);
                List <double> mul_signal = new List <double>();
                mul_signal = multi_signal(l1, l2);
                l1         = mul_signal;
                CreateGraph2(zedGraphControl1, 0, mul_signal);
            }

            if (checkBox2.Checked == true) // const
            {
                zedGraphControl1.GraphPane.CurveList.Clear();
                zedGraphControl1.GraphPane.GraphObjList.Clear();
                List <double> mul_signal = new List <double>();
                double        constant   = double.Parse(textBox1.Text);
                mul_signal = const_signal(l1, constant);
                l1         = mul_signal;
                CreateGraph2(zedGraphControl1, 0, mul_signal);
            }

            if (checkBox3.Checked == true) // foold
            {
                zedGraphControl1.GraphPane.CurveList.Clear();
                zedGraphControl1.GraphPane.GraphObjList.Clear();
                CreateGraph_flood(zedGraphControl1, 0, l1);
                for (int i = 0; i < l1.Count; i++)
                {
                    // l1[i] = l1[i] * -1;
                    l1[0] = l1[0] * -1; /////////////////////////////////// check **************************
                }
            }

            if (checkBox4.Checked == true) //shift
            {
                zedGraphControl1.GraphPane.CurveList.Clear();
                zedGraphControl1.GraphPane.GraphObjList.Clear();
                int shifted_value = int.Parse(textBox3.Text);
                shifted_value = shifted_value * -1;
                CreateGraph2(zedGraphControl1, shifted_value, l1);
            }

            if (checkBox5.Checked == true) // shift_foold
            {
                zedGraphControl1.GraphPane.CurveList.Clear();
                zedGraphControl1.GraphPane.GraphObjList.Clear();
                int shifted_value = int.Parse(textBox3.Text);
                CreateGraph_flood(zedGraphControl1, shifted_value, l1);
            }
        }