Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to use a neighborhood of size 4 (r=1.5) #31

Open
dimoralesb opened this issue Apr 22, 2022 · 2 comments
Open

Error when trying to use a neighborhood of size 4 (r=1.5) #31

dimoralesb opened this issue Apr 22, 2022 · 2 comments

Comments

@dimoralesb
Copy link

dimoralesb commented Apr 22, 2022

Hi, I am trying to test the evolution of the automaton with a neighborhood of size 4 given by r=1.5, but I get the following error:

TypeError: slice indices must be integers or None or have an __index__ method

This is the code to reproduce it:

cellular_automaton = cpl.init_random(8)
rule_number = 73
cellular_automaton = cpl.evolve(cellular_automaton, timesteps = 6,
                                apply_rule = lambda n, c, t: cpl.binary_rule(n, rule_number, scheme='nks'),  r = 1.5)
print(cellular_automaton)

Attached is also an image of the error:

image

@lantunes
Copy link
Owner

lantunes commented Apr 22, 2022

Hi,
The radius must be a whole number. CellPyLib doesn't support a radius like 1.5. The neighbourhood size will be 2r+1. So supported neighbourhood sizes are 3 (r=1), 5 (r=2), etc.

@dimoralesb
Copy link
Author

Thanks for your reply. Perhaps this could be implemented for future library updates.

I will try to find a way to evolve the automaton with a neighborhood of size 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants