예제 #1
0
 def test_hicann_configurator(self):
     marocco = PyMarocco()
     with self.assertRaises(TypeError):
         marocco.hicann_configurator
     import pysthal
     marocco.hicann_configurator = pysthal.HICANNConfigurator()
     self.assertTrue(
         isinstance(marocco.hicann_configurator,
                    pysthal.HICANNConfigurator))
예제 #2
0
 def run_experiment(self, time, cfg=None):
     if self.RUN:
         self.connect()
         if cfg is None:
             cfg = pysthal.HICANNConfigurator()
         self.w.configure(cfg)
         if time > 0.0:
             runner = pysthal.ExperimentRunner(time)
             self.w.start(runner)
예제 #3
0
def ESS_available():
    try:
        import pymarocco
        marocco = pymarocco.PyMarocco()
        marocco.backend = pymarocco.PyMarocco.ESS
        marocco.continue_despite_synapse_loss = True
        marocco.calib_backend = pymarocco.PyMarocco.CalibBackend.Default
        marocco.defects.backend = pymarocco.Defects.Backend.Without
        marocco.hicann_configurator = pysthal.HICANNConfigurator()

        pynn.setup(marocco=marocco)
        pynn.run(1.)
        return True
    except RuntimeError as err:
        if str(err) == "ESS not available (compile with ESS)":
            return False
        else:
            raise err
예제 #4
0
    def runTest(self):
        pylogging.reset()
        pylogging.default_config(pylogging.LogLevel.INFO)

        marocco = pymarocco.PyMarocco()
        marocco.neuron_placement.default_neuron_size(8)
        marocco.calib_backend = pymarocco.PyMarocco.CalibBackend.Default
        marocco.defects.backend = pymarocco.Defects.Backend.Without
        marocco.hicann_configurator = pysthal.HICANNConfigurator()
        marocco.continue_despite_synapse_loss = True
        marocco.backend = pymarocco.PyMarocco.ESS
        marocco.experiment_time_offset = 5e-7

        n_exc = 100  # Number of excitatory neurons per group

        sim_duration = 200.

        pp_start = 50.  # start = center of pulse-packet

        weight_exc = 0.002  # uS weight for excitatory to excitatory connections
        # (double than in reference paper)

        pynn.setup(
            max_delay=20.,
            marocco=marocco,
        )

        # v_thresh close to v_rest to make sure there are some spikes
        neuron_params = {
            'v_rest': -65.,
            'v_thresh': -62.5,
        }

        exc_pop = pynn.Population(n_exc, pynn.IF_cond_exp, neuron_params)
        exc_pop.record()
        pop_stim = pynn.Population(n_exc, pynn.SpikeSourceArray,
                                   {'spike_times': [pp_start]})
        conn = pynn.FixedNumberPreConnector(60, weights=weight_exc, delays=20.)
        pynn.Projection(pop_stim, exc_pop, conn, target='excitatory')

        pynn.run(sim_duration)
        pynn.end()
예제 #5
0
from pymarocco import PyMarocco, Defects
import pylogging
import pysthal

# configure logging
pylogging.reset()
pylogging.default_config(level=pylogging.LogLevel.INFO,
                         fname="logfile.txt",
                         dual=False)

# Mapping config
marocco = PyMarocco()
marocco.backend = PyMarocco.ESS  # choose Executable System Specification instead of real hardware
marocco.calib_backend = PyMarocco.CalibBackend.Default
marocco.defects.backend = Defects.Backend.None
marocco.hicann_configurator = pysthal.HICANNConfigurator()
marocco.experiment_time_offset = 5.e-7  # can be low for ESS, as no repeater locking required
marocco.neuron_placement.default_neuron_size(
    4)  # default number of hardware neuron circuits per pyNN neuron
marocco.persist = "nmpm1_adex_neuron_ess.bin"
marocco.param_trafo.use_big_capacitors = False

# set-up the simulator
pynn.setup(marocco=marocco)

neuron_count = 1  # size of the Population we will create

# Set the neuron model class
neuron_model = pynn.EIF_cond_exp_isfa_ista  # an Adaptive Exponential I&F Neuron

