diff --git a/neuropercolation/automaton.py b/neuropercolation/automaton.py index 463ee7c..2b8f36d 100644 --- a/neuropercolation/automaton.py +++ b/neuropercolation/automaton.py @@ -194,7 +194,7 @@ class Neuropercolation(CellularAutomatonCreator, abc.ABC): new_state = evolution_rule(old.state.copy(), old_c.state.copy(), [n.state[0] for n in old.neighbors], coord[2], coord_c[2]) #inverse the inhibitory layer's action evolve_cell(old, new, new_state) - + def __evolve_cell(self, old, cell, new_state): changed = new_state != old.state cell.state = new_state @@ -221,6 +221,12 @@ class Neuropercolation(CellularAutomatonCreator, abc.ABC): new_cell_state = ALIVE return new_cell_state + def count_channels(self): + open_channels = [0,0] + for coord, old in zip(self._current_state.keys(), self._current_state.values()): + open_channels[coord[2]] += 1 if sum([n.state[0] for n in old.neighbors])==2 else 0 + return open_channels + class NeuropercolationCoupled(CellularAutomatonCreator, abc.ABC): def __init__(self, dim, eps, coupling=[], *args, **kwargs): @@ -299,3 +305,10 @@ class NeuropercolationCoupled(CellularAutomatonCreator, abc.ABC): else: new_cell_state = ALIVE return new_cell_state + + def count_channels(self): + open_channels = [[0,0],[0,0]] + for coord, old in zip(self._current_state.keys(), self._current_state.values()): + open_channels[coord[3]][coord[2]] += 1 if sum([n.state[0] for n in old.neighbors])==2 and coord[:2] in self.coupling else 0 + return open_channels + \ No newline at end of file