def acquire(self, spike: Spike, act: IActivation): result = False # update causal group set to account for merges self._allowed_causal_groups = set( cg for cg in self._allowed_causal_groups) for si in self._signals: if spike.causal_group() in self._allowed_causal_groups: # the causal group is already allowed result |= si.acquire(spike, act) elif not si.completed_by: if si.acquire(spike, act): # add causal group to allowed, since the spike is a root cause self._allowed_causal_groups.add(spike.causal_group()) result = True return result
def acquire(self, spike: Spike, act: IActivation): if not self.spike and self.name == spike.name() and ( self.max_age < 0 or spike.age() <= act.secs_to_ticks(self.max_age)): assert not spike.is_wiped() self._min_age_ticks = act.secs_to_ticks(self.min_age) self.spike = spike with spike.causal_group() as cg: cg.acquired(spike, act, self.detached) return True return False
def acquire(self, spike: Spike, act: IActivation): if not self.spike and self.id() == spike.id() and ( self.max_age_value < 0 or spike.age() <= act.secs_to_ticks(self.max_age_value)): assert not spike.is_wiped() with spike.causal_group() as cg: # Causal group might refuse acquisition, if one of act's state's write-props is unavailable. if not cg.acquired(spike, act, self.detached_value): return False self.spike = spike self._min_age_ticks = act.secs_to_ticks(self.min_age_value) return True return False