timesynth / timesynth Goto Github PK
View Code? Open in Web Editor NEWA Multipurpose Library for Synthetic Time Series Generation in Python
License: MIT License
A Multipurpose Library for Synthetic Time Series Generation in Python
License: MIT License
In the example IPython notebook TimeSynthExamples.ipynb
, the 24th cell has this example code for an AR model:
# Initializing TimeSampler
time_sampler = ts.TimeSampler(stop_time=20)
# Sampling regular time samples
regular_time_samples = time_sampler.sample_irregular_time(num_points=500)
Though it should be regular time samples, i.e., using the sample_regular_time()
method from timesampler.py
.
Current git version of jitcdde does not have provide_advanced_symbols, so the
import timesynth as ts fails.
The commit that makes the change in jitcdde is here:
neurophysik/jitcdde@7dc8e85#diff-3f8fb500f61af0428394d41b462c2632
The workaround is simply:
pip install jitcdde==0.32
Either for ar_params: None or iterable, not [None], and let's use arrays instead of lists to make stuff faster internally.
I would like to be able to generate ARIMA series (i.e. with differencing as well as AR and MA components), is this possible using TimeSynth? I'm looking at the NARMA function, but I can't work out if I can specify differences, or if I can have different orders for AR and MA? If there is any existing documentation that answers these questions please direct me to it.
Thanks very much.
From the example:
import TimeSynth as ts
time_sampler = ts.TimeSampler(stop_time=20)
gives error:
AttributeError: module 'TimeSynth' has no attribute 'TimeSampler'
instead it should be:
import TimeSynth.timesynth as ts
from TimeSynth.timesynth import timesampler
time_sampler = ts.TimeSampler(stop_time=20)
The above works. Just need one level down.
Yep, this is on Python 3.6
is it possible to simulate multivariate time series ?
Is there something about symengine>0.4.0 that breaks TimeSynth? Because this requirement keeps your library from being used in Python 3.8
I like your library, but I don't want to stay stuck in 3.7 if I can avoid it.
Is there any way to generate time series data as a stream manner? Instead of generating all the time series data at once is there a way to generate readings on demand using python generator object?
This is the error log:
Collecting timesynth
Downloading https://files.pythonhosted.org/packages/90/10/db1a380cbff37963d775e4104d3566c956ea4726f5f51dc6bc3f6b693f01/timesynth-0.2.3.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rbmeb8l4/timesynth/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rbmeb8l4/timesynth/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-rbmeb8l4/timesynth/pip-egg-info
cwd: /tmp/pip-install-rbmeb8l4/timesynth/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-rbmeb8l4/timesynth/setup.py", line 9, in <module>
with open('requirements.txt') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Hi there,
first of all thanks for sharing this project! It is a great help. I would love to add this via pip or conda instead of the classic installation procedure. Do you have plans of doing that? In case of interest we could also share the work. When looking at e.g. https://packaging.python.org/tutorials/packaging-projects/ it seems rather easy.
Best wishes
Thought it may be helpful/convenient to have a link to the license in the readme
It appears that timesynth.signals.PseudoPeriodic.sample_next()
always uses sin() as its harmonic function regardless of what was passed as the ftype parameter to PseudoPeriodic.__init__()
. Was this intentional?
Hi,
I've got my own timeseries to which I want to add noise using the noise generator.
Is there a way to integrate my own timeseries as if it was generated by the package?
Within "timeseries.py", I've already circumvented the need for vectorization (which gave an attribute error) by ignoring the if and elif statements.
However, when running, it says that my dataframe has no attribute "sample_next". I understand why this is, but I was wondering if there is an easy way to do something like "sample_next" without using that specific function. If that is achieved, everything should work.
import timesynth as ts
Traceback (most recent call last):
File "", line 1, in
File "/Users/sumitra/work/TimeSynth/timesynth/init.py", line 2, in
from . import signals
File "/Users/sumitra/work/TimeSynth/timesynth/signals/init.py", line 5, in
[_basename(f)[:-3] for f in _glob.glob(_dirname(file) + "/*.py")
File "", line 4, in
File "/Users/sumitra/work/TimeSynth/timesynth/signals/dde.py", line 6, in
from jitcdde import y, t, jitcdde
File "/Users/sumitra/work/scheduling/venv/lib/python3.7/site-packages/jitcdde-1.3.1-py3.7.egg/jitcdde/init.py", line 1, in
File "/Users/sumitra/work/scheduling/venv/lib/python3.7/site-packages/jitcdde-1.3.1-py3.7.egg/jitcdde/_jitcdde.py", line 6, in
ModuleNotFoundError: No module named 'symengine'
import timesynth as ts
time_sampler = ts.TimeSampler(stop_time=20)
regular_time_samples = time_sampler.sample_regular_time(num_points=500)
Initializing AR(2) model
ar_p = ts.signals.AutoRegressive(ar_param=[1.5, -0.75])
ar_p_series = ts.TimeSeries(signal_generator=ar_p)
samples = ar_p_series.sample(regular_time_samples)
Fails with error
Traceback (most recent call last):
File "", line 1, in
File "/home/bill/mambaforge/envs/nn/lib/python3.11/site-packages/timesynth/timeseries.py", line 63, in sample
signal = self.signal_generator.sample_next(t, samples[:i - 1], errors[:i - 1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bill/mambaforge/envs/nn/lib/python3.11/site-packages/timesynth/signals/ar.py", line 54, in sample_next
ar_value = np.sum(ar_value) + noise
^^^^^^^^^^^^^^^^
File "<array_function internals>", line 200, in sum
File "/home/bill/mambaforge/envs/nn/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 2324, in sum
return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bill/mambaforge/envs/nn/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
Running with Python 3.11.3
Hi everyone,
I've been trying to install TimeSynth through pip and been receiving the following Error:
PS C:\Users\Nikolas> python -m pip install timesynth
Collecting timesynth
Using cached timesynth-0.2.4-py3-none-any.whl (15 kB)
Requirement already satisfied: scipy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.4.1)
Processing c:\users\nikolas\appdata\local\pip\cache\wheels\c1\58\70\ae51394acc9757707a51cb500efed79554e672e05d0d757199\jitcdde-1.4.0-py3-none-any.whl
Requirement already satisfied: sympy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.6)
Collecting symengine==0.4
Using cached symengine-0.4.0.tar.gz (86 kB)
Processing c:\users\nikolas\appdata\local\pip\cache\wheels\50\f6\d4\41c32b94ad836f824750f548f722e9480e5cc214e9e86700b9\jitcxde_common-1.4.1-py3-none-any.whl
Requirement already satisfied: numpy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.18.4)
Requirement already satisfied: mpmath>=0.19 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from sympy->timesynth) (1.1.0)
Requirement already satisfied: setuptools in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jitcxde-common==1.4.1->timesynth) (41.2.0)
Requirement already satisfied: jinja2 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jitcxde-common==1.4.1->timesynth) (2.11.2)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jinja2->jitcxde-common==1.4.1->timesynth) (1.1.1)
Building wheels for collected packages: symengine
Building wheel for symengine (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Nikolas\AppData\Local\Temp\pip-wheel-27wtbhe6'
cwd: C:\Users\Nikolas\AppData\Local\Temp\pip-install-j175yn1z\symengine\
Complete output (4 lines):
running bdist_wheel
running build
running build_ext
error: [WinError 2] Das System kann die angegebene Datei nicht finden
----------------------------------------
ERROR: Failed building wheel for symengine
Running setup.py clean for symengine
Failed to build symengine
Installing collected packages: symengine, jitcxde-common, jitcdde, timesynth
Running setup.py install for symengine ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nikolas\AppData\Local\Temp\pip-record-dv3kb977\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Include\symengine'
cwd: C:\Users\Nikolas\AppData\Local\Temp\pip-install-j175yn1z\symengine\
Complete output (4 lines):
running install
running build
running build_ext
error: [WinError 2] Das System kann die angegebene Datei nicht finden
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-j175yn1z\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nikolas\AppData\Local\Temp\pip-record-dv3kb977\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Include\symengine' Check the logs for full command output.
(FYI: "Das System kann die angegebene Datei nicht finden" = System can't find the file specified)
I also tried installing each package required seperately. The problem seems to lie within the installation of the symengine-package. Eventhough installing it seperately using python -m pip install symengine seems to work just fine I'm still getting the following error afterwards when trying to install timesynth again:
PS C:\Users\Nikolas> python -m pip install symengine
Collecting symengine
Using cached symengine-0.6.1-cp38-cp38-win_amd64.whl (10.0 MB)
Installing collected packages: symengine
Successfully installed symengine-0.6.1
PS C:\Users\Nikolas> python -m pip install timesynth
Collecting timesynth
Using cached timesynth-0.2.4-py3-none-any.whl (15 kB)
Requirement already satisfied: numpy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.18.4)
Requirement already satisfied: sympy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.6)
Processing c:\users\nikolas\appdata\local\pip\cache\wheels\c1\58\70\ae51394acc9757707a51cb500efed79554e672e05d0d757199\jitcdde-1.4.0-py3-none-any.whl
Requirement already satisfied: scipy in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from timesynth) (1.4.1)
Processing c:\users\nikolas\appdata\local\pip\cache\wheels\50\f6\d4\41c32b94ad836f824750f548f722e9480e5cc214e9e86700b9\jitcxde_common-1.4.1-py3-none-any.whl
Collecting symengine==0.4
Using cached symengine-0.4.0.tar.gz (86 kB)
Requirement already satisfied: mpmath>=0.19 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from sympy->timesynth) (1.1.0)
Requirement already satisfied: jinja2 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jitcxde-common==1.4.1->timesynth) (2.11.2)
Requirement already satisfied: setuptools in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jitcxde-common==1.4.1->timesynth) (41.2.0)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages (from jinja2->jitcxde-common==1.4.1->timesynth) (1.1.1)
Building wheels for collected packages: symengine
Building wheel for symengine (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Nikolas\AppData\Local\Temp\pip-wheel-fga4zb0o'
cwd: C:\Users\Nikolas\AppData\Local\Temp\pip-install-e44hvbbs\symengine\
Complete output (4 lines):
running bdist_wheel
running build
running build_ext
error: [WinError 2] Das System kann die angegebene Datei nicht finden
----------------------------------------
ERROR: Failed building wheel for symengine
Running setup.py clean for symengine
Failed to build symengine
Installing collected packages: symengine, jitcxde-common, jitcdde, timesynth
Attempting uninstall: symengine
Found existing installation: symengine 0.6.1
Uninstalling symengine-0.6.1:
Successfully uninstalled symengine-0.6.1
Running setup.py install for symengine ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nikolas\AppData\Local\Temp\pip-record-_x2a1o68\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Include\symengine'
cwd: C:\Users\Nikolas\AppData\Local\Temp\pip-install-e44hvbbs\symengine\
Complete output (4 lines):
running install
running build
running build_ext
error: [WinError 2] Das System kann die angegebene Datei nicht finden
----------------------------------------
Rolling back uninstall of symengine
Moving to c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages\symengine-0.6.1.dist-info\
from C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Lib\site-packages\~ymengine-0.6.1.dist-info
Moving to c:\users\nikolas\appdata\local\programs\python\python38\lib\site-packages\symengine\
from C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Lib\site-packages\~ymengine
ERROR: Command errored out with exit status 1: 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nikolas\\AppData\\Local\\Temp\\pip-install-e44hvbbs\\symengine\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nikolas\AppData\Local\Temp\pip-record-_x2a1o68\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nikolas\AppData\Local\Programs\Python\Python38\Include\symengine' Check the logs for full command output.
My OS is Win10 (64-Bit)
My Python Version is 3.8.3 (64-Bit)
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.