asu.seismo.signals.oned
Class doubleSignal1dfft

java.lang.Object
  extended by asu.seismo.signals.oned.doubleSignal1d
      extended by asu.seismo.signals.oned.doubleSignal1dpadp2
          extended by asu.seismo.signals.oned.doubleSignal1dfft

public class doubleSignal1dfft
extends doubleSignal1dpadp2

Class to represent a signal and its Fourier transform


Field Summary
protected  boolean fft_valid
          Indicate that the fft data is valid
protected  double[] fftdata
          fft data for the signal.
protected  FFT1d myFFT
          The FFT - Routine.
protected  boolean phys_valid
          Indicates that the physical data is valid
 
Fields inherited from class asu.seismo.signals.oned.doubleSignal1dpadp2
pLength, tail
 
Fields inherited from class asu.seismo.signals.oned.doubleSignal1d
data, length
 
Constructor Summary
doubleSignal1dfft()
          Construct empty signal
doubleSignal1dfft(double[] d)
          Construct signal from array
doubleSignal1dfft(doubleSignal1d sig)
          Construct signal from non padded signal
doubleSignal1dfft(doubleSignal1dfft sig)
          Copy given signal with fft
doubleSignal1dfft(doubleSignal1dpadp2 sig)
          Construct signal from padded signal
doubleSignal1dfft(int l)
          Construct signal of length l
 
Method Summary
 void assign(arraySelector1d st, doubleSignal1d sig)
          Assign the given signal to a part of this signal.
 void assign(arraySelector1d st, doubleSignal1d sig, arraySelector1d s)
          Assign part of a signal to a part of this signal.
 void assign(arraySelector1d st, doubleSignal1dfft sig)
          Assign the given signal to a part of this signal.
 void assign(arraySelector1d st, doubleSignal1dfft sig, arraySelector1d s)
          Assign the given signal to a part of this signal.
 void changeFFT()
          Call this to indicate that the FFT data has been changed.
 void changePhys()
          Call this to indicate that the physical data has has been changed.
 void clear()
          clear signal ie fill signal with zeros
static doubleSignal1dfft conv(doubleSignal1dfft s1, doubleSignal1dfft s2)
          Perform convolution of s1 and s2 in 'full' mode.
static doubleSignal1dfft conv(doubleSignal1dfft s1, doubleSignal1dfft s2, char mode)
           
static doubleSignal1dfft conv(doubleSignal1dfft s1, doubleSignal1dfft s2, char mode, FFT1d fft)
          Perform convolution in a given mode.
 void convHere(doubleSignal1dfft s1, doubleSignal1dfft s2)
          Replace the signal by the convolution of s1 and s2.
 void diffHere(doubleSignal1dfft s1, doubleSignal1dfft s2)
          Compute the difference between this signal and the given one. this=s2-s1
 double[] getDataArray()
          Returns the physical data array
 double[] getFFTArray()
          Get FFT data array
 FFT1d getmyFFT()
           
static FFT1d getStdFFT(int n)
           
 void invalidateFFT()
          Invalidate FFT data.
 void invalidatePhys()
          Invalidate physical data.
 boolean isFFTValid()
          Determine if the FFT data is valid
 boolean isPhysValid()
          Determine if the physical data is valid
 void mult(double c)
          New implementation of the multiplication operator.
 double norm2()
          New implementation of the 2-norm.
 void performFFT()
          Perform the fft of the data set.
 void performIFFT()
          Perform the ifft of the data set.
 void setFFT(FFT1d fft)
          Set an fft routine.
 void setStdFFT()
          Use std FFT
 void setVerbose(int v)
           
 void validateFFT()
          Validate FFT data
 void validatePhys()
          Validate physical data.
static arraySelector1d validmap(int l1, int l2)
          return a map of all valid elements of a convolution of two signals with l1 and l2 elements
 void zeros()
          Assign zeros to the given signal
 void zeros(arraySelector1d s)
          Assign zeros to a part of this signal.
 
