|
ESP OpenBCI - An EEG Signal Processing Library for OpenBCI Hardware | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.mrstampy.esp.dsp.EspSignalUtilities
public abstract class EspSignalUtilities
A collection of utility methods which may or may not be useful when analysing a raw signal.
| Constructor Summary | |
|---|---|
protected |
EspSignalUtilities(ddf.minim.analysis.WindowFunction window)
Instantiates a new esp signal utilities. |
| Method Summary | |
|---|---|
double[] |
absolute(double[] array)
Returns the absolute (positive) values of the given array. |
de.dfki.lt.signalproc.filter.BandPassFilter |
createBandPassFilter(double lowerCutoffHz,
double upperCutoffHz)
Creates the band pass filter. |
de.dfki.lt.signalproc.filter.HighPassFilter |
createHighPassFilter(double cutoffHz)
Creates the high pass filter. |
de.dfki.lt.signalproc.filter.LowPassFilter |
createLowPassFilter(double cutoffHz)
Creates the low pass filter. |
double[] |
fftLogPowerSpectrum(double[] sample)
Returns the log of the power spectrum of the given time domain sample. |
double[] |
fftRealSpectrum(double[] sample)
Returns the real half of the fft transform of the given time domain sample. |
abstract AbstractDSPValues |
getDSPValues()
Gets the DSP values. |
de.dfki.lt.signalproc.filter.LowPassFilter |
getEspLowPassFilter()
Convenience method to create an esp - specific low pass filter, filtering out signals above getUpperMeasurableFrequency() - 0.1. |
protected abstract int |
getFFTSize()
Return the size of the sample arrays. |
double |
getLogPower(double[] logFftd,
double frequency)
Linearly estimates the signal power at the specified frequency, between the surrounding two fft data points (non-integer value between 1 Hz and ( getUpperMeasurableFrequency() - 1) Hz exclusive). |
double |
getLogPower(double[] logFftd,
int lowerFreqHz,
int upperFreqHz)
Attempts average the power over the specified range by providing more weight to values in between lower & upper frequencies ie: For range i to i + 2, weights 1, 2, 1 For range i to i + 3, weights 1, 2, 2, 1 For range i to i + 4, weights 1, 2, 3, 2, 1 . |
java.util.Map<java.lang.Double,java.lang.Double> |
getLogPowersFor(double[] sample,
double... frequencies)
Returns a map of frequency / log power pairs from the given sample. |
protected abstract java.math.BigDecimal |
getRawSignalBreadth()
Return the range of the raw signal values (max - min). |
protected abstract double |
getSampleRate()
Return the sample rate. |
protected double |
getUpperMeasurableFrequency()
Gets the upper measurable frequency. |
double[] |
normalize(double[] sample)
Normalizes the raw signal to values between 0 and 1;. |
double[] |
normalize(double[] sample,
double scale)
Normalizes the raw signal to values between 0 and scale;. |
double[] |
normalize(double[] fftd,
int lowerCutoffHz,
int upperCutoffHz)
Returns an array of size upperCutoffHz + 1, containing the normalized values in the specified array from index lower thru upperCutoffHz inclusive. |
double |
rms(int lowerFreqHz,
int upperFreqHz,
double... fftd)
Returns the root mean square value of the given inputs over the given range. |
void |
setWindow(ddf.minim.analysis.WindowFunction window)
Sets the windowing function within the FFT instance. |
double |
wma(double... powers)
Returns the weighted moving average of the given inputs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected EspSignalUtilities(ddf.minim.analysis.WindowFunction window)
window - the window| Method Detail |
|---|
public void setWindow(ddf.minim.analysis.WindowFunction window)
window - the new window
public java.util.Map<java.lang.Double,java.lang.Double> getLogPowersFor(double[] sample,
double... frequencies)
sample - the samplefrequencies - the frequencies
public double[] fftRealSpectrum(double[] sample)
sample - the sample
public double[] fftLogPowerSpectrum(double[] sample)
sample - the sample
getLogPower(double[], double),
getLogPower(double[], int, int)
public double getLogPower(double[] logFftd,
int lowerFreqHz,
int upperFreqHz)
logFftd - the frequency-domain shifted samplelowerFreqHz - > 0 HzupperFreqHz - < getUpperMeasurableFrequency() Hz
fftLogPowerSpectrum(double[]),
createBandPassFilter(double, double)
public double getLogPower(double[] logFftd,
double frequency)
getUpperMeasurableFrequency() - 1) Hz exclusive).
logFftd - the frequency-domain shifted samplefrequency - non-integer, > 1 && < (getUpperMeasurableFrequency() - 1)
fftLogPowerSpectrum(double[])
public double[] normalize(double[] fftd,
int lowerCutoffHz,
int upperCutoffHz)
fftd - the specified array of frequency domain valueslowerCutoffHz - the minimum index to use for normalization, >= 1upperCutoffHz - the maximum index to use for normalization, <
getUpperMeasurableFrequency()
public double[] normalize(double[] sample)
sample - the sample
public double[] normalize(double[] sample,
double scale)
sample - the samplescale - the scale amount
public double rms(int lowerFreqHz,
int upperFreqHz,
double... fftd)
lowerFreqHz - >= 1upperFreqHz - < getUpperMeasurableFrequency()fftd - powers
public double wma(double... powers)
powers - the powers
public de.dfki.lt.signalproc.filter.BandPassFilter createBandPassFilter(double lowerCutoffHz,
double upperCutoffHz)
lowerCutoffHz - the lower cutoff hzupperCutoffHz - the upper cutoff hz
public de.dfki.lt.signalproc.filter.HighPassFilter createHighPassFilter(double cutoffHz)
cutoffHz - the cutoff hz
public de.dfki.lt.signalproc.filter.LowPassFilter createLowPassFilter(double cutoffHz)
cutoffHz - the cutoff hz
public de.dfki.lt.signalproc.filter.LowPassFilter getEspLowPassFilter()
getUpperMeasurableFrequency() - 0.1.
public double[] absolute(double[] array)
array - the array
public abstract AbstractDSPValues getDSPValues()
protected double getUpperMeasurableFrequency()
protected abstract int getFFTSize()
protected abstract double getSampleRate()
protected abstract java.math.BigDecimal getRawSignalBreadth()
|
brought to you by Mr. Stampy | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||