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
│   └── func Binarized Test 0-1
│
└── 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(logistic_step.__wrapped__,x0=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)

Binary Test Analysis

logistic_step.mth.test01(logistic_step.__wrapped__, x0=0.1, r=3.9)

Binarized Test 0-1 Analysis

logistic_step.mth.btest01(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)

Binary Test Visualization

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

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(rossler_step.__wrapped__, xyz0=[0.1,0,0], N=5000, burn_in=100)

Binarized Test 0-1 Analysis

rossler_step.mth.btest01(xyz0=[0.1,0,0], N=5000, burn_in=100)

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

rossler_step.vwr.test01(rossler_step.__wrapped__, xyz0=[0.1,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.1.0.tar.gz (9.5 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.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for decochators-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9c924df1ef8a248392e6ae9a42600ed171198eadb339c50d63979fd369f79988
MD5 0fa1df20717a88847c0df53aa6529bd4
BLAKE2b-256 b87e6c28b563c437f87bbee770aa77c787ac4f048686da6ae8db992506cfc08b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: decochators-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bff529afc4cc900146052735b322fdef44af279c40adbaa69c2165a3427be1c9
MD5 5eb90310c7c4eaff4c98ae2398d21ea5
BLAKE2b-256 56bd163ee49cb91127b9f81d385e352384a6e5be81375a119ba82474425da56c

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