//---------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------
        //Развертка по строкам
        public static RealMatrix UnwrapByRows(
            RealMatrix phaseMatrix, int extremumIndx, UnwrapDirection unwrapDirection
            )
        {
            PhaseUnwrappingAlgorithm phaseUnwrappingAlgorithm = new PhaseUnwrappingAlgorithm(phaseMatrix);
            RealMatrix resultMatrix = phaseUnwrappingAlgorithm.UnwrapByRows(extremumIndx, unwrapDirection);

            return(resultMatrix);
        }
        //---------------------------------------------------------------------------------
        //Развертка фазы по строкам
        public RealMatrix UnwrapByRows(int extremumIndex, UnwrapDirection unwrapDirection)
        {
            double     thresholdDifferenceValue = Math.PI;
            double     increasingStep           = 2 * Math.PI;
            RealMatrix resultMatrix             = this.unwrappingAlgorithm.UnwrapMatrixByRows
                                                      (this.phaseMatrix, extremumIndex, unwrapDirection, thresholdDifferenceValue, increasingStep);

            return(resultMatrix);
        }
Esempio n. 3
0
        //--------------------------------------------------------------------------------------------------------------
        //Развертка по строкам
        public RealMatrix UnwrapMatrixByRows(
            RealMatrix matrix, int extremumIndex, UnwrapDirection unwrapDirection,
            double thresholdDifferenceValue, double increasingStep
            )
        {
            int        rowCount    = matrix.RowCount;
            int        columnCount = matrix.ColumnCount;
            RealMatrix newMatrix   = new RealMatrix(rowCount, columnCount);

            for (int row = 0; row < rowCount; row++)
            {
                double[] rowData          = matrix.GetRow(row);
                double[] correctedRowData = this.DeleteFirstDisplacement(rowData);
                double[] newRowData       =
                    this.UnwrapArray(correctedRowData, thresholdDifferenceValue, extremumIndex, unwrapDirection, increasingStep);
                newMatrix.SetRowData(row, newRowData);
            }
            return(newMatrix);
        }
Esempio n. 4
0
        //---------------------------------------------------------------------------------------------------------------
        //Развертка массива
        public double[] UnwrapArray(
            double[] array,
            double thresholdDifferenceValue,    //Пороговое значение разрыва
            int extremumIndex,                  //Индекс экстремума
            UnwrapDirection unwrapDirection,    //Направление развертки
            double increasingStep               //Шаг наращивания
            )
        {
            int size = array.Length;

            double[] newArray = new double[size];

            int    trendSign         = unwrapDirection == UnwrapDirection.Down ? -1 : 1;
            int    previousTrendSign = trendSign;
            bool   trendChanging     = false;
            double cumulative        = 0;

            double newValue;

            for (int index = extremumIndex + 1; index < size; index++)
            {
                double currentValue = array[index];
                double prevValue    = array[index - 1];
                if (thresholdDifferenceValue <= Math.Abs(currentValue - prevValue))
                {
                    if (trendSignAnalyseSamplesCount < index)
                    {
                        double trend = array[index - 1 - trendSignAnalyseSamplesCount] - prevValue;
                        trendSign         = trend < 0 ? +1 : -1;
                        cumulative        = cumulative + trendSign * increasingStep;
                        previousTrendSign = trendSign;
                    }
                    else
                    {
                        double trend = array[index] - array[0];
                        trendSign         = trend < 0 ? +1 : -1;
                        cumulative        = cumulative + trendSign * increasingStep;
                        previousTrendSign = trendSign;
                    }
                }

                newValue        = cumulative + currentValue;
                newArray[index] = newValue;
            }

            for (int index = extremumIndex - 1; 0 < index; index--)
            {
                double currentValue = array[index];
                double prevValue    = array[index + 1];
                if (thresholdDifferenceValue <= Math.Abs(currentValue - prevValue))
                {
                    if (trendSignAnalyseSamplesCount < index)
                    {
                        double trend = array[index - 1 - trendSignAnalyseSamplesCount] - prevValue;
                        trendSign         = trend < 0 ? +1 : -1;
                        cumulative        = cumulative + trendSign * increasingStep;
                        previousTrendSign = trendSign;
                    }
                }
                newValue        = cumulative + cumulative;
                newArray[index] = newValue;
            }


            return(newArray);
        }