Skip to main content

Awesome cellular automata created by Borja Esteban

Project description

ndAutomata

codecov CI

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=[100])
ca = Automaton(ic, rule)

Note the shape of the rule must always be [states] * neighbours.size.

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.

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

ndautomata-0.1.1.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

ndautomata-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file ndautomata-0.1.1.tar.gz.

File metadata

  • Download URL: ndautomata-0.1.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for ndautomata-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00e64a71875e171731ac12c8e46f3477daec28eb04827154ab5e9d6f286f80d5
MD5 e3ec8b02aeddbd57db85c962d4069af3
BLAKE2b-256 cc391807787bcea59e73c4ebc860300b6fd9297382479d54915095c6e237a0a8

See more details on using hashes here.

File details

Details for the file ndautomata-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ndautomata-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for ndautomata-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3180faf26a4a2ea4634f76f86ad730f3408c508804cb569f9313e5e465a4ac49
MD5 a94811bd7c58be25e282de33b1ba7368
BLAKE2b-256 73fcb4b219f401fb18e2ba6d0989caf0ca527e4c891ce984113c0eb8df6b5c7a

See more details on using hashes here.

Supported by

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