org.jscience.mathematics.wavelet
Class Signal

java.lang.Object
  extended by org.jscience.mathematics.wavelet.MultiscaleFunction
      extended by org.jscience.mathematics.wavelet.splines.Spline
          extended by org.jscience.mathematics.wavelet.splines.LinearSpline
              extended by org.jscience.mathematics.wavelet.Signal
All Implemented Interfaces:
java.lang.Cloneable, Filter

public class Signal
extends LinearSpline
implements java.lang.Cloneable

This class use the linear spline as a general model for a signal. While this is a reasonnable design choice, this can certainly be overwritten if necessary. Basic operations on signal are supported.


Field Summary
 
Fields inherited from class org.jscience.mathematics.wavelet.splines.LinearSpline
filtretype
 
Constructor Summary
Signal()
          *************************** *****************************
Signal(double[] v)
          ******************************** **********************************
Signal(Filter f)
          ***************************** *******************************
Signal(Filter f, double[] v)
          ****************************** ********************************
Signal(Filter f, double[] v, double[] p)
          *************************** *****************************
 
Method Summary
 double[] absFFT()
          Return the absolute value of the FFT
static double[] absFFT(double[] data)
          DOCUMENT ME!
 java.lang.Object clone()
          Return a copy of this object
 void denoiseByFFT(int k)
          Simplistic FFT denoising.
 Signal denoiseShortPeaks(double p, int n)
          This denoising method will identify "short peaks" in the signal and take them away.
 double entropy()
          Return the entropy of the signal
 boolean equals(Signal b)
          Check if another object is equal to this Signal object
 Complex[] fft()
          DOCUMENT ME!
static Complex[] fft(Complex[] data)
          Performs the Fourier transform.
static Complex[] fft(double[] data)
          Performs the Fourier transform.
static Complex[] fftInverse(Complex[] data)
          Also noted iFFT in other packages.
 Signal filter(double[] f)
          Apply the given array as a convolution Filter and return a new Signal.
 FWTCoef fwt(int J)
          Fast Wavelet Transform
 FWTPacketCoef fwtPacket(int J, PrimitiveMappingND cout)
          The Fast Wavelet Transform with Wavelet packets
 double[] getValues()
          Get the sampled values of the sample as an array.
 double[] highpassProject()
          Project the signal according the the highpass Filter
 double[] lowpassProject()
          Project the data according to the lowpass Filter
 Signal medianFilter(int n)
          Apply the median Filter of a window of size 2n+1. exception IllegalArgumentException if the parameter n is negative
 double norm()
          Compute the L2 norm of the signal
 void removeParameter()
          Throws away the parameter of the Filter
 void resample(int newl)
          Resample the signal using linear interpolation
 void setData(double[] v)
          Set the data for the signal
 void setDimensionFromBeginning(int dimension)
          Will make the signal a given dimension
 void setDimensionFromEnd(int dimension)
          Will make the signal a given dimension
 void setFilter(Filter f)
          set the signal associated Filter
 void setLengthFromBeginning(int longueur)
          Set the Signal to the specified length scraping or padding the end if necessary
 void setLengthFromEnd(int longueur)
          Set the Signal to the specified length scraping or padding the beginning if necessary
 void setParameter(double[] p)
          Set the parameter of the Filter (if it applies).
 void setParameter(java.lang.Double[] p)
          Set the parameter of the Filter (if it applies).
 
Methods inherited from class org.jscience.mathematics.wavelet.splines.LinearSpline
derive, derive, dimension, dimension, equals, evaluate, getFilterType, getValue, highpass, highpass, interpolate, lowpass, lowpass, previousDimension, setValue, setValues, toString
 
Methods inherited from class org.jscience.mathematics.wavelet.MultiscaleFunction
mass, mass
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Signal

public Signal()
*************************** *****************************


Signal

public Signal(double[] v)
******************************** **********************************


Signal

public Signal(Filter f,
              double[] v,
              double[] p)
*************************** *****************************


Signal

public Signal(Filter f)
***************************** *******************************


Signal

public Signal(Filter f,
              double[] v)
****************************** ********************************

Method Detail

clone

public java.lang.Object clone()
Return a copy of this object

Overrides:
clone in class LinearSpline
Returns:
DOCUMENT ME!

getValues

public double[] getValues()
Get the sampled values of the sample as an array.

Returns:
DOCUMENT ME!

setFilter

