Copyright | (c) 2013 Ertugrul Soeylemez |
---|---|
License | BSD3 |
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Safe Haskell | None |
Language | Haskell2010 |
- lAvg :: (Fractional a, Fractional t, HasTime t s) => t -> Wire s e m a a
- lGraph :: (Fractional a, Fractional t, HasTime t s) => [t] -> Wire s e m a [a]
- lGraphN :: (Fractional a, Fractional t, HasTime t s) => t -> Int -> Wire s e m a [a]
- sAvg :: (Fractional a, Fractional t, HasTime t s) => t -> Wire s e m a a
- sGraph :: (Fractional t, HasTime t s) => [t] -> Wire s e m a [a]
- sGraphN :: (Fractional t, HasTime t s) => t -> Int -> Wire s e m a [a]
- highPeak :: Ord a => Wire s e m a a
- highPeakBy :: (a -> a -> Ordering) -> Wire s e m a a
- lowPeak :: Ord a => Wire s e m a a
- lowPeakBy :: (a -> a -> Ordering) -> Wire s e m a a
- avgFps :: (RealFloat b, HasTime t s) => Int -> Wire s e m a b
- framerate :: (Eq b, Fractional b, HasTime t s, Monoid e) => Wire s e m a b
Linear graphs
:: (Fractional a, Fractional t, HasTime t s) | |
=> t | Interval size. |
-> Wire s e m a a |
Calculate the average of the signal over the given interval (from
now). This is done by calculating the integral of the corresponding
linearly interpolated graph and dividing it by the interval length.
See linAvg
for details.
Linear interpolation can be slow. If you don't need it, you can use
the staircase variant sAvg
.
Example: lAvg 2
- Complexity: O(s) space, O(s) time wrt number of samples in the interval.
- Depends: now.
:: (Fractional a, Fractional t, HasTime t s) | |
=> [t] | Data points to produce. |
-> Wire s e m a [a] |
Produce a linearly interpolated graph for the given points in time, where the magnitudes of the points are distances from now.
Linear interpolation can be slow. If you don't need it, you can use
the faster staircase variant sGraph
.
Example: lGraph [0, 1, 2]
will output the interpolated inputs at
now, one second before now and two seconds before now.
- Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
- Depends: now.
:: (Fractional a, Fractional t, HasTime t s) | |
=> t | Interval to graph from now. |
-> Int | Number of data points to produce. |
-> Wire s e m a [a] |
Graph the given interval from now with the given number of evenly
distributed points in time. Convenience interface to lGraph
.
Linear interpolation can be slow. If you don't need it, you can use
the faster staircase variant sGraphN
.
- Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
- Depends: now.
Staircase graphs
:: (Fractional a, Fractional t, HasTime t s) | |
=> t | Interval size. |
-> Wire s e m a a |
Calculate the average of the signal over the given interval (from
now). This is done by calculating the integral of the corresponding
staircase graph and dividing it by the interval length. See
scAvg
for details.
See also lAvg
.
Example: sAvg 2
- Complexity: O(s) space, O(s) time wrt number of samples in the interval.
- Depends: now.
:: (Fractional t, HasTime t s) | |
=> [t] | Data points to produce. |
-> Wire s e m a [a] |
Produce a staircase graph for the given points in time, where the magnitudes of the points are distances from now.
See also lGraph
.
Example: sGraph [0, 1, 2]
will output the inputs at now, one
second before now and two seconds before now.
- Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
- Depends: now.
:: (Fractional t, HasTime t s) | |
=> t | Interval to graph from now. |
-> Int | Number of data points to produce. |
-> Wire s e m a [a] |
Peaks
highPeakBy :: (a -> a -> Ordering) -> Wire s e m a a Source
High peak with respect to the given comparison function.
- Depends: now.
lowPeakBy :: (a -> a -> Ordering) -> Wire s e m a a Source
Low peak with respect to the given comparison function.
- Depends: now.
Debug
Average framerate over the last given number of samples. One
important thing to note is that the value of this wire will generally
disagree with sAvg
composed with framerate
. This is expected,
because this wire simply calculates the arithmetic mean, whereas
sAvg
will actually integrate the framerate graph.
Note: This wire is for debugging purposes only, because it exposes discrete time. Do not taint your application with discrete time.
- Complexity: O(n) time and space wrt number of samples.