Giter VIP home page Giter VIP logo

nolitsa's Introduction

NoLiTSA

NoLiTSA (NonLinear Time Series Analysis) is a Python module implementing several standard algorithms used in nonlinear time series analysis.

CI

Features

  • Estimation of embedding delay using autocorrelation, delayed mutual information, and reconstruction expansion.
  • Embedding dimension estimation using false nearest neighbors and averaged false neighbors.
  • Computation of correlation sum and correlation dimension from both scalar and vector time series.
  • Estimation of the maximal Lyapunov exponent from both scalar and vector time series.
  • Generation of FT, AAFT, and IAAFT surrogates from a scalar time series.
  • Simple noise reduction scheme for filtering deterministic time series.
  • Miscellaneous functions for end point correction, stationarity check, fast near neighbor search, etc.

Installation

NoLiTSA can be installed via

pip install git+https://github.com/manu-mannattil/nolitsa.git

NoLiTSA requires NumPy, SciPy, and Numba.

Tests

NoLiTSA’s unit tests can be executed by running pytest.

Publications

Versions of NoLiTSA were used in the following publications:

  • M. Mannattil, H. Gupta, and S. Chakraborty, “Revisiting Evidence of Chaos in X-ray Light Curves: The Case of GRS 1915+105,” Astrophys. J. 833, 208 (2016).

  • M. Mannattil, A. Pandey, M. K. Verma, and S. Chakraborty, “On the applicability of low-dimensional models for convective flow reversals at extreme Prandtl numbers,” Eur. Phys. J. B 90, 259 (2017).

Acknowledgments

Sagar Chakraborty is thanked for several critical discussions.

License

NoLiTSA is licensed under the 3-clause BSD license. See the file LICENSE for more details.

nolitsa's People

Contributors

lee-jun-hyuk-37 avatar manu-mannattil avatar zurga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nolitsa's Issues

How we calculate the 'accepted' value about max Lyapunov exponent?

Hi,
In the folder named lyapunov(pwd : nolitsa/examples/lyapunov/), you have shown some cases about how to calculate max Lyapunov exponent. Although it is obviously that the "accepted" value, well, I mean, the slope of the line is quite close to the estimate values we get here, how we calculate this "accepted" value?
I guess we should we calculate this "accepted" value by the least square method. However, it seems that many later estimate values we get are meaningless but will affect the "accepted" value.

d2 errors

Thanks for all the examples, it's really helpful in learning this.
There's an error in the d2 examples:

import numpy as np
import matplotlib.pyplot as plt
from nolitsa import d2, utils

t = np.linspace(0, 100 * np.pi, 5000)
x = np.sin(t) + np.sin(2 * t) + np.sin(3 * t) + np.sin(5 * t)
x = utils.corrupt(x, np.random.normal(size=5000), snr=1000)

# Time delay.
tau = 25

window = 100

# Embedding dimension.
dim = np.arange(1, 10)

plt.title('Local $D_2$ vs $r$ for a noisy closed curve')
plt.xlabel(r'Distance $r$')
plt.ylabel(r'Local $D_2$')

for r, c in d2.c2_embed(x, tau=tau, dim=dim, window=window):
    plt.semilogx(r[3:-3], d2.d2(r, c), color='#4682B4')

plt.plot(r[3:-3], np.ones(len(r) - 6), color='#000000')
plt.show()
Traceback (most recent call last):

  Cell In[206], line 28
    for r, c in d2.c2_embed(x, tau=tau, dim=dim, window=window):

  File ~\anaconda3\envs\pysindy\Lib\site-packages\nolitsa\d2.py:148 in c2_embed
    return utils.parallel_map(c2, yy, kwargs={

  File ~\anaconda3\envs\pysindy\Lib\site-packages\nolitsa\utils.py:254 in parallel_map
    return np.asarray([result.get() for result in results])

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (9, 2) + inhomogeneous part.

The first 3 I tried all did this

Error in fnn test

I wrote a fnn test:

tau=3
x = np.linspace(0, 10, 1000)
dim = np.arange(1, max_dim)
f1, f2, f3 = dimension.fnn(x, tau=tau, dim=dim)
print(f1)

Program doesn't reach print(f1), instead gives the following error after getting stuck for several seconds:

File "C:\Users\Carlos\PycharmProjects\parkinson.venv\Lib\site-packages\nolitsa\dimension.py", line 187, in fnn
r = utils.parallel_map(_fnn, dim, (x,), {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\PycharmProjects\parkinson.venv\Lib\site-packages\nolitsa\utils.py", line 247, in parallel_map
pool = Pool(processes=processes)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 215, in init
self._repopulate_pool()
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 329, in _repopulate_pool_static
w.start()
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\context.py", line 337, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\popen_spawn_win32.py", line 45, in init
prep_data = spawn.get_preparation_data(process_obj._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 164, in get_preparation_data
_check_not_importing_main()
File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 140, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

    To fix this issue, refer to the "Safe importing of main module"
    section in https://docs.python.org/3/library/multiprocessing.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.