public class DigitalSignalProcessor
extends java.lang.Object
Convenience class for packaging common digital processing operations.
This class relies heavily upon most of the other classes on the
gov.sns.tools.dsp
package.
Rather than making this a utility class, it has been designed to be instantiated. In this manner it can be tuned by the users. Although this capability is not available now, this class may evolve.
Constructor and Description |
---|
DigitalSignalProcessor(int szSignal)
Create a new
DigitalSignalProcessor object for processing
signals of length szSignal. |
Modifier and Type | Method and Description |
---|---|
double[] |
autoCorrelation(double[] arrSignal)
Compute and return the auto-correlation function for the given
discrete signal.
|
double[] |
average(double[] arrSignal)
Compute and return the (running) average of the given signal.
|
double[] |
crossCorrelation(double[] arrStat,
double[] arrShft)
Compute and return the cross-correlation function for the given
signals.
|
double[] |
differentiate(double[] arrSignal)
Compute and return the differential of the given signal.
|
int |
getSignalSize()
Return the signal size that this instance can process.
|
double[] |
integrate(double[] arrSignal)
Compute and return the integral of the given signal (zero constant of integration).
|
double[] |
powerSpectrum(double[] arrSignal)
Compute and return the power spectrum of the given signal.
|
double[] |
signalIndicator(double[] arrSignal)
Compute and return the signal presence indicator function for the given
signal.
|
double[] |
totalVariation(double[] arrSignal)
Compute and return the total variation of the given
signal.
|
public DigitalSignalProcessor(int szSignal)
DigitalSignalProcessor
object for processing
signals of length szSignal.szSignal
- size of signal to be processedpublic int getSignalSize()
public double[] differentiate(double[] arrSignal) throws java.lang.IllegalArgumentException
arrSignal
- signal to differentiatejava.lang.IllegalArgumentException
- this should not occur (serious internal error)public double[] integrate(double[] arrSignal) throws java.lang.IllegalArgumentException
arrSignal
- signal to integratejava.lang.IllegalArgumentException
- this should not occur (serious internal error)public double[] average(double[] arrSignal) throws java.lang.IllegalArgumentException
arrSignal
- signal to averagejava.lang.IllegalArgumentException
- this should not occur (serious internal error)public double[] totalVariation(double[] arrSignal)
arrSignal
- target signalpublic double[] signalIndicator(double[] arrSignal) throws java.lang.IllegalArgumentException
Compute and return the signal presence indicator function for the given signal. The indicator function is computed by subtracting the (running) average from the signal then computing the total variation. In this manner we hope to observe variation over the noise floor.
The returned function is normalized so that its maximum value is unity. It has the form of a cumulative distribution function so that increasing value is indicative of signal likelihood.
arrSignal
- target signaljava.lang.IllegalArgumentException
- this should not occur (serious internal error)DigitalFunctionUtility.totalVariation(double[])
public double[] autoCorrelation(double[] arrSignal) throws java.lang.IllegalArgumentException
Compute and return the auto-correlation function for the given discrete signal.
In the spirit of the Z transform we assume that the function is periodic so that f[n + N] = f[n]. In this manner the auto-correlation Rxx[k] function is also periodic, specifically, Rxx[-k] = Rxx[N - k].
Assuming periodicity gives us the follow fact: it's value will never fall to zero if the data contains a noise process with non-zero mean. Indeed, by the property of the auto-correlation Rxx[-k] = Rxx[k] and, therefore, Rxx[k] = Rxx[N - k] by periodicity. If the underlying signal has support small enough the minimum value of the auto-correlation (at k = N/2) will depend only upon the noise process. If we assumed the original data non-periodic, this condition would not occur.
arrSignal
- function to auto-correlatejava.lang.IllegalArgumentException
- this should not occur (serious internal error)public double[] crossCorrelation(double[] arrStat, double[] arrShft) throws java.lang.IllegalArgumentException
Compute and return the cross-correlation function for the given signals. Note that the second argument is the signal that is shifted in the calculation.
In the spirit of the Z transform we assume that each function is periodic so that f[n + N] = f[n]. In this manner the cross-correlation Rxy[k] function is also periodic. More importantly, it's value will never fall to zero if the data contains a noise process with non-zero mean. If the underlying signal has support small enough the minimum value of the cross-correlation will depend only upon the noise process. If we assumed the original function non-periodic, this condition would not occur.
arrStat
- stationary functionarrShft
- shifted functionjava.lang.IllegalArgumentException
- the arguments are of different sizespublic double[] powerSpectrum(double[] arrSignal) throws java.lang.IllegalArgumentException
arrSignal
- signal to analyzejava.lang.IllegalArgumentException
- this should not occur (serious internal error)FourierExpTransform.powerSpectrum(double[])