<jupyter_start><jupyter_text><jupyter_code>import scipy.ndimage 


kernel = [[1, 1, 1],[ 1 ,1, 1],[ 1, 1, 1]]  # define neighbors

kr=np.array(kernel)

kr

OR = np.logical_or
AND = np.logical_and


world=[
[0,0,0,0],
[0,1,0,0],
[0,1,0,0],
[0,1,0,0],
[0,0,0,0],
] # a blinker


a=np.array(world)

n=scipy.ndimage.convolve(a,kr)

n
birth = AND(  n>=bmin,  AND( n<=bmax, np.logical_not(a) )  )

birth
survi = AND(  n>=smin,  AND( n<=smax, a )  )

survi
a =  OR( birth , survi )  

a<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21611001964636542, 'fraction_numerical': 0.05697445972495088, 'mean_word_length': 4.204081632653061, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '332083', 'license': 'MIT', 'n_tokens_mistral': 285, 'n_tokens_neox': 268, 'n_words': 50, 'path': 'demo_1_CA_in_SciPy (2).ipynb', 'repo_name': 'martin12333/PyMartinCA', 'size': '509'}