Copyright | (c) 2012 Ertugrul Soeylemez |
---|---|
License | BSD3 |
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Safe Haskell | None |
Language | Haskell2010 |
Signal analysis wires.
- avg :: forall a m e v. (Fractional a, VectorSpace v, Scalar v ~ a) => Int -> Wire e m v v
- avgInt :: forall a m e v. (Fractional a, VectorSpace v, Scalar v ~ a) => Int -> Int -> Wire e m v v
- avgAll :: forall a m e v. (Fractional a, VectorSpace v, Scalar v ~ a) => Wire e m v v
- avgFps :: Monad m => Int -> Wire e m a Double
- avgFpsInt :: Monad m => Int -> Int -> Wire e m a Double
- highPeak :: Ord b => Wire e m b b
- lowPeak :: Ord b => Wire e m b b
- peakBy :: forall b m e. (b -> b -> Ordering) -> Wire e m b b
- collect :: forall b m e. Ord b => Wire e m b (Map b Int)
- firstSeen :: forall a m e. Ord a => Wire e m a Time
- lastSeen :: forall a m e. (Monoid e, Ord a) => Wire e m a Time
Statistics
Average
avg :: forall a m e v. (Fractional a, VectorSpace v, Scalar v ~ a) => Int -> Wire e m v v Source
Calculate the average of the signal over the given number of last
samples. If you need an average over all samples ever produced,
consider using avgAll
instead.
- Complexity: O(n) space wrt number of samples.
- Depends: current instant.
:: (Fractional a, VectorSpace v, Scalar v ~ a) | |
=> Int | Sampling interval. |
-> Int | Number of samples. |
-> Wire e m v v |
Same as avg
, but with a sampling interval. This can be used to
increase the performance, if the input is complicated.
- Complexity: O(n) space wrt number of samples.
- Depends: current instant.
avgAll :: forall a m e v. (Fractional a, VectorSpace v, Scalar v ~ a) => Wire e m v v Source
Calculate the average of the input signal over all samples. This
is usually not what you want. In most cases the avg
wire is
preferable.
- Depends: current instant.
avgFps :: Monad m => Int -> Wire e m a Double Source
Calculate the average number of instants per second for the last given number of instants. In a continuous game or simulation this corresponds to the average number of frames per second, hence the name.
- Complexity: O(n) space wrt number of samples.
- Depends: time.
Like avgFps
, but sample in discrete intervals only. This can
greatly enhance the performance, when you have an inefficient clock
source.
- Complexity: O(n) space wrt number of samples.
- Depends: time.
Peak
peakBy :: forall b m e. (b -> b -> Ordering) -> Wire e m b b Source
Output the peak with respect to the given comparison function.
- Depends: current instant.
Monitoring
collect :: forall b m e. Ord b => Wire e m b (Map b Int) Source
Collect all distinct inputs ever received together with a count. Elements not appearing in the map have not been observed yet.
- Complexity: O(n) space.
- Depends: current instant.