Skip to main content

SpKit: Signal Processing toolkit

Project description

Signal Processing toolkit

Github

PyPi - project

Information Theory functions

  • Entropy : Shannon entropy, Rényi entropy of order α, Collision entropy
  • Joint entropy
  • Conditional entropy
  • Mutual Information
  • Cross entropy
  • Kullback–Leibler divergence
  • Computation of optimal bin size for histogram using FD-rule
  • Plot histogram with optimal bin size

Continuase Wavelet Transform and other functions comming soon..

Requirement :

['numpy','matplotlib']

Installation

with pip

pip install spkit

Build from the source

Download the repository or clone it with git, after cd in directory build it from source with

python setup.py install

Example - Information Theory

import numpy as np
import matplotlib.pyplot as plt
import spkit as sp

x = np.random.rand(10000)
y = np.random.randn(10000)

#Shannan entropy
H_x= sp.entropy(x,alpha=1)
H_y= sp.entropy(y,alpha=1)

#Rényi entropy
Hr_x= sp.entropy(x,alpha=2)
Hr_y= sp.entropy(y,alpha=2)

H_xy= sp.entropy_joint(x,y)

H_x1y= sp.entropy_cond(x,y)
H_y1x= sp.entropy_cond(y,x)

I_xy = sp.mutual_Info(x,y)

H_xy_cross= sp.entropy_cross(x,y)

D_xy= sp.entropy_kld(x,y)


print('Shannan entropy')
print('Entropy of x: H(x) = ',H_x)
print('Entropy of y: H(y) = ',H_y)
print('-')
print('Rényi entropy')
print('Entropy of x: H(x) = ',Hr_x)
print('Entropy of y: H(y) = ',Hr_y)
print('-')
print('Mutual Information I(x,y) = ',I_xy)
print('Joint Entropy H(x,y) = ',H_xy)
print('Conditional Entropy of : H(x|y) = ',H_x1y)
print('Conditional Entropy of : H(y|x) = ',H_y1x)
print('-')
print('Cross Entropy of : H(x,y) = :',H_xy_cross)
print('Kullback–Leibler divergence : Dkl(x,y) = :',D_xy)



plt.figure(figsize=(12,5))
plt.subplot(121)
sp.HistPlot(x,show=False)

plt.subplot(122)
sp.HistPlot(y,show=False)
plt.show()

Contacts:

PhD Student: Queen Mary University of London & University of Genoa


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spkit-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spkit-0.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file spkit-0.0.1.tar.gz.

File metadata

  • Download URL: spkit-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for spkit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0358481c1cab6397259a3a61538ed68e035a42118df251e2fc6413b21f0088f6
MD5 b645a910e24112130d070cc8bcfa1a37
BLAKE2b-256 59acd1234d4a8ca25c97908397862b8011de22db69b3cb117178612942b56417

See more details on using hashes here.

File details

Details for the file spkit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spkit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for spkit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e22957366f0a9e0d437e9b8cb9e9cf60cc8adab64dd0ad4ca30cfce43638437
MD5 123d3f3809bfa9d2833b7272189f2675
BLAKE2b-256 d2d0ddeb220bed5be093655cc8472aea746788d8cb53177447633b1a296ed625

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page