Exemplo n.º 1
0
        public void Calculate_Time_Special_Point()
        {
            long[][] periods = Period_job.get_period();

            long periods_full_length = Period_job.Find_Length_Period_In_Data();

            int ew = periods.Length;           //счетчик найденных максимумов

            long[,] osob_x = new long[14, ew]; // список особых точек для вывода на график
            long[,] osob_y = new long[14, ew];

            long[,] schet = new long[15, ew]; // список особых точек для расчета (должны отличаться!!!!!)
            long[] schet_sum = new long[15];  // список особых точек

            long[,] row1 = initial_data.get_row1();
            long[] row3 = initial_data.get_row3();
            int    reg  = initial_data.REG;


            max_Amplitude_position = Spirogramm_Additional_Function.Calculate_Max_Amplitude_Position(periods);
            end_Amplitude_position = Spirogramm_Additional_Function.Calculate_End_Amplitude_Position(periods, max_Amplitude_position);

            max_Derivative_Amplitude = Spirogramm_Additional_Function.Calculate_Max_Derivative_Position(periods);

            full_Square          = Spirogramm_Additional_Function.Calculate_Square(periods, end_Amplitude_position);
            B1_4_Square_position = Spirogramm_Additional_Function.Calculate_Chosen_Part_Time_Amplitude(periods, 250);
            B2_4_Square_position = Spirogramm_Additional_Function.Calculate_Chosen_Part_Time_Amplitude(periods, 500);
            B3_4_Square_position = Spirogramm_Additional_Function.Calculate_Chosen_Part_Time_Amplitude(periods, 750);
            B4_4_Square_position = Spirogramm_Additional_Function.Calculate_Chosen_Part_Time_Amplitude(periods, 1000);

            B1_4_Square = Spirogramm_Additional_Function.Calculate_Square(periods, B1_4_Square_position);
            B2_4_Square = Spirogramm_Additional_Function.Calculate_Square(periods, B2_4_Square_position);
            B3_4_Square = Spirogramm_Additional_Function.Calculate_Square(periods, B3_4_Square_position);
            B4_4_Square = Spirogramm_Additional_Function.Calculate_Square(periods, B4_4_Square_position);


            for (int i = 0; i < ew; i++)
            {
                if (periods[i].Length < 700)
                {
                    schet[1, i]  = 0; //Положение максимума производной
                    schet[2, i]  = 0; // минимум В1
                    schet[3, i]  = 0; // положение минимума В1 - начала отсчета
                    schet[4, i]  = 0; // максимум В2 - max
                    schet[5, i]  = 0; // положение максимума В2
                    schet[6, i]  = 0; // В1_4 - первая четверть
                    schet[7, i]  = 0; // положение первой четверти В1_4
                    schet[8, i]  = 0; // В2_4 - вторая четверть
                    schet[9, i]  = 0; // положение второй четверти В2_4
                    schet[10, i] = 0; //В3_4 - третья четверть
                    schet[11, i] = 0; // положение третьей четверти В3_4
                    schet[12, i] = 0; //В4_4 - четвертая четверть - или конец отсчета
                    schet[13, i] = 0; //положение четвертой четверти В4_4
                    schet[14, i] = 0; // основание - положение В1
                }
                else
                {
                    schet[0, i] = row3[Period_job.Return_Length_X_Zero(i, max_Derivative_Amplitude[i])];
                    schet[1, i] = row1[Period_job.Return_Length_X_Zero(i, max_Derivative_Amplitude[i]), 0]; // положение максимума В2 - начала отсчета - EKG_max_x[w]

                    schet[2, i]  = periods[i][0 + shift_B1];                                                // минимум В1
                    schet[3, i]  = row1[Period_job.Return_Length_X_Zero(i, 0 + shift_B1), 0];               // положение минимума В1 - начала отсчета
                    schet[14, i] = periods[i][0 + shift_B1];

                    schet[4, i] = periods[i][max_Amplitude_position[i]] - periods[i][0 + shift_B1];        // максимум В2
                    schet[5, i] = row1[Period_job.Return_Length_X_Zero(i, max_Amplitude_position[i]), 0];  // положение максимума В2

                    schet[6, i] = periods[i][B1_4_Square_position[i]] - periods[i][0 + shift_B1];          // первоя четверть В1-4
                    schet[7, i] = row1[Period_job.Return_Length_X_Zero(i, B1_4_Square_position[i]), 0];    // положение первой четверти В1-4

                    schet[8, i] = periods[i][B2_4_Square_position[i]] - periods[i][0 + shift_B1];          // максимум В2-4
                    schet[9, i] = row1[Period_job.Return_Length_X_Zero(i, B2_4_Square_position[i]), 0];    // положение второй четверти В2-4

                    schet[10, i] = periods[i][B3_4_Square_position[i]] - periods[i][0 + shift_B1];         // максимум В3-4
                    schet[11, i] = row1[Period_job.Return_Length_X_Zero(i, B3_4_Square_position[i]), 0];   // положение третьей четверти В3-4

                    schet[12, i] = periods[i][end_Amplitude_position[i]] - periods[i][0 + shift_B1];       // максимум В4-4
                    schet[13, i] = row1[Period_job.Return_Length_X_Zero(i, end_Amplitude_position[i]), 0]; // положение четвертой четверти В4-4
                }
            }

            spec_point = schet;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Перевести данные в массив пульсовых циклов
        /// </summary>
        public virtual void Calculate_Data_In_Period()
        {
            int b = init_data.get_b();

            long[,] row1 = init_data.get_row1();
            long[] row3 = init_data.get_row3();

            int reg = init_data.REG;


            int Shift_03 = 100;
            int b0       = 0;                  //второй счетчик строк
            int ew       = 0;                  //счетчик найденных максимумов
            int est      = 0;
            int maxim    = 0;                  // счетчик массива

            long[] max1_y    = new long[2000]; // счетчик максимума
            long[] max1_x    = new long[2000];
            long[] max1_coor = new long[2000];

            for (int u = 0; u < 2000; u++)
            {
                max1_x[u] = 1;
                max1_y[u] = 1;
            }

            // while (ew<2)
            while (b0 < b)/////////////поиск опорных точек
            {
                for (int t = 0; t < 200; t++)
                {
                    b0++;

                    if ((row3[t + 1 + est]) > max1_y[maxim])
                    {
                        max1_y[maxim]    = (row3[t + 1 + est]);
                        max1_x[maxim]    = row1[t + 1 + est, 0];
                        max1_coor[maxim] = t + 1 + est;
                    }
                }

                if (max1_y[maxim] > System.Convert.ToInt64(combobox_3) * 10) ////////////////////!!!!!!
                {
                    ew++;                                                    // счетчик пиков производной
                    maxim++;
                }
                est = est + 200;
            }



            long[] osob_x    = new long[ew + 1];// список особых точек для вывода на график
            long[] osob_y    = new long[ew + 1];
            long[] osob_coor = new long[ew + 1];



            long[] period_all = new long[ew];
            period = new long[ew][];

            if (ew == 0)
            {
                System.Windows.Forms.MessageBox.Show("Выбран не тот канал");
                period    = new long[1][];
                period[0] = new long[0];
            }
            else
            {
                for (int u = 1; u < ew; u++)
                {
                    period_all[u - 1] = max1_coor[u] - max1_coor[u - 1];
                }

                osob_x[0]    = 0;
                osob_y[0]    = 512;// Данные с соответствующего канала (№4)
                osob_coor[0] = 0;
                period[0]    = new long[0];


                for (int w = 1; w < ew; w++)//перебираем пики
                {
                    //////////////////////////////ищем начало подъема--2

                    osob_x[w]    = row1[max1_coor[w], 0];
                    osob_y[w]    = row1[max1_coor[w], reg];// Данные с соответствующего канала (№4)
                    osob_coor[w] = max1_coor[w];


                    for (long i = max1_coor[w]; i > max1_coor[w] - Shift_03; i--)//2
                    {
                        if (row1[i, reg] < osob_y[w])
                        {
                            osob_x[w]    = row1[i, 0];
                            osob_y[w]    = row1[i, reg];// Данные с соответствующего канала (№4)
                            osob_coor[w] = i;
                        }
                    }
                }


                for (int i = 0; i < ew; i++)
                {
                    try
                    {
                        period[i] = new long[osob_coor[i + 1] - osob_coor[i]];
                        for (int j = 0; j < (osob_coor[i + 1] - osob_coor[i]); j++)
                        {
                            period[i][j] = row1[j + osob_coor[i], reg];
                        }
                    }
                    catch (Exception e)
                    {
                        period[i] = new long[0];
                    }
                }
            }
        }