Methods inherited from class asu.seismo.signals.oned.doubleSignal1dpadp2
allocateMemory, getpLength, getTail, pad
 
Methods inherited from class asu.seismo.signals.oned.doubleSignal1d
add, add, add, assign, assign, assign, assign, cutNeg, diff, diffHere, dp, getAbsMax, getAsString, getLength, getMaxValue, getMinValue, loadASCII, mult, normalize2, normalizeMax, normalizeS, normTK2, normTK2, normTV, normTV, ones, printAsColumn, printAsLine, rand, removeDC, reverse, reverseThis, saveASCII, setLength, subSignal, sum, sum, vec, zeros
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fftdata

protected double[] fftdata
fft data for the signal. Note that the signal is real therefore the fft will consist of complex values where half of them is the complex conjugate of the other, so only half of the complex values will be stored. A warp around structure is assumed. That means the first length/2 values will be the real part of the signal. The first value of the fft is real, so is the middle value. The imaginary part of the second complex value is stored in fftdata[pLength-1], the third is fftdata[pLength-2] and so on. This structure is used by the jnt package.


fft_valid

protected boolean fft_valid
Indicate that the fft data is valid


phys_valid

protected boolean phys_valid
Indicates that the physical data is valid


myFFT

protected FFT1d myFFT
The FFT - Routine. RealDoubleFFT is a class from jnt.

Constructor Detail

doubleSignal1dfft

public doubleSignal1dfft()
Construct empty signal


doubleSignal1dfft

public doubleSignal1dfft(int l)
Construct signal of length l


doubleSignal1dfft

public doubleSignal1dfft(double[] d)
                  throws invalid_data_exception
Construct signal from array

Throws:
invalid_data_exception

doubleSignal1dfft

public doubleSignal1dfft(doubleSignal1d sig)
                  throws invalid_data_exception
Construct signal from non padded signal

Throws:
invalid_data_exception

doubleSignal1dfft

public doubleSignal1dfft(doubleSignal1dpadp2 sig)
                  throws invalid_data_exception
Construct signal from padded signal

Throws:
invalid_data_exception

doubleSignal1dfft

public doubleSignal1dfft(doubleSignal1dfft sig)
                  throws invalid_data_exception
Copy given signal with fft

Throws:
invalid_data_exception
Method Detail

setVerbose

public void setVerbose(int v)

getDataArray

public double[] getDataArray()
                      throws invalid_data_exception
Returns the physical data array

Overrides:
getDataArray in class doubleSignal1d
Throws:
invalid_data_exception

getFFTArray

public double[] getFFTArray()
                     throws invalid_data_exception
Get FFT data array

Throws:
invalid_data_exception

performIFFT

public void performIFFT()
Perform the ifft of the data set. If there is no FFT routine assigned yet, the standard FFT will be used.


performFFT

public void performFFT()
Perform the fft of the data set. If there is no FFT routine assigned yet, the standard FFT will be used.


setFFT

public void setFFT(FFT1d fft)
Set an fft routine. The FFt must implement the interface defined by FFT1d


getmyFFT

public FFT1d getmyFFT()

getStdFFT

public static FFT1d getStdFFT(int n)

clear

public void clear()
Description copied from class: doubleSignal1d
clear signal ie fill signal with zeros

Overrides:
clear in class doubleSignal1d

setStdFFT

public void setStdFFT()
Use std FFT


validatePhys

public void validatePhys()
Validate physical data.

Overrides:
validatePhys in class doubleSignal1d

validateFFT

public void validateFFT()
Validate FFT data


invalidatePhys

public void invalidatePhys()
Invalidate physical data.


invalidateFFT

public void invalidateFFT()
Invalidate FFT data.


changeFFT

public void changeFFT()
Call this to indicate that the FFT data has been changed. This will invalidate the physical data.


changePhys

public void changePhys()
Call this to indicate that the physical data has has been changed. This will invalidate the FFT data.

Overrides:
changePhys in class doubleSignal1d

