def test_array_operators(self): from pyhalbe import HICANN from pyhalco_common import Enum import pyhalco_hicann_v2 as Coordinate quad = HICANN.NeuronQuad() neuron = HICANN.Neuron() neuron.enable_aout(True) quad[Coordinate.NeuronOnQuad(Enum(0))] = neuron self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(0))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(1))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(2))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(3))].enable_aout()) quad[Coordinate.NeuronOnQuad(Enum(1))].enable_aout(True) self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(0))].enable_aout()) self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(1))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(2))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(3))].enable_aout()) x = quad[Coordinate.NeuronOnQuad(Enum(2))] x.enable_aout(True) self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(0))].enable_aout()) self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(1))].enable_aout()) self.assertTrue(quad[Coordinate.NeuronOnQuad(Enum(2))].enable_aout()) self.assertFalse(quad[Coordinate.NeuronOnQuad(Enum(3))].enable_aout())
def set_denmem_quads(self, neuron, **kwargs): nquad = HICANN.NeuronQuad() for qq in range(Coordinate.QuadOnHICANN.end): HICANN.set_denmem_quad(self.h, Coordinate.QuadOnHICANN(qq), nquad) # All other neurons keep the default values nactive = nquad[neuron.toNeuronOnQuad()] for key, value in kwargs.iteritems(): getattr(nactive, key)(value) HICANN.set_denmem_quad(self.h, neuron.toQuadrantOnHICANN(), nquad)