public void setFilter(Filter f)
set the signal associated Filter

Parameters:
f - DOCUMENT ME!

setParameter

public void setParameter(double[] p)
Set the parameter of the Filter (if it applies).

Parameters:
p - DOCUMENT ME!

setParameter

public void setParameter(java.lang.Double[] p)
Set the parameter of the Filter (if it applies).

Parameters:
p - DOCUMENT ME!

removeParameter

public void removeParameter()
Throws away the parameter of the Filter


setLengthFromEnd

public void setLengthFromEnd(int longueur)
Set the Signal to the specified length scraping or padding the beginning if necessary

Parameters:
longueur - DOCUMENT ME!

resample

public void resample(int newl)
Resample the signal using linear interpolation

Parameters:
newl - DOCUMENT ME!

setLengthFromBeginning

public void setLengthFromBeginning(int longueur)
Set the Signal to the specified length scraping or padding the end if necessary

Parameters:
longueur - DOCUMENT ME!

setData

public void setData(double[] v)
Set the data for the signal

Parameters:
v - DOCUMENT ME!

fwt

public FWTCoef fwt(int J)
Fast Wavelet Transform

Parameters:
J - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

fwtPacket

public FWTPacketCoef fwtPacket(int J,
                               PrimitiveMappingND cout)
The Fast Wavelet Transform with Wavelet packets

Parameters:
J - number of iterations
cout - cost function
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

lowpassProject

public double[] lowpassProject()
Project the data according to the lowpass Filter

Returns:
DOCUMENT ME!

highpassProject

public double[] highpassProject()
Project the signal according the the highpass Filter

Returns:
DOCUMENT ME!

norm

public double norm()
Compute the L2 norm of the signal

Returns:
DOCUMENT ME!

fft

public Complex[] fft()
DOCUMENT ME!

Returns:
DOCUMENT ME!

fft

public static Complex[] fft(double[] data)
Performs the Fourier transform. Convenience method for FourierMath.transform.

Parameters:
data - DOCUMENT ME!
Returns:
DOCUMENT ME!

fft

public static Complex[] fft(Complex[] data)
Performs the Fourier transform. Convenience method for FourierMath.transform.

Parameters:
data - DOCUMENT ME!
Returns:
DOCUMENT ME!

absFFT

public double[] absFFT()
Return the absolute value of the FFT

Returns:
DOCUMENT ME!

absFFT

public static double[] absFFT(double[] data)
DOCUMENT ME!

Parameters:
data - DOCUMENT ME!
Returns:
DOCUMENT ME!

fftInverse

public static Complex[] fftInverse(Complex[] data)
Also noted iFFT in other packages. This is the inverse to the FFT.

Parameters:
data - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(Signal b)
Check if another object is equal to this Signal object

Parameters:
b - DOCUMENT ME!
Returns:
DOCUMENT ME!

setDimensionFromEnd

public void setDimensionFromEnd(int dimension)
Will make the signal a given dimension

Parameters:
dimension - DOCUMENT ME!

setDimensionFromBeginning

public void setDimensionFromBeginning(int dimension)
Will make the signal a given dimension

Parameters:
dimension - DOCUMENT ME!

denoiseByFFT

public void denoiseByFFT(int k)
Simplistic FFT denoising.

Parameters:
k - frequency to denoised
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

entropy

public double entropy()
Return the entropy of the signal

Returns:
DOCUMENT ME!

filter

public Signal filter(double[] f)
Apply the given array as a convolution Filter and return a new Signal. As one often want to compare the result to the original signal, this method is "safe", that is, it won't change the current object.

Parameters:
f - an array containing the coefficients of the convolution Filter
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

medianFilter

public Signal medianFilter(int n)
Apply the median Filter of a window of size 2n+1. exception IllegalArgumentException if the parameter n is negative

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

denoiseShortPeaks

public Signal denoiseShortPeaks(double p,
                                int n)
This denoising method will identify "short peaks" in the signal and take them away. Short peaks are defined from a comparison with the median filtered signal. Only "significative" peaks are detected (see parameter p). This method won't denoise near the boundaries. "Short" refers here to the time-domain and not the amplitude. param p percentage of the range (max-min) considered as a significative step param n length of the peak in the time domain exception IllegalArgumentException if p is not between 0 and 1 exception IllegalArgumentException if the parameter n is negative

Parameters:
p - DOCUMENT ME!
n - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!