cyrilou242 / mockseries

Easy and intuitive generation of synthetic timeseries for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mockseries

mockseries is and easy to use and intuitive Python package that helps generate synthetic (mock) timeseries.

-> Documentation website.

Installation

#python >=3.6.6 
pip install mockseries

Contributing

Contributions are welcome!
Standards, objectives and process not defined yet.

Quick Run

Define a timeseries

from datetime import timedelta
from mockseries.trend import LinearTrend
from mockseries.seasonality import SinusoidalSeasonality
from mockseries.noise import RedNoise

trend = LinearTrend(coefficient=2, time_unit=timedelta(days=4), flat_base=100)
seasonality = SinusoidalSeasonality(amplitude=20, period=timedelta(days=7)) \
              + SinusoidalSeasonality(amplitude=4, period=timedelta(days=1))
noise = RedNoise(mean=0, std=3, correlation=0.5)

timeseries = trend + seasonality + noise

Generate values

from datetime import datetime
from mockseries.utils import datetime_range

ts_index = datetime_range(
    granularity=timedelta(hours=1),
    start_time=datetime(2021, 5, 31),
    end_time=datetime(2021, 8, 30),
)
ts_values = timeseries.generate(ts_index)

Plot or write to csv

from mockseries.utils import plot_timeseries, write_csv

print(ts_index, ts_values)
plot_timeseries(ts_index, ts_values, save_path="hello_mockseries.png")
write_csv(ts_index, ts_values, "hello_mockseries.csv")

References

About

Easy and intuitive generation of synthetic timeseries for Python.

License:MIT License


Languages

Language:Jupyter Notebook 96.6%Language:Python 2.8%Language:JavaScript 0.4%Language:Makefile 0.2%Language:CSS 0.1%