emd-0.2.0.0: Empirical Mode Decomposition and Hilbert-Huang Transform

Copyright(c) Justin Le 2019
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Numeric.EMD.Sift

Contents

Description

Tools for creating your own custom sift stopping conditions.

Since: 0.2.0.0

Synopsis

Documentation

newtype Sifter v n a Source #

A sift stopping condition.

It is a Pipe consumer that takes single sift step results upstream and terminates with '()' as soon as it is satisfied with the latest sift step.

Use combinators like siftOr and siftAnd to combine sifters, and the various sifters in Numeric.EMD.Sift to create sifters from commonly established ones or new ones from scratch.

Since: 0.2.0.0

Constructors

Sifter 

Fields

Instances
(Vector v a, Fractional a, Ord a) => Default (Sifter v n a) Source #

Since: 0.1.3.0

Instance details

Defined in Numeric.EMD.Sift

Methods

def :: Sifter v n a #

data SiftResult v n a Source #

The result of a sifting operation. Each sift either yields a residual, or a new IMF.

Constructors

SRResidual !(Vector v n a) 
SRIMF !(Vector v n a) !Int

number of sifting iterations

data SingleSift v n a Source #

Result of a single sift

Constructors

SingleSift 

Fields

type SM v n a = Reader (Vector v n a) Source #

Monad where Sifter actions live. The reader parameter is the "original vector".

Sifters

defaultSifter :: (Vector v a, Fractional a, Ord a) => Sifter v n a Source #

Default Sifter

defaultSifter = siftStdDev 0.3 siftOr siftTimes 50

R package uses siftTimes 20, Matlab uses no limit

siftStdDev Source #

Arguments

:: (Vector v a, Fractional a, Ord a) 
=> a

minimal threshold

-> Sifter v n a 

Sift based on the "standard deviation test", outlined in original paper.

siftTimes :: Int -> Sifter v n a Source #

Create a sifter that stops after a given fixed number of sifts.

Useful to use alongside siftOr to set an "upper limit" on the number of sifts.

siftEnergyDiff Source #

Arguments

:: (Vector v a, KnownNat n, Floating a, Ord a) 
=> a

Threshold for Energy Difference

-> a

Threshold for mean envelope RMS

-> Sifter v n a 

Cheng, Yu, Yang suggest pairing together an energy difference threshold with a threshold for mean envelope RMS. This is a convenience function to construct that pairing.

siftSCond Source #

Arguments

:: (Vector v a, KnownNat n, Fractional a, Ord a) 
=> Int

Streak n to stop on

-> Sifter v (n + 1) a 

Sift based on the "S-parameter" condition: Stop after a streak n of almost-same numbers of zero crossings and turning points.

siftAnd :: Sifter v n a -> Sifter v n a -> Sifter v n a infixr 3 Source #

Combine two sifters in "and" fashion: The final sifter will complete when both sifters complete.

siftOr :: Sifter v n a -> Sifter v n a -> Sifter v n a infixr 2 Source #

Combine two sifters in "or" fashion: The final sifter will complete when either sifter completes.

Make Sifters

envMean :: (Vector v a, KnownNat n, Floating a) => SingleSift v n a -> SM v n a a Source #

Project the root mean square of the mean of the maximum and minimum envelopes.

energyDiff :: (Vector v a, Floating a) => SingleSift v n a -> SM v n a a Source #

Project the square root of the "Energy difference".

normalizeProj :: (Vector v a, KnownNat n, Floating a) => (SingleSift v n a -> SM v n a a) -> SingleSift v n a -> SM v n a a Source #

Given a "projection function" (like envMean or energyDiff), re-scale the result based on the RMS of the original signal.

siftCauchy Source #

Arguments

:: (Fractional b, Ord b) 
=> (SingleSift v n a -> b)

Projection function

-> b

Threshold \(\delta\)

-> Sifter v n a 

General class of "cauchy-like" sifters: Given a projection function from a SingleSift, stop as soon as successive projections become smaller than a given threshold, propertionally.

Given \(f(x_t)\), stop when:

\[ \frac{(f(x_t) - f(x_{t-1}))^2}{f^2(x_{t-1})} < \delta \]

siftPairs :: Ord b => (SingleSift v n a -> SingleSift v n a -> SM v n a b) -> b -> Sifter v n a Source #

Create a sifter that stops when some projection on two consecutive SingleSifts is smaller than a given threshold.

siftProj Source #

Arguments

:: Ord b 
=> (SingleSift v n a -> SM v n a b)

projection

-> b

threshold

-> Sifter v n a 

Create a sifter that stops when some projection on SingleSift is smaller than a given threshold.

siftPairs_ :: (SingleSift v n a -> SingleSift v n a -> SM v n a Bool) -> Sifter v n a Source #

Create a sifter that stops based on some predicate on two consecutive SingleSifts being True.

siftProj_ :: (SingleSift v n a -> SM v n a Bool) -> Sifter v n a Source #

Create a sifter that stops based on some predicate on the initial vector and SingleSift being True.

Internal

sift :: forall v n a. (Vector v a, KnownNat n, Floating a, Ord a) => EMDOpts v (n + 1) a -> Vector v (n + 1) a -> SiftResult v (n + 1) a Source #

Iterated sifting process, used to produce either an IMF or a residual.

envelopes :: (Vector v a, KnownNat n, Fractional a, Ord a) => SplineEnd a -> Maybe BoundaryHandler -> Vector v (n + 1) a -> Maybe (Vector v (n + 1) a, Vector v (n + 1) a) Source #

Returns cubic splines of local minimums and maximums. Returns Nothing if there are not enough local minimum or maximums to create the splines.

rms :: (Vector v a, KnownNat n, Floating a) => Vector v n a -> a Source #

Get the root mean square of a vector

Orphan instances

(Vector v a, Fractional a, Ord a) => Default (Sifter v n a) Source #

Since: 0.1.3.0

Instance details

Methods

def :: Sifter v n a #