예제 #1
0
def get_activity(Lamp, Ramp, plot=False):
    interpreter = lambda _: (specimen_architecture, 0, 0)
    net = ga.Specimen("",
                      Cells.STDP_Dopamine_Cell,
                      interpreter=interpreter,
                      num_of_regions=1)

    net.add_stim_gate_cell(gate_cells[0], [sensor_cells[0]])
    net.add_stim_gate_cell(gate_cells[1], [sensor_cells[1]])

    net.stimulate_gate_cell(gate_cells[0], Lamp, sim_time)
    net.stimulate_gate_cell(gate_cells[1], Ramp, sim_time)

    # Add gaussian noise to gate cells
    net.add_noise_to_cells(gate_cells,
                           mean=noise_mean,
                           stdev=noise_stdev,
                           gate_cell=True)

    # Setup spike recording for all cells
    net.setup_output_cells(net.cells_dict.keys())

    net.set_recording_vectors()

    # Run the simulation
    net.run(time=sim_time)

    spikes = net.get_out_spikes()

    return spikes, net.record_vectors_dict
예제 #2
0
    def create_from_DNA(self, DNA):
        # Assuming that DNA is string of binary digits
        self.net = ga.Specimen(DNA_str,
                               self.cell,
                               num_of_regions=self.num_of_regions,
                               logging=self.logging)

        self._init()  # finish initialization when we have network
예제 #3
0
    def create_from_architecture(self, architecture, dop, dopdr):

        print "\n\n\n\n\n\n\nCreating with cells:", self.cell

        self.architecture = architecture
        interpreter = lambda _: (architecture, dop, dopdr)
        self.net = ga.Specimen("",
                               self.cell,
                               interpreter=interpreter,
                               num_of_regions=self.num_of_regions,
                               logging=self.logging)
        self._init()  # finish initialization when we have network
예제 #4
0
            hist_data.append(
                ("x=%d id=%d" % (net.cells_dict[src_id].x, src_id),
                 len(spikes)))

    # TODO: CHECK IF THE FORCES AREN'T > 100
    trackL_force = val_map(trackL_spikes, 0, 16, 0, 100)
    trackR_force = val_map(trackR_spikes, 0, 16, 0, 100)

    return trackL_force, trackR_force, hist_data


# Initialize network
print "Initializing network"
interpreter = lambda _: (specimen_architecture, 0, 0)
net = ga.Specimen("",
                  Cells.STDP_Dopamine_Cell,
                  interpreter=interpreter,
                  num_of_regions=1)

net.add_stim_gate_cell(gate_cells[0], [sensor_cells[0]])
net.add_stim_gate_cell(gate_cells[1], [sensor_cells[1]])

# Add gaussian noise to gate cells
net.add_noise_to_cells(gate_cells,
                       mean=noise_mean,
                       stdev=noise_stdev,
                       gate_cell=True)

# Setup spike recording for all cells
net.setup_output_cells(net.cells_dict.keys())

print "Initializing brick communication"