/// <summary> /// Computes FFT for the given sampleset. /// </summary> /// <param name="Samples">Sampleset on which to compute a FFT</param> public FFT(List <double> Samples, List <BandFrequencyDefinition> CustomBands = null) { using (ILScope.Enter()) { ILInArray <double> inArr = Samples.ToArray(); ILRetArray <complex> output = ILMath.fft(inArr); rawFFTOutput = output.ToArray(); } ComputeFrequencyPowerSamples(); //FrequencyBands ComputeAbsoluteBandPower(BandFrequencyDefinition.Delta); ComputeAbsoluteBandPower(BandFrequencyDefinition.Theta); ComputeAbsoluteBandPower(BandFrequencyDefinition.Alpha); ComputeAbsoluteBandPower(BandFrequencyDefinition.Beta); ComputeAbsoluteBandPower(BandFrequencyDefinition.Gamma); if (CustomBands != null) { foreach (BandFrequencyDefinition customBand in CustomBands) { ComputeAbsoluteBandPower(customBand); } } }
public static EigenObject GetEigen(double[,] a) { int width = a.GetLength(0); double[] array = new double[width * width]; for (int i = 0; i < width; i++) { for (int j = 0; j < width; j++) { array[i * width + j] = a[i, j]; } } ILRetArray <double> A = ILMath.array( array, width, width); ILArray <complex> eigVectors = ILMath.array(new complex(0, 0), width * width); ILArray <complex> eigValues = ILMath.eig(A, eigVectors); return(new EigenObject(eigVectors, eigValues, width)); }
/// <summary> /// Creates an ILPoints-object at the specified coordinates and with a handler to set the /// specified label for the coordinates invisible. /// </summary> /// <param name="x">First coordinate of the point. Must be a one-dimensional array with one element and must not be null!</param> /// <param name="y">Second coordinate of the point. Must be a one-dimensional array with one element and must not be null!</param> /// <param name="z">Third coordinate of the point. Must be a one-dimensional array with one element and must not be null!</param> /// <param name="l">Label that will show the coordinates of the point. Must not be null.</param> /// <returns>An interactive point that displays its coordinates.</returns> private ILPoints createPoint(ILRetArray<float> x, ILRetArray<float> y, ILRetArray<float> z, Label l) { if (x == null) throw new ArgumentNullException("Parameter x must not be null!"); if (y == null) throw new ArgumentNullException("Parameter y must not be null!"); if (z == null) throw new ArgumentNullException("Parameter z must not be null!"); if (l == null) throw new ArgumentNullException("Parameter l must not be null!"); if (x.Size.NumberOfElements != 1) throw new Exception("Parameter x does not contain exactly one element!"); if (y.Size.NumberOfElements != 1) throw new Exception("Parameter y does not contain exactly one element!"); if (z.Size.NumberOfElements != 1) throw new Exception("Parameter z does not contain exactly one element!"); ILArray<float> coors = ILMath.zeros<float>(0); coors[0, 0] = x; coors[1, 0] = y; coors[2, 0] = z; ILPoints point = new ILPoints { Positions = coors, Color = Color.Black }; point.MouseLeave += (s, a) => { l.Visible = false; }; return point; }