Skip to main content

mappy-ds

CI PyPI Python License: MIT

Poincaré maps, periodic points and bifurcations of hybrid (smooth / non-smooth) dynamical systems.

mappy_ds implements the mode concept: a dynamical system is split into smooth primitive pieces — modes — connected by transition rules. From the modes the package automatically builds the Poincaré map of the system as a composite diffeomorphism together with its Jacobian matrix and Hessian tensor, which feed periodic-point search, local bifurcation analysis and parameter continuation.

Y. Miino, "Mode concept to construct diffeomorphisms representing smooth/non-smooth dynamical systems", Nonlinear Theory and Its Applications, IEICE, 15(2), 284–298, 2024. doi:10.1587/nolta.15.284

Installation

pip install mappy-ds

Add the plot extra for the interactive matplotlib viewer:

pip install "mappy-ds[plot]"

Requires Python 3.11 or newer.

Quick start

The Izhikevich neuron model fires (jumps) when the membrane potential reaches v = 30. Describe the ODE, the border, the jump and the Poincaré section as modes and let the package build the map:

import numpy as np
from mappy_ds import (
    ContinuousMode,
    DiscreteMode,
    PoincareMap,
    border,
    mapping,
    vector_field,
)


@vector_field(dim=2)
def izhikevich(y, p):
    v, u = y
    return np.array([0.04 * v**2 + 5 * v + 140 - u + p["I"], p["a"] * (p["b"] * v - u)])


@border(dim=2)
def fire(y, _):
    return y[0] - 30


@mapping(2)
def firing(y, p):
    return y + np.array([p["c"] - 30, p["d"]])


@mapping(2, 1)
def reduce(y, _):  # section (v = 30) -> u
    return np.array([0, 1]) @ y


@mapping(1, 2)
def revert(u, _):  # u -> section (v = 30)
    return u * np.array([0, 1]) + np.array([30, 0])


pmap = PoincareMap(
    [
        ContinuousMode("A", izhikevich, borders=[fire]),
        DiscreteMode("B", firing),
        DiscreteMode("P", reduce),
        DiscreteMode("Pinv", revert),
    ],
    {"A": ["P"], "B": "A", "P": "Pinv", "Pinv": "B"},
    initial_mode="Pinv",
)

params = {"a": 0.2, "b": 0.2, "c": -50.0, "d": 2.0, "I": 10.0}
res = pmap.image_detail(-3.0, params, hessian=True)
print(res.y, res.jac, res.hes)  # [-3.47838] [[0.27080]] [[[-0.19326]]]
print(res.mode_history)  # ['Pinv', 'B', 'A', 'P', 'Pinv']

Find a fixed point and follow it while a parameter changes:

from mappy_ds.root import find_cycle, trace_cycle

fp = find_cycle(pmap, -4.5, {**params, "I": 8.0})
print(fp.y, fp.eigvals)  # [-4.64542] [0.22196+0.j]

branch = trace_cycle(
    pmap, fp.y, {**params, "I": 8.0}, "I", end_value=4.5, resolution=50
)

Smooth systems are a special case: a discrete map is a single mode (Diffeomorphism), and a periodically forced oscillator becomes autonomous by adding time as a state and resetting it on a section — see examples/.

Features

  • Modes: ContinuousMode (ODE integrated with SciPy until a border is hit) and DiscreteMode (a map), freely composed through transition rules.
  • Derivatives for free: system functions are traced once with SymPy; the Jacobian and Hessian of every mode map — including the correction for the state-dependent hitting time at a border — and of their composition are computed automatically.
  • mappy_ds.root: periodic points (find_cycle), local bifurcation points — tangent, period-doubling and Neimark–Sacker — (find_local_bf), and their parameter continuation (trace_cycle, trace_local_bf).
  • mappy_ds.plot: an interactive matplotlib viewer of trajectories and return maps with mouse / keyboard control of the initial state and parameters.

Documentation

https://yuu-miino.github.io/doc.mappy/latest/

Development

git clone https://github.com/Yuu-Miino/mappy.git
cd mappy
uv sync
uv run pytest

See CONTRIBUTING.md.

License

MIT — see LICENSE.

Metadata

Release files for mappy-ds 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mappy-ds 0.1.0
File Size Uploaded Provenance Actions
mappy_ds-0.1.0.tar.gz 53.1 kB With provenance Details for mappy_ds-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mappy-ds 0.1.0
File Interpreter ABI Platform Actions
mappy_ds-0.1.0-py3-none-any.whl Python 3 none any Details for mappy_ds-0.1.0-py3-none-any.whl

Total release size: 88.1 kB

Release files / mappy_ds-0.1.0.tar.gz

Download URL mappy_ds-0.1.0.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
35fddf5a3bbc27a59d20802b3aabc4042eded5407ddc286f5cca17da84190e43
BLAKE2b-256 checksum
How to use checksums
3ae6e8cd3b74fe9ded16207069ec9958bf11c2c4558aaf0e4a49242dc2dc9a1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / mappy_ds-0.1.0-py3-none-any.whl

Download URL mappy_ds-0.1.0-py3-none-any.whl
Size 35.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ee91674a91de60f14d86a9e73f628dd3c918f8bf65f06de953d5416a7bd8bbd
BLAKE2b-256 checksum
How to use checksums
b04f9fd27fbff927d79c77c88e12f093c66e49560d55ff0cb32903c148127573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for mappy-ds 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mappy_ds-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page