Skip to main content

Library for analysis and visualization of chaotic systems

Project description

decochators is a library to facilitate the study (visualization and analysis) of chaotic systems focused on application in CBE (Chaos-Based-Encryption) algorithms.

Structure

Class chaoticMap
│ 
├── Inherited class mth (Analysis)
│ 	│ 
│   ├── func Lyapunov
│   ├── func Kolmogorov-Sinai
│   └── func Test 0-1 (Binarized!!!)
│
└── Inherited class vwr (Visualization)
	│ 
    ├── func Draw
    ├── func Bifurcation
    └── func Test 0-1

Supported Python Versions

  • Python 3.11+

Supported Chaos Systems

  • One-dimensional
  • Three-dimensional
    • Continuous dynamic systems
    • Discrete over time

Installing

Install or upgrade the Python bindings with pip <https://pip.pypa.io/>.

Latest official release:

pip install -U decochators

Specific version (not recommended for versions lower than 1.1.0):

pip install -U decochators==N.N.NxN

Latest official release from TestPypi:

pip install -i https://test.pypi.org/simple/ decochators

Specific version from TestPypi:

pip install -i https://test.pypi.org/simple/ decochators==N.N.NxN

Where $N \in \mathbb{Z}$ and $x \in {a, b, c, \dots, z}$, example: 1.0.4a0.

Note: you should consider using a virtual environment to create an isolated Python environment for installation.

Testing Binary Chaos Test 0-1

Important for versions lower than decochators1.1.0, mth.test01 is a binarized modified test, be careful comparing or testing complex systems.

from decochators import attach_chaos_tests
import numpy as np

@attach_chaos_tests("1d")
def logistic_step(x: float, r: float = 4.0) -> float:
    return r * x * (1 - x)

serie = logistic_step(0.1, r=3.9, N=1000, burn_in=100, seed=42)
k01 = logistic_step.mth.test01(0.1, r=3.9)

print("Results with burn-in & seed:")
print(f"Test 0-1 with the serie binarized: {k01}")

k01_vwr=logistic_step.vwr.test01(
    logistic_step.__wrapped__,
    x0=0.1,
    N=1000,
    burn_in=100,
    r=3.9
),

print(f"Complete Test 0-1: {k01_vwr}")

Calling other 1 Dimensions functions

With the same chaotic system than before:

def logistic_step(x: float, r: float = 4.0) -> float:
    return r * x * (1 - x)

Generating series

logistic_step(0.1, r=3.9, N=1000, burn_in=100, seed=42)

Lyapunov Exponent Analysis

logistic_step.mth.lyapunov(0.1, r=3.9)

Kolmorogov-Sinai Analysis

logistic_step.mth.ks(0.1, r=3.9)

Chaotic Draw Visualization

logistic_step.vwr.draw(logistic_step.__wrapped__, x0=0.3, N=250000, burn_in=100, r=4.0)

Bifurcation System Visualization

import numpy as np

param_range = np.linspace(2.5, 4.0, 300)
logistic_step.vwr.bifurcation(logistic_step.__wrapped__, x0=0.1, param_name="r", param_range=param_range, N=5000, burn_in=200, last_points=50)

Calling 3 Dimensions functions

Chaotic System sample:

def rossler_step(xyz: np.ndarray, a: float = 0.2, b: float = 0.2, c: float = 5.7) -> np.ndarray:
    x, y, z = xyz
    dt = 0.01
    dx = -y - z
    dy = x + a*y
    dz = b + z*(x - c)
    return np.array([x + dx*dt, y + dy*dt, z + dz*dt])

Lyapunov Exponent Analysis

rossler_step.mth.lyapunov([0.1,0,0])

Kolmorogov-Sinai Analysis

rossler_step.mth.ks([0.1,0,0])

Binary Test Analysis

As in 1 Dimension, 3D mth.test01 is in base of a binarized test in lower than decochatorsv1.1.0, be careful.

rossler_step.mth.test01([0.1,0,0])

Chaotic Draw Visualization

rossler_step.vwr.draw(rossler_step.__wrapped__, [0.1, 0.0, 0.0], N=10000, burn_in=500, a=0.2, b=0.2, c=5.7)

Bifurcation System Visualization

import numpy as np

rossler_step.vwr.bifurcation(
    step_func=rossler_step,
    xyz0=[0.1,0.0,0.0],
    param_name='c',
    param_range=np.linspace(4, 6, 200),
    coord=2,      # Project on Cord Z | 0=X;1=Y;2=Z
    N=2000,
    burn_in=500
)

Binary Tests Visualization

On the other hand, vwr.test01 is the completed binary test, without binarization.

rossler_step.vwr.test01(rossler_step.__wrapped__, [0.1,0.0,0.0], N=5000, burn_in=100)

For further explication: https://yoshlsec.github.io/cbe-blogs/ For source code: https://github.com/yoshlsec/decochators

I hope its useful, first public python module for you all ;)

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

decochators-1.0.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

decochators-1.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file decochators-1.0.5.tar.gz.

File metadata

  • Download URL: decochators-1.0.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for decochators-1.0.5.tar.gz
Algorithm Hash digest
SHA256 8a4d308bfb65aa58776b037de4c487a59142e2d8b433097035a3969a176c7793
MD5 d5c7ff5f7a29ac500b51d4fa469b1ace
BLAKE2b-256 d34c76a97edad548751d607435d4dd418cb6f3fb2f6d7c8c881b1b34b2e592be

See more details on using hashes here.

File details

Details for the file decochators-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: decochators-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for decochators-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 58db295eba6a3e3d072b183532269d3c4438747a341a0ed02dafd70a74c5b5aa
MD5 2bf1cc007e96d221c1d9e1ade94ff035
BLAKE2b-256 179498daed50eefd584c340560dfeb28748b43e26969ff8ad2976cf106d00245

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