neuron_parameters = {
예제 #6
0
 def setUp(self, backend=PyMarocco.ESS):
     self.marocco = PyMarocco()
     self.marocco.backend = backend
     self.marocco.calib_backend = PyMarocco.CalibBackend.Default
     self.marocco.defects.backend = Defects.Backend.Without
     self.marocco.hicann_configurator = pysthal.HICANNConfigurator()
예제 #7
0
        self.config_dncmerger(h, hicann)
        self.config_background_generators(h, hicann)
        self.flush_hicann(h)
        self.lock_repeater(h, hicann)
        self.config_neuron_config(h, hicann)
        self.config_neuron_quads(h, hicann)
        self.config_analog_readout(h, hicann)
        self.flush_hicann(h)


#class FooConfigurator(pysthal.HICANNConfigurator):
#    def config(self, fpga, handle, data):
#        pyhalbe.HICANN.init(handle, False)
#	self.config_synapse_drivers(handle, data);

wafer.configure(pysthal.HICANNConfigurator())
#wafer.configure(NoneConfigurator())
#wafer.configure(FooConfigurator())

# Run experiment:
runner = pysthal.ExperimentRunner(duration)

# Setup ADC
recorder0 = hicann.analogRecorder(Coordinate.AnalogOnHICANN(0))
recorder0.activateTrigger(duration)

wafer.start(runner)

outdir_str = "in_addr_"+str(in_addr_int) + "_" + args.vertical

try:
예제 #8
0
    def test_cell_ids(self):
        """
        tests that [Population,PopulationView,Assembly].getSpikes() uses the
        expected cell ids, cf. issue #1955
        """

        import pymarocco

        marocco = pymarocco.PyMarocco()
        marocco.backend = pymarocco.PyMarocco.ESS
        marocco.experiment_time_offset = 5.e-7
        marocco.continue_despite_synapse_loss = True
        marocco.calib_backend = pymarocco.PyMarocco.CalibBackend.Default
        marocco.defects.backend = pymarocco.Defects.Backend.Without
        marocco.hicann_configurator = pysthal.HICANNConfigurator()

        setup_params = dict()
        if pynn.__name__ == "pyhmf":
            setup_params['marocco'] = marocco

        pynn.setup(**setup_params)

        # dummy target population
        p_dummy = pynn.Population(10, pynn.IF_cond_exp)

        # 1st Input Population
        p1 = pynn.Population(10, pynn.SpikeSourceArray)
        input_spikes1 = np.arange(1, 11., 1.).reshape(10, 1)
        for n, spikes in enumerate(input_spikes1):
            p1[n:n + 1].set('spike_times', spikes.tolist())

        # 2nd Input Population
        p2 = pynn.Population(10, pynn.SpikeSourceArray)
        input_spikes2 = np.arange(11., 21., 1.).reshape(10, 1)
        for n, spikes in enumerate(input_spikes2):
            p2[n:n + 1].set('spike_times', spikes.tolist())

        p1.record()
        p2.record()

        # dummy connections otherwise input populations are not mapped.
        pynn.Projection(p1, p_dummy, pynn.OneToOneConnector())
        pynn.Projection(p2, p_dummy, pynn.OneToOneConnector())

        pynn.run(25.)

        # check that cell ids refer to the index in the Population.
        s_p1 = p1.getSpikes()
        s_p1 = s_p1[np.argsort(s_p1[:, 1])]  # sort by time
        self.assertTrue(np.array_equal(list(range(10)), s_p1[:, 0]))

        s_p2 = p2.getSpikes()
        s_p2 = s_p2[np.argsort(s_p2[:, 1])]  # sort by time
        self.assertTrue(np.array_equal(list(range(10)), s_p2[:, 0]))

        # for PopulationViews we also expect the index in the parent Population
        self.assertEqual(set(p2[0:1].getSpikes()[:, 0]), set(range(1)))
        self.assertEqual(set(p2[1:3].getSpikes()[:, 0]), set(range(1, 3)))

        # In Assemblies, the cell id is equal to an offset given by the sum of
        # the Population sizes of the previous items (Population or
        # PopulationView), plus the index within in the Population.
        a = pynn.Assembly(p2[0:5], p1)
        s_a = a.getSpikes()
        # when sorted, ids should be: range(10,20) + range(5)
        s_a = s_a[np.argsort(s_a[:, 1])]  # sort by time
        self.assertTrue(
            np.array_equal(list(range(10, 20)) + list(range(5)), s_a[:, 0]))