A Python package for data analysis with multivariate permutation entropy
Project description
mpePy: A Python Package for Data Analysis with Multivariate Permutation Entropy for Time Series
mpepy is a pure Python module that implements data analysis methods based on Bandt and Pompe’s [1] symbolic encoding scheme.
mpepy implements the following data analysis methods:
Installing
mpePy can be installed via the command line using
pip install mpepy
or you can directly clone its git repository:
git clone https://github.com/marisamohr/mpePy.git
cd mpepy
pip install -e .
Basic usage
# Computing different multivariate permutation entropies for fractional Brownian motion.
import subprocess
import csv
import pandas as pd
import mpepy as mpe
# Example of data simulation: multivariate fractional Brownian motion
# usage of R-package
def simulateMultiFracBrownMotion(n, H_1, H_2, H_3, H_4, H_5, rho):
output_file_name = './intermediate_output/MultiFracBrownMotionOutput.csv'
subprocess.check_call(['Rscript', './intermediate_output/simulation_mfBm.R', str(n), str(H_1), str(H_2), str(H_3), str(H_4), str(H_5), str(rho), output_file_name], shell=False)
arr = []
with open(output_file_name, 'r') as file:
reader = csv.reader(file)
for row in reader:
arr.append(row)
mfbm = pd.DataFrame.from_records(arr)
mfbm = mfbm.apply(pd.to_numeric)
return mfbm
# simulation
mfbm = simulateMultiFracBrownMotion(2000, 0.3, 0.6, None, None, None, 0.0)
mfbm = mfbm.T
# Examples of multivariate permutation entropy calculation
mpe.pooled_permutation_entropy(mfbm, order = 3 , delay = 1)
mpe.multivariate_weighted_permutation_entropy(mfbm, order = 3 , delay = 1)
mpe.multivariate_multiscale_permutation_entropy(mfbm, order = 3 , delay = 1, scale = 1)
mpe.multivariate_ordinal_pattern_permutation_entropy(mfbm, order = 2 , delay = 1)
mpe.multivariate_permutation_entropy_pca(mfbm, order = 2 , delay = 1, no_pc = 1)
mpe.multivariate_permutation_entropy_pca(mfbm, order = 3 , delay = 5, no_pc = "all")
Contributors
Marisa Mohr(https://github.com/marisamohr)
Nils Finke(https://github.com/FinkeNils)
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mpePy-0.0.2.tar.gz
(3.4 kB
view hashes)
Built Distribution
mpePy-0.0.2-py3-none-any.whl
(3.5 kB
view hashes)