#input_pol_2.set_mapping_constraint({'x':1,'y':0})                   # this is where the sensor is going to be actually mapped in the NN

subsampled = p.Population(
    subsample_size * subsample_size,  # size
    p.IF_curr_exp,  # Neuron Type
    cell_params_subsample,  # Neuron Parameters
    label="Input")  # Label
subsampled.initialize('v', -75)

subsampled.set_mapping_constraint({'x': 0, 'y': 1})
#subsampled.record()     # sends spikes to the visualiser (use parameters = 32)

p1_up = p.Projection(input_pol_1_up,
                     subsampled,
                     p.FromListConnector(
                         retina_lib.subSamplerConnector2D(
                             128, subsample_size, .2, 1)),
                     label='subsampling projection')
p1_down = p.Projection(input_pol_1_down,
                       subsampled,
                       p.FromListConnector(
                           retina_lib.subSamplerConnector2D(
                               128, subsample_size, .2, 1)),
                       label='subsampling projection')
p2_up = p.Projection(input_pol_2_up,
                     subsampled,
                     p.FromListConnector(
                         retina_lib.subSamplerConnector2D(
                             128, subsample_size, .2, 1)),
                     label='subsampling projection')
p2_down = p.Projection(input_pol_2_down,
                       subsampled,
                                'connected_chip_coords':connected_chip_coords,
                                'connected_chip_edge':link,
                                'unique_id': 'R',
                                "polarity": p.ExternalRetinaDevice.DOWN_POLARITY},
                               label='input_pol_1down')

subsampled = p.Population(subsample_size*subsample_size,         # size
                          p.IF_curr_exp,   # Neuron Type
                          cell_params,   # Neuron Parameters
                          label="Input") # Label
subsampled.initialize('v', -75)

subsampled.set_mapping_constraint({'x':0,'y':1})
#subsampled.record()     # sends spikes to the visualiser (use parameters = 32)

list_input = retina_lib.subSamplerConnector2D(128,subsample_size,.2,1)
#print "input list is :"
#print list_input

p1_up = p.Projection(input_pol_1_up,
                  subsampled,
                  p.FromListConnector(list_input),
                  label='subsampling projection')

p2_down = p.Projection(input_pol_1_down,
                  subsampled,
                  p.FromListConnector(list_input),
                  label='subsampling projection')

p.run(runtime)              # Simulation time
p.end()
        "virtual_chip_coords": virtual_chip_coords,
        "connected_chip_coords": connected_chip_coords,
        "connected_chip_edge": link,
        "unique_id": "R",
        "polarity": p.ExternalRetinaDevice.DOWN_POLARITY,
    },
    label="input_pol_1down",
)

subsampled = p.Population(
    subsample_size * subsample_size,  # size
    p.IF_curr_exp,  # Neuron Type
    cell_params,  # Neuron Parameters
    label="Input",
)  # Label
subsampled.initialize("v", -75)

subsampled.set_mapping_constraint({"x": 0, "y": 1})
# subsampled.record()     # sends spikes to the visualiser (use parameters = 32)

list_input = retina_lib.subSamplerConnector2D(128, subsample_size, 0.2, 1)
# print "input list is :"
# print list_input

p1_up = p.Projection(input_pol_1_up, subsampled, p.FromListConnector(list_input), label="subsampling projection")

p2_down = p.Projection(input_pol_1_down, subsampled, p.FromListConnector(list_input), label="subsampling projection")

p.run(runtime)  # Simulation time
p.end()
Example #4
0
# # FPGA Retina - Up Polarity
# retina_pop = p.Population(
#     None, q.ExternalFPGARetinaDevice, get_updated_params({
#         'retina_key': 0x5,
#         'mode': q.ExternalFPGARetinaDevice.MODE_128,
#         'polarity': q.ExternalFPGARetinaDevice.UP_POLARITY}),
#     label='External retina')

# FPGA Retina - Down Polarity
retina_pop = p.Population(
    None,
    p.external_devices.ExternalFPGARetinaDevice,
    get_updated_params({
        'retina_key':
        0x5,
        'mode':
        p.external_devices.ExternalFPGARetinaDevice.MODE_128,
        'polarity':
        p.external_devices.ExternalFPGARetinaDevice.DOWN_POLARITY
    }),
    label='External retina')

population = p.Population(1024, p.IF_curr_exp, {}, label='pop_1')
p.Projection(
    retina_pop, population,
    p.FromListConnector(retina_lib.subSamplerConnector2D(128, 32, 2.0, 1)))

# q.activate_live_output_for(population)
p.run(100)
p.end()
#     label='External retina')

# # FPGA Retina - Merged Polarity
# retina_pop = p.Population(
#     None, q.ExternalFPGARetinaDevice, get_updated_params({
#         'mode': q.ExternalFPGARetinaDevice.MODE_128,
#         'polarity': q.ExternalFPGARetinaDevice.MERGED_POLARITY}),
#     label='External retina')

# # FPGA Retina - Up Polarity
# retina_pop = p.Population(
#     None, q.ExternalFPGARetinaDevice, get_updated_params({
#         'mode': q.ExternalFPGARetinaDevice.MODE_128,
#         'polarity': q.ExternalFPGARetinaDevice.UP_POLARITY}),
#     label='External retina')

# FPGA Retina - Down Polarity
retina_pop = p.Population(
    None, q.ExternalFPGARetinaDevice, get_updated_params({
        'mode': q.ExternalFPGARetinaDevice.MODE_128,
        'polarity': q.ExternalFPGARetinaDevice.DOWN_POLARITY}),
    label='External retina')

population = p.Population(1024, p.IF_curr_exp, {}, label='pop_1')
p.Projection(retina_pop, population,
             p.FromListConnector(retina_lib.subSamplerConnector2D(
                 128, 32, 2.0, 1)))

q.activate_live_output_for(population)
p.run(1000)