Portability | uses FFI |
---|---|

Stability | provisional |

Maintainer | haskell.vivian.mcphail <at> gmail <dot> com |

Signal processing functions

- hamming :: Int -> Vector Double
- pwelch :: Int -> Int -> Vector Double -> (Vector Double, Vector Double)
- fir :: Int -> [(Double, Double)] -> Int -> Int -> Vector Double -> Vector Double
- standard_fir :: Int -> [(Double, Double)] -> Vector Double
- broadband_fir :: Int -> (Int, Int) -> Vector Double
- freqzF :: Vector Double -> Vector Double -> Int -> Vector Double -> Vector Double
- freqzN :: Vector Double -> Vector Double -> Int -> Int -> (Vector Double, Vector Double)
- filter :: Vector Double -> Vector Double -> Int -> Vector Double -> Vector Double
- broadband_filter :: Int -> (Int, Int) -> Vector Double -> Vector Double
- analytic_signal :: Vector Double -> Vector (Complex Double)
- analytic_power :: Vector (Complex Double) -> Vector Double
- analytic_phase :: Vector (Complex Double) -> Vector Double
- unwrap :: Vector Double -> Vector Double
- detrend :: Int -> Vector Double -> Vector Double
- downsample :: Int -> Vector Double -> Vector Double
- resize :: Int -> Vector Double -> Vector Double
- deriv :: Vector Double -> Vector Double

# Filtering

:: 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

:: Int | order (one less than the length of the filter) |

-> [(Double, Double)] | band edge frequency, nondecreasing, [0, f1, ..., f(n-1), 1] ^ band edge magnitude |

-> Int | grid spacing |

-> Int | transition width |

-> Vector Double | smoothing window (size is order + 1) |

-> Vector Double | the filter coefficients |

produce an FIR filter

standard_fir :: Int -> [(Double, Double)] -> Vector DoubleSource

standard FIR filter | FIR filter with grid a power of 2 greater than the order, ramp = grid/16, hamming window

a broadband FIR

:: Vector Double | zero coefficients |

-> Vector Double | pole coefficients |

-> Int | sampling rate |

-> Vector Double | frequencies |

-> Vector Double | frequency response |

determine the frequency response of a filter, given a vector of frequencies

:: Vector Double | zero coefficients |

-> Vector Double | pole coefficients |

-> Int | sampling rate |

-> Int | number of points |

-> (Vector Double, Vector Double) | (frequencies,response) |

determine the frequency response of a filter, given a number of points and sampling rate

:: Vector Double | zero coefficients |

-> Vector Double | pole coefficients |

-> Int | sampling rate |

-> Vector Double | input signal |

-> Vector Double | output signal |

filters the signal

:: Int | sampling rate |

-> (Int, Int) | (lower,upper) frequency cutoff |

-> Vector Double | input signal |

-> Vector Double | 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 :: Vector (Complex Double) -> Vector DoubleSource

the power (amplitude^2 = v * (conj c)) of an analytic signal

unwrap :: Vector Double -> Vector DoubleSource

unwrap the phase of signal (input expected to be within (-pi,pi)

# Preprocessing

remove a linear trend from data

downsample :: Int -> Vector Double -> Vector DoubleSource

take one sample from every n samples in the original