netwire-5.0.0: Functional reactive programming library

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

FRP.Netwire.Analyze

Contents

Description

 

Synopsis

Linear graphs

lAvgSource

Arguments

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

lGraphSource

Arguments

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

lGraphNSource

Arguments

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

sAvgSource

Arguments

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

sGraphSource

Arguments

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

sGraphNSource

Arguments

:: (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 sGraph.

See also lGraphN.

  • 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.

Peaks

highPeak :: Ord a => Wire s e m a aSource

High peak.

  • Depends: now.

highPeakBy :: (a -> a -> Ordering) -> Wire s e m a aSource

High peak with respect to the given comparison function.

  • Depends: now.

lowPeak :: Ord a => Wire s e m a aSource

Low peak.

  • Depends: now.

lowPeakBy :: (a -> a -> Ordering) -> Wire s e m a aSource

Low peak with respect to the given comparison function.

  • Depends: now.

Debug

avgFpsSource

Arguments

:: (RealFloat b, HasTime t s) 
=> Int

Number of samples.

-> Wire s e m a b 

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.

framerate :: (Eq b, Fractional b, HasTime t s, Monoid e) => Wire s e m a bSource

Current framerate.

Note: This wire is for debugging purposes only, because it exposes discrete time. Do not taint your application with discrete time.

  • Inhibits: when the clock stopped ticking.