Awesome cellular automata library created by Borja Esteban.
Install it from PyPI
$ pip install ndautomata
Usage
This package is designed in order to create your own automata definitions based on 2 attributes:
- neighbours: List with relative indexes to cell neighbours.
- states: Number possible cell states.
from ndautomata import BaseAutomaton, neighbours
class Automaton(BaseAutomaton):
neighbours = neighbours.regular(ndim=1, r=1)
states = 2
Note the automata dimensions are defined with
neighbours.ndim.
After you have defined your automaton, you can instantiate automata passing the initial configuration and the rule to the constructor function. Use the module initializers, based on numpy to generate the required arrays passing the number of states and size.
from ndautomata import initializers
rule = initializers.random(states=2, size=[2, 2, 2])
ic = initializers.center(states=2, size=[200])
ca = Automaton(ic, rule)
Note the shape of the rule must always be
[states] * neighbours.size.
Plot the cellular automaton using matplotlib or your favorite tool.
import matplotlib.pyplot as plt
plt.rcParams["image.cmap"] = "binary"
plt.matshow([next(ca) for _ in range(100)])
plt.show()
See examples for more detailed use cases and examples on how to generate some plots.
Development
Fork the repository, pick one of the issues at the issues and create a Pull request.
Metadata
Release files for ndautomata 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ndautomata-1.0.5.tar.gz | 130.2 kB | Without provenance | Details for ndautomata-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ndautomata-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for ndautomata-1.0.5-py3-none-any.whl |
Total release size: 148.3 kB
Release files / ndautomata-1.0.5.tar.gz
| Download URL | ndautomata-1.0.5.tar.gz |
|---|---|
| Size | 130.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e2d57d5c1057bcf3091c370fd0fd25c0c621c32fe28d41498d10d1d85c4002e
|
|
BLAKE2b-256 checksum How to use checksums |
36f80e5465b720a11bcd701dbb80649bee94d3969392996cc8ae8d2fbf337e5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / ndautomata-1.0.5-py3-none-any.whl
| Download URL | ndautomata-1.0.5-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0091222b0608bb693b019f5b5a6d9cd60ef2caf3627c11d9eab241a2737f3b9c
|
|
BLAKE2b-256 checksum How to use checksums |
0ee3b2395bdd4f17f6fb65b7c62f42371b5d8fe79c3bac46b8e761b9d362cf09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for ndautomata 1.0.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.