isPhysValid

public boolean isPhysValid()
Determine if the physical data is valid


isFFTValid

public boolean isFFTValid()
Determine if the FFT data is valid


mult

public void mult(double c)
          throws invalid_data_exception
New implementation of the multiplication operator. If both the physical and fft data is available then the multiplication will be performed on both data.

Overrides:
mult in class doubleSignal1d
Throws:
invalid_data_exception

norm2

public double norm2()
             throws invalid_data_exception
New implementation of the 2-norm. If only the fft data is available Parcevals Theorem will be used to compute it.

Overrides:
norm2 in class doubleSignal1d
Throws:
invalid_data_exception

validmap

public static arraySelector1d validmap(int l1,
                                       int l2)
return a map of all valid elements of a convolution of two signals with l1 and l2 elements


conv

public static doubleSignal1dfft conv(doubleSignal1dfft s1,
                                     doubleSignal1dfft s2)
                              throws invalid_data_exception,
                                     size_mismatch_exception
Perform convolution of s1 and s2 in 'full' mode. Return a signal with the convolution of the two given signals. The convolution is done in fourier space.

Throws:
invalid_data_exception
size_mismatch_exception

conv

public static doubleSignal1dfft conv(doubleSignal1dfft s1,
                                     doubleSignal1dfft s2,
                                     char mode)
                              throws invalid_data_exception,
                                     size_mismatch_exception
Throws:
invalid_data_exception
size_mismatch_exception

conv

public static doubleSignal1dfft conv(doubleSignal1dfft s1,
                                     doubleSignal1dfft s2,
                                     char mode,
                                     FFT1d fft)
                              throws invalid_data_exception,
                                     size_mismatch_exception
Perform convolution in a given mode. Valid modes are 'f' for full this will result in a signal of size s1.length+s2.length-1. 'v' for valid mode this will result in a signal of size s1.length-s2.length+1.

Throws:
invalid_data_exception
size_mismatch_exception

convHere

public void convHere(doubleSignal1dfft s1,
                     doubleSignal1dfft s2)
              throws invalid_data_exception,
                     size_mismatch_exception
Replace the signal by the convolution of s1 and s2.

Throws:
invalid_data_exception
size_mismatch_exception

diffHere

public void diffHere(doubleSignal1dfft s1,
                     doubleSignal1dfft s2)
              throws invalid_data_exception,
                     size_mismatch_exception
Compute the difference between this signal and the given one. this=s2-s1

Throws:
invalid_data_exception
size_mismatch_exception

assign

public void assign(arraySelector1d st,
                   doubleSignal1dfft sig)
            throws invalid_data_exception
Assign the given signal to a part of this signal.

Throws:
invalid_data_exception

assign

public void assign(arraySelector1d st,
                   doubleSignal1d sig)
            throws invalid_data_exception
Assign the given signal to a part of this signal.

Overrides:
assign in class doubleSignal1d
Throws:
invalid_data_exception

assign

public void assign(arraySelector1d st,
                   doubleSignal1d sig,
                   arraySelector1d s)
            throws invalid_data_exception,
                   size_mismatch_exception
Assign part of a signal to a part of this signal.

Overrides:
assign in class doubleSignal1d
Throws:
invalid_data_exception
size_mismatch_exception

assign

public void assign(arraySelector1d st,
                   doubleSignal1dfft sig,
                   arraySelector1d s)
            throws invalid_data_exception,
                   size_mismatch_exception
Assign the given signal to a part of this signal.

Throws:
invalid_data_exception
size_mismatch_exception

zeros

public void zeros()
           throws invalid_data_exception
Assign zeros to the given signal

Overrides:
zeros in class doubleSignal1d
Throws:
invalid_data_exception

zeros

public void zeros(arraySelector1d s)
           throws invalid_data_exception,
                  size_mismatch_exception
Assign zeros to a part of this signal.

Overrides:
zeros in class doubleSignal1d
Throws:
invalid_data_exception
size_mismatch_exception