def plot_freqs(db_filename, point_color, label): """Plot mitral firing rate against network frequency.""" db = tables.openFile(db_filename) # Get the values and arrays attrs_list = (('results', 'spikes_it'), ('results', '_v_attrs', 'FFTMAX', 0), ('paramset', '_v_attrs', 'Common')) attrs = get_all_attrs(db, attrs_list) ps_common = attrs[0][2] n_mitral = ps_common['N_mitral'] simu_length = ps_common['simu_length'] burnin = ps_common['burnin'] # Compute the spiking rate for each simulation sim_values = np.ndarray((len(attrs), 2)) for ind_simu, simu in enumerate(attrs): spike_times = simu[0].read()[1] sim_values[ind_simu][0] = get_spiking_rate(spike_times, n_mitral, simu_length, burnin) sim_values[ind_simu][1] = simu[1] # FFTMAX already computed # Plot the values plt.plot(sim_values[:, 0], sim_values[:, 1], ' .', color=point_color, label=label) plt.legend() # Close the DB db.close()
def plot_netw_freq(db_filename, point_color, label): """Plot g_Ein0 against FFTMAX for the given DB.""" db = tables.openFile(db_filename) # Open the HDF5 database-like # Get the interesting values attrs_list = (('paramset', '_v_attrs', 'Input', 'g_Ein0'), ('results', '_v_attrs', 'FFTMAX', 0)) attrs = np.array(get_all_attrs(db, attrs_list)) # Put them on the figure plt.plot(attrs[:, 0], attrs[:, 1], ' .', color=point_color, label=label) plt.legend(loc="upper left") # Finally, close the db db.close()
cs = axs[ind_subplot].imshow(data[ind_data], origin="lower", norm=data_norm, interpolation="nearest", extent=axes_extent, aspect="auto") cb_axs = fig.add_axes([0.125, 0.1, 0.9 - 0.125, 0.03]) fig.colorbar(cs, cax=cb_axs, orientation="horizontal") """ Common Attributes """ COMMON_ATTRS = (('paramset', '_v_attrs', 'Common'),) COMMON = get_all_attrs(DB, COMMON_ATTRS) COMMON = COMMON[0][0] SIMU_LENGTH = float(COMMON['simu_length']) N_MITRAL = COMMON['N_mitral'] N_SUBPOP = COMMON['N_subpop'] N_MITRAL_PER_SUBPOP = N_MITRAL/N_SUBPOP """ MPS & STS """ IDX_ATTRS = (('paramset', '_v_attrs', 'Common', 'inter_conn_rate', 0, 1), ('paramset', '_v_attrs', 'Common', 'inter_conn_strength', 0, 1), ('results', '_v_attrs', 'MPS'), ('results', '_v_attrs', 'STS'))
# Get all simulation data ATTRS = [('paramset', '_v_attrs', 'Common', 'inter_conn_rate', 0, 1), ('paramset', '_v_attrs', 'Common', 'inter_conn_strength', 0, 1), ('paramset', '_v_attrs', 'Common', 'simu_length'), ('paramset', '_v_attrs', 'Common', 'simu_dt'), ('results', 's_granule'), ('results', 's_syn_self'), ('results', '_v_attrs'), ('results', 'spikes_it'), ('paramset', 'arrays', 'mtgr_connections'), ] if PLOT_MEMB_POT: ATTRS.append(('results', 'mean_memb_pot')) ALL_SIMU_ATTRS = h5m.get_all_attrs(DB, ATTRS) ALL_SIMU_ATTRS.sort() SET_INTERCO_RATE = list(set(s[0] for s in ALL_SIMU_ATTRS)) SET_INTERCO_RATE.sort() SET_INTERCO_STRENGTH = list(set(s[1] for s in ALL_SIMU_ATTRS)) SET_INTERCO_STRENGTH.sort() # Some useful functions def deq(a, b, delta): """Delta equality""" return abs(a - b) < delta class SignalRepack: def __init__(self, values, times):