Skip to content
Ashwin Karichannavar edited this page Sep 19, 2020 · 4 revisions

Characterizing Noise

pyFish

Package to analyse the characteristics of stochastic time series data.

How does it work

Suppose m(t) is a stochastic time series data, then the package calculates the deterministic and stochastic component of dm/dt.

The method of extracting the deterministic and stochastic and deterministic functions is based on the assumption that the noise is uncorrelated and Gaussian in nature.

The package extracts the noise from the data and checks to make sure the noise is Gaussian and uncorrelated in nature.

Motivation

This project is motivated by the study of group behaviour dynamics of animals, especially schooling fish. The sample data distributed along with this package is gathered from experiments conducted by TEElab, IISc.

Installation

python -m pip install git+https://github.com/ashwinkk23/pyFish.git

For developers: Clone the repo:

git clone https://github.com/ashwinkk23/pyFish.git
cd pyFish
python setup.py build
python setup.py develop

Usage

pyFish.Characterize(...)
Input params:
	data : list
		time series data to be analysed, data = [x] for scalar data and data = [x1, x2] for vector
		where x, x1 and x2 are of numpy.array object type
	t : numpy.array
		time stamp of time series
	t_int : float
		time increment between consecutive observations of the time series
	dt = 'auto' : 'auto' or int
		time scale to run the analysis on (for determinsitic part);
		algorithm estimates dt if 'auto' is passed, else takes the user input
	delta_t = 1 : int
		time scale to run the analysis on (for stochastic part)
	inc = 0.01 : float
		increment in order parameter for scalar data
	inc_x = 0.1 : float
		increment in order parameter for vector data x1
	inc_y = 0.1 : float
		increment in order parameter for vector data x2
	drift_order = None : int
		order of polynomial to be fit for calculated drift (deterministic part);
		if None, algorithim estimates the optimium drift_order
	diff_order = None : int
		order of polynomial to be fit for calculated diff (stochastic part);
		if None, algorithim estimates the optimium diff_order
	max_order = 10 : int
		maxmium drift_order and diff_order to consider
	fft = True : bool
		if true use fft method to calculate autocorrelation else, use standard method
	t_lag = 1000 : int
		maxmium lag to use to calculate acf
	**kwargs 
		All the parameters for pyFish.preporcessing and pyFish.noise_analysis

Usage Example

Example loading sample data and storing all data and plots.

# import modules
>>> import pyFish
>>> import pyFish.tests
# load data
>>> data = pyFish.tests.load_sample_data('data/ternary/N30.csv')
>>> X, t = data.T
# Analyse
>>> analysed_output = pyFish.Characterize([X],t)
Gaussian check for underlying noise: 100%|█| 10000/10000 [00:00<00:00, 14393.3]
# Save analysed data, plots, parameters to disk.
>>> analysed_output.save_all_data(savepath='ternary_n30')
Results saved in: ternary_n30/1600538555

The results will be saved in current/working/directory/ternary_n30/ folder For more information and examples, please refer to the Wiki page

Licence

Reference

  • Noise-induced Effects in Collective Dynamics and Inferring Local Interactions from Data
  • Noise-Induced Schooling of Fish
Clone this wiki locally