Skip to content

adkvi/faketelemetry

Repository files navigation

PyPI version License: MIT CI

FakeTelemetry

A minimal Python package to generate real-time, timestamped fake telemetry streams for testing, simulation, and development.

Links

Features

  • Sine, cosine, square, sawtooth, triangle, pulse, and random noise waveforms
  • Custom user-defined waveform support
  • Adjustable amplitude, frequency, offset, and sample rate
  • Optional Gaussian noise injection
  • Real-time streaming of (datetime, value) tuples
  • Multi-channel (parallel) telemetry generation
  • Well-tested and extensible

Quickstart

Generate a sine wave stream in seconds:

from faketelemetry import TelemetryGenerator, WaveformType

gen = TelemetryGenerator(WaveformType.SINE)
for ts, val in gen.stream(sampling_rate=1.0, duration=2):
    print(ts, val)

Requirements

  • Python 3.7 or newer
  • No external dependencies (pure Python)

Example Usage

from faketelemetry import TelemetryGenerator, WaveformType, NoiseInjector, MultiChannelTelemetryGenerator

# Single channel with noise (sine wave)
noise = NoiseInjector(noise_level=0.2)
gen = TelemetryGenerator(
    waveform=WaveformType.SINE,
    frequency=1.0,
    amplitude=1.0,
    offset=0.0,
    noise_injector=noise
)
for timestamp, value in gen.stream(sampling_rate=2.0, duration=3):
    print(timestamp, value)

# Multi-channel example (sine and cosine)
ch1 = TelemetryGenerator(WaveformType.SINE, frequency=1.0)
ch2 = TelemetryGenerator(WaveformType.COSINE, frequency=0.5)
multi = MultiChannelTelemetryGenerator([ch1, ch2])
for sample in multi.stream(sampling_rate=2.0, duration=3):
    print({k: (v[0], v[1]) for k, v in sample.items()})

# Triangle and pulse waveforms
tri = TelemetryGenerator(WaveformType.TRIANGLE, frequency=1.0)
pulse = TelemetryGenerator(WaveformType.PULSE, frequency=1.0)
print('Triangle:', next(tri.stream(1)))
print('Pulse:', next(pulse.stream(1)))

# Custom waveform (e.g., constant 42)
def custom_func(t):
    return 42.0
gen_custom = TelemetryGenerator(WaveformType.CUSTOM, custom_func=custom_func)
print('Custom:', next(gen_custom.stream(1)))

Installation

Install from PyPI:

pip install faketelemetry

Or clone this repo and install locally:

pip install .

Or install in editable/development mode:

pip install -e .

Testing

Run all tests:

python -m unittest discover -s tests

Support

For questions or issues, please open a GitHub Issue.

License

MIT

About

Fake telemetry stream generator for Python.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages