Generate random events
events
- class timeflux.nodes.events.Events(rows_min=1, rows_max=10, string_min=3, string_max=12, items_min=0, items_max=5, seed=None)[source]
Bases:
timeflux.core.node.Node
Helper class that provides a standard way to create an ABC using inheritance.
Return random integers from value_min to value_max (inclusive)
- class timeflux.nodes.events.Periodic(label='clock', data=None, interval=None, phase=None)[source]
Bases:
timeflux.core.node.Node
Node that sends events at a regular interval.
This node sends regular events after the first time the update method is called. If the update method is called at time t, and this node has a interval ti and phase ts, then the first event will be at t + ts. Then there will be one event at t + ts + k ti where k is 1, 2, …
- Parameters
label (str) – Event name that will be generated by this node.
data (dict) – Dictionary sent in each event.
interval (dict) – Dictionary with keyword arguments passed to datetime.timedelta to define the time interval between events. This can be seconds, milliseconds, microseconds, etc.
phase (dict) – Dictionary with keyword arguments passed to datetime.timedelta to define a phase for the stimulations. The first stimulation will happen after this time delta is observed. If not set, the phase will be as the interval.
- Variables
o (Port) – Default output, provides a pandas.DataFrame with events.
Examples
The following YAML can be used to generate events every half second but only after 5 seconds have elapsed
graphs: - nodes: - id: clock module: timeflux.nodes.events class: Periodic params: label: my-event-label interval: milliseconds: 500 phase: seconds: 5 - id: display module: timeflux.nodes.debug class: Display rate: 20 edges: - source: clock target: display
Instantiate the node.