datalogd.plugins.randomwalk_datasource module

class datalogd.plugins.randomwalk_datasource.RandomWalkDataSource(sinks=[], seed=None, interval=1.0, walkers=[[0.0, 1.0], [0.0, 2.0]])[source]

Bases: datalogd.DataSource

Generate test or demonstration data using a random walk algorithm.

For each iteration of the algorithm, the output value will either be unchanged, increase, or decrease by a fixed increment. The options are chosen randomly with equal probability.

Multiple walkers can be initialised to produce several sources of random data. The walkers parameter is a list, the length of which determines the number of walkers to use. Each item in the list must be a list/tuple of two items: the walker’s initial value and increment.

Parameters:
  • seed – Seed used to initialise the random number generator.
  • interval – How often to run an iteration of the algorithm, in seconds.
  • walkers – List defining number of walkers and their parameters in the form [[init, increment], ...].
generate_data()[source]

Run one iteration of the random walk algorithm and send the value to any connected sinks.