def plot_and_save(self):
     if create_raster_plot and sim.rank() == 0 :
         # Numbers of neurons from which spikes were recorded
         n_rec = [[0] * n_pops_per_layer] * n_layers
         for layer, i in layers.items() :
             for pop, j in pops.items() :
                 if record_fraction:
                     n_rec[i][j] = round(N_full[layer][pop] * N_scaling * frac_record_spikes)
                 else:
                     n_rec[i][j] = n_record
         plotting.show_raster_bars(raster_t_min, raster_t_max, n_rec,
                                   frac_to_plot, system_params['output_path'] + '/')
Esempio n. 2
0
        spikes =  n.pops[layer][pop].get_data('spikes', gather=False)
        for segment in spikes.segments :
            io.write_segment(segment)
        if record_v :
            io = PyNNTextIO(filename=system_params['output_path'] \
                 + "/vm_" + layer + '_' + pop + '_' + str(sim.rank()) + ".txt")
            vm =  n.pops[layer][pop].get_data('v', gather=False)
            for segment in vm.segments :
                try :
                    io.write_segment(segment)
                except AssertionError :
                    pass


end_writing = time.time()
print("Writing data took %g s" % (end_writing - start_writing,))

if create_raster_plot and sim.rank()==0 :
    # Numbers of neurons from which spikes were recorded
    n_rec = [[0]*n_pops_per_layer]*n_layers
    for layer, i in layers.items() :
        for pop, j in pops.items() :
            if record_fraction:
                n_rec[i][j] = round(N_full[layer][pop]*N_scaling*frac_record_spikes)
            else:
                n_rec[i][j] = n_record
    plotting.show_raster_bars(raster_t_min, raster_t_max, n_rec, frac_to_plot, \
        system_params['output_path'] + '/')

sim.end()
Esempio n. 3
0
            tt = numpy.array([t*sim.get_time_step()/1000. for t in range(len(analogsignal.transpose()[0]))])
            times_vm_a.append(tt)
            for i in range(len(source_ids)):
                glob_id = source_ids[i]
                index_in_pop = n.pops[layer][pop].id_to_index(glob_id)
                #print("Writing data for cell %i = %s[%s] (gid: %i) to %s "%(i, pop,index_in_pop, glob_id, filename))
                vm = analogsignal.transpose()[i]
                times_vm_a.append(vm/1000.)

            times_vm = numpy.array(times_vm_a).transpose()
            numpy.savetxt(filename, times_vm , delimiter = '\t', fmt='%s')


end_writing = time.time()
print("Writing data took %g s" % (end_writing - start_writing,))

if create_raster_plot and sim.rank() == 0 :
    # Numbers of neurons from which spikes were recorded
    n_rec = [[0] * n_pops_per_layer for i in range(n_layers)]
    for layer, i in layers.items() :
        for pop, j in pops.items() :
            if record_fraction:
                n_rec[i][j] = round(N_full[layer][pop] * N_scaling * frac_record_spikes)
            else:
                n_rec[i][j] = n_record
    if n_rec > 0:
        plotting.show_raster_bars(raster_t_min, raster_t_max, n_rec, frac_to_plot,
                              system_params['output_path'] + '/', N_scaling, K_scaling)

sim.end()