-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Empirical Mode Decomposition (Hilbert-Huang Transform)
--
-- Please see the README on GitHub at
-- https://github.com/mstksg/emd#readme
@package emd
@version 0.1.0.0
-- | Internal splining functionality exported for testing purposes only.
-- This will likely go away in future versions, so please do not depend
-- on this!
module Numeric.EMD.Internal.Spline
-- | 1D Cubic spline
data Spline a
-- | End condition for spline
data SplineEnd
SENotAKnot :: SplineEnd
SENatural :: SplineEnd
-- | Build a cubic spline based on control points using given end
-- conditions (not-a-knot, or natural)
--
-- https://en.wikipedia.org/wiki/Spline_interpolation
makeSpline :: forall a. (Ord a, Fractional a) => SplineEnd -> Map a a -> Maybe (Spline a)
-- | Sample a spline at a given point.
sampleSpline :: (Fractional a, Ord a) => Spline a -> a -> a
instance GHC.Show.Show a => GHC.Show.Show (Numeric.EMD.Internal.Spline.SplineCoef a)
instance GHC.Classes.Ord Numeric.EMD.Internal.Spline.SplineEnd
instance GHC.Classes.Eq Numeric.EMD.Internal.Spline.SplineEnd
instance GHC.Show.Show Numeric.EMD.Internal.Spline.SplineEnd
-- | Empirical Mode Decomposition (Hilbert-Huang Transform) in pure
-- Haskell.
--
-- Main interface is emd, with defaultEO. A tracing version
-- that outputs a log to stdout is also available, as emdTrace.
-- This can be used to help track down a specific IMF that might be
-- taking more time than desired.
module Numeric.EMD
-- | EMD decomposition (Hilbert-Huang Transform) of a given time series
-- with a given sifting stop condition.
emd :: (Vector v a, KnownNat n, Fractional a, Ord a) => EMDOpts a -> Vector v (n + 2) a -> EMD v (n + 2) a
-- | emd, but tracing results to stdout as IMFs are found. Useful
-- for debugging to see how long each step is taking.
emdTrace :: (Vector v a, KnownNat n, Fractional a, Ord a, MonadIO m) => EMDOpts a -> Vector v (n + 2) a -> m (EMD v (n + 2) a)
-- | emd with a callback for each found IMF.
emd' :: (Vector v a, KnownNat n, Fractional a, Ord a, Applicative m) => (SiftResult v (n + 2) a -> m r) -> EMDOpts a -> Vector v (n + 2) a -> m (EMD v (n + 2) a)
-- | An EMD v n a is a Hilbert-Huang transform of a time
-- series with n items of type a stored in a vector
-- v.
data EMD v n a
EMD :: ![Vector v n a] -> !(Vector v n a) -> EMD v n a
[emdIMFs] :: EMD v n a -> ![Vector v n a]
[emdResidual] :: EMD v n a -> !(Vector v n a)
-- | Options for EMD composition.
data EMDOpts a
EO :: SiftCondition a -> SplineEnd -> Bool -> EMDOpts a
-- | stop condition for sifting
[eoSiftCondition] :: EMDOpts a -> SiftCondition a
-- | end conditions for envelope splines
[eoSplineEnd] :: EMDOpts a -> SplineEnd
-- | if True, use time series endpoints as part of min and max
-- envelopes
[eoClampEnvelope] :: EMDOpts a -> Bool
-- | Default EMDOpts
defaultEO :: Fractional a => EMDOpts a
-- | Stop conditions for sifting process
data SiftCondition a
-- | Stop using standard SD method
SCStdDev :: a -> SiftCondition a
-- | Stop after a fixed number of iterations
SCTimes :: Int -> SiftCondition a
-- | one or the other
SCOr :: (SiftCondition a) -> (SiftCondition a) -> SiftCondition a
-- | both conditions met
SCAnd :: (SiftCondition a) -> (SiftCondition a) -> SiftCondition a
-- | Default SiftCondition
defaultSC :: Fractional a => SiftCondition a
-- | End condition for spline
data SplineEnd
SENotAKnot :: SplineEnd
SENatural :: SplineEnd
-- | Iterated sifting process, used to produce either an IMF or a residual.
sift :: (Vector v a, KnownNat n, Fractional a, Ord a) => EMDOpts a -> Vector v (n + 2) a -> SiftResult v (n + 2) a
-- | The result of a sifting operation. Each sift either yields a residual,
-- or a new IMF.
data SiftResult v n a
SRResidual :: !(Vector v n a) -> SiftResult v n a
SRIMF :: !(Vector v n a) -> !Int -> SiftResult v n a
-- | Returns cubic splines of local minimums and maximums. Returns
-- Nothing if there are not enough local minimum or maximums to
-- create the splines.
envelopes :: (Vector v a, KnownNat n, Fractional a, Ord a) => SplineEnd -> Bool -> Vector v (n + 2) a -> Maybe (Vector v (n + 2) a, Vector v (n + 2) a)
instance GHC.Show.Show (v a) => GHC.Show.Show (Numeric.EMD.EMD v n a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Numeric.EMD.EMDOpts a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Numeric.EMD.EMDOpts a)
instance GHC.Show.Show a => GHC.Show.Show (Numeric.EMD.EMDOpts a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Numeric.EMD.SiftCondition a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Numeric.EMD.SiftCondition a)
instance GHC.Show.Show a => GHC.Show.Show (Numeric.EMD.SiftCondition a)