Esempio n. 1
0
        public TransitionGradientArray GetStrongestTransitionsGradientFrequency()
        {
            TransitionGradientArray transitionGradientArray = new TransitionGradientArray();

            if (bufferFramesArray.Count > 0)
            {
                Gradient gradient, maxGradient;

                double maxGradientStrength = Double.NaN, gradientStrength;

                int maxIndex = -1;

                double[] transitionsStrengthArray;

                TransitionGradient strongestTransitionGradient;

                ////long inc = (long) (FREQUENCY_SEGMENT_SIZE / mainForm.binSize);

                long inc = (long)(10000 / mainForm.binSize);

                long segmentEnd;

                for (long i = 0; i < bufferFramesArray[0].bufferArray.Length; i += inc)
                {
                    maxGradient         = null;
                    maxGradientStrength = Double.NaN;
                    maxIndex            = -1;

                    segmentEnd = i + inc;

                    for (long j = i; j < segmentEnd && j < bufferFramesArray[0].bufferArray.Length; j++)
                    {
                        transitionsStrengthArray = GetAveragedStrengthOverTimeForIndex(j);
                        ////transitionsStrengthArray = GetStrengthOverTimeForIndex(j);

                        gradient = SignalDataUtilities.SeriesTransitionGradient(transitionsStrengthArray, Gradient.divisionsCount);

                        gradientStrength = gradient.CalculateTransitionGradient();

                        ////gradientStrength = gradient.strength;

                        ////gradientStrength = SignalDataUtilities.Series2ndVS1stHalfAvgStrength(transitionsStrengthArray) * transitions;

                        if (Double.IsNaN(maxGradientStrength) || gradientStrength > maxGradientStrength)
                        {
                            maxGradient = gradient;

                            maxGradientStrength = gradientStrength;

                            maxIndex = (int)j;
                        }
                    }

                    strongestTransitionGradient = new TransitionGradient(Utilities.GetFrequencyFromIndex((long)(maxIndex), parent.lowerFrequency, mainForm.binSize), maxIndex, maxGradientStrength, this.transitions, maxGradient);
                    transitionGradientArray.Add(strongestTransitionGradient);
                }
            }

            return(transitionGradientArray);
        }
Esempio n. 2
0
        public long AddArray(TransitionGradientArray transitionGradientArray)
        {
            for (int i = 0; i < transitionGradientArray.array.Count; i++)
            {
                array.Add(transitionGradientArray.array[i]);
            }

            return(array.Count);
        }
Esempio n. 3
0
        public TransitionGradientArray GetStrongestTransitionsFrequencyGradientArray(bool frequencyRanges)
        {
            ////frequencyRanges = false;

            TransitionGradientArray transitionGradientArray = new TransitionGradientArray();

            TransitionGradientArray transitionGradientArrayZoomed;

            int startIndex;

            if (bufferFramesObjects[0].upperFrequency - bufferFramesObjects[0].lowerFrequency <= 1000000)
            {
                startIndex = 0;
            }
            else
            {
                startIndex = 1;
            }

            for (int i = startIndex; i < bufferFramesObjects.Count; i++)
            {
                ////if (bufferFramesObjects[i].possibleReradiatedFrequencyRange)
                {
                    if (!frequencyRanges)
                    {
                        transitionGradientArrayZoomed = bufferFramesObjects[i].transitionBufferFrames.GetStrongestTransitionsGradientFrequency();

                        transitionGradientArray.AddArray(transitionGradientArrayZoomed);
                    }
                    else
                    {
                        transitionGradientArray.Add(bufferFramesObjects[i].transitionBufferFrames.GetTransitionsGradient());
                    }
                }
            }

            return(transitionGradientArray);
        }