Portability | uses FFI |
---|---|
Stability | provisional |
Maintainer | haskell.vivian.mcphail <at> gmail <dot> com |
Signal processing functions
- class Convolvable a where
- convolve :: a -> a -> a
- class (Storable a, Container Vector a, Num (Vector a), Convert a, Floating (Vector a), RealElement a, Num a) => Filterable a
- hamming :: Filterable a => Int -> Vector a
- pwelch :: Int -> Int -> Vector Double -> (Vector Double, Vector Double)
- fir :: (Filterable a, Container Vector (Complex a), Convert (Complex a), Double ~ DoubleOf a) => Int -> [(a, a)] -> Int -> Int -> Vector a -> Vector a
- standard_fir :: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) => Int -> [(a, a)] -> Vector a
- broadband_fir :: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) => Int -> (Int, Int) -> Vector a
- freqzF :: (Filterable a, Double ~ DoubleOf a, Filterable (DoubleOf a)) => Vector a -> Vector a -> Int -> Vector a -> Vector a
- freqzN :: (Filterable a, Enum a, Double ~ DoubleOf a) => Vector a -> Vector a -> Int -> Int -> (Vector a, Vector a)
- filter :: Filterable a => Vector a -> Vector a -> Int -> Vector a -> Vector a
- broadband_filter :: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) => Int -> (Int, Int) -> Vector a -> Vector a
- analytic_signal :: Vector Double -> Vector (Complex Double)
- analytic_power :: Filterable a => Vector (Complex Double) -> Vector a
- analytic_phase :: (Filterable a, Container Vector a, Double ~ DoubleOf a) => Vector (Complex a) -> Vector a
- unwrap :: Filterable a => Vector a -> Vector a
- detrend :: Int -> Vector Double -> Vector Double
- resize :: Filterable a => Int -> Vector a -> Vector a
- downsample :: Filterable a => Int -> Vector a -> Vector a
- deriv :: Filterable a => Vector a -> Vector a
Documentation
class Convolvable a whereSource
convolve two containers, output is the size of the second argument, no zero padding
class (Storable a, Container Vector a, Num (Vector a), Convert a, Floating (Vector a), RealElement a, Num a) => Filterable a Source
Filtering
:: Filterable a | |
=> Int | length |
-> Vector a | the Hamming coeffficents |
coefficients of a Hamming window
:: Int | sampling rate |
-> Int | window size |
-> Vector Double | input signal |
-> (Vector Double, Vector Double) | (frequency index,power density) |
Welch (1967) power spectrum density using periodogram/FFT method
:: (Filterable a, Container Vector (Complex a), Convert (Complex a), Double ~ DoubleOf a) | |
=> Int | order (one less than the length of the filter) |
-> [(a, a)] | band edge frequency, nondecreasing, [0, f1, ..., f(n-1), 1] ^ band edge magnitude |
-> Int | grid spacing |
-> Int | transition width |
-> Vector a | smoothing window (size is order + 1) |
-> Vector a | the filter coefficients |
produce an FIR filter
standard_fir :: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) => Int -> [(a, a)] -> Vector aSource
standard FIR filter | FIR filter with grid a power of 2 greater than the order, ramp = grid/16, hamming window
:: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) | |
=> Int | sampling rate |
-> (Int, Int) | (lower,upper) frequency cutoff |
-> Vector a | filter coefficients |
a broadband FIR
:: (Filterable a, Double ~ DoubleOf a, Filterable (DoubleOf a)) | |
=> Vector a | zero coefficients |
-> Vector a | pole coefficients |
-> Int | sampling rate |
-> Vector a | frequencies |
-> Vector a | frequency response |
determine the frequency response of a filter, given a vector of frequencies
:: (Filterable a, Enum a, Double ~ DoubleOf a) | |
=> Vector a | zero coefficients |
-> Vector a | pole coefficients |
-> Int | sampling rate |
-> Int | number of points |
-> (Vector a, Vector a) | (frequencies,response) |
determine the frequency response of a filter, given a number of points and sampling rate
:: Filterable a | |
=> Vector a | zero coefficients |
-> Vector a | pole coefficients |
-> Int | sampling rate |
-> Vector a | input signal |
-> Vector a | output signal |
filters the signal
:: (Filterable a, Double ~ DoubleOf a, Container Vector (Complex a), Convert (Complex a)) | |
=> Int | sampling rate |
-> (Int, Int) | (lower,upper) frequency cutoff |
-> Vector a | input signal |
-> Vector a | output signal |
a broadband filter
Analytic Signal
analytic_signal :: Vector Double -> Vector (Complex Double)Source
an analytic signal is the original signal with Hilbert-transformed signal as imaginary component
analytic_power :: Filterable a => Vector (Complex Double) -> Vector aSource
the power (amplitude^2 = v * (conj c)) of an analytic signal
analytic_phase :: (Filterable a, Container Vector a, Double ~ DoubleOf a) => Vector (Complex a) -> Vector aSource
the phase of an analytic signal
unwrap :: Filterable a => Vector a -> Vector aSource
unwrap the phase of signal (input expected to be within (-pi,pi)
Preprocessing
remove a linear trend from data
resize :: Filterable a => Int -> Vector a -> Vector aSource
resize the vector to length n by resampling
downsample :: Filterable a => Int -> Vector a -> Vector aSource
resample, take one sample every n samples in the original
deriv :: Filterable a => Vector a -> Vector aSource
the difference between consecutive elements of a vector