-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AR Model Sample fails #23
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import timesynth as ts
Initializing TimeSampler
time_sampler = ts.TimeSampler(stop_time=20)
Sampling regular time samples
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
The text was updated successfully, but these errors were encountered: