def example_raster_plot_jitter(): l4 = [ 71211, 70922, 71042, 71338, 74266, 74419, 74882, 71610, ] l5 = [75998, 81442, 82079, 93653, 93902, 81703, 81443, 82202] l6 = [93655, 75759, 76251, 80451, 80762, 81068, 81255, 81316] gids_to_plot = [74419, 81442, 93272] #81068] #[l4[n], l5[n], l6[n]]75270 # gids_to_plot = [85422, 90721] fig, axs = plt.subplots(6, 3, figsize=(14, 14)) ids = data_access_shuffling.ids_jitter[[5, 0, 2, 4, 1, 3]] jitters = np.array([2, 50, 5, 200, 20, 0])[[5, 0, 2, 4, 1, 3]] for i, id in enumerate(ids): bcs = data_access_shuffling.get_jitter_blueconfigs(n=30, id_jitter=id) df_network = data_access_shuffling.get_spike_times_multiple( bcs).loc[gids_to_plot] t_start = 2500 t_end = 4500 df_network = df_network[(df_network['spike_time'] < t_end) & (df_network['spike_time'] >= t_start)] for k, gid in enumerate(gids_to_plot): print k axs[i, k].fill_between([t_start, t_end], [0, 0], [30, 30], color='red', alpha=0.1, linewidth=0.0) plot_times = df_network.loc[gid]['spike_time'] plot_trials = df_network.loc[gid]['spike_trial'] axs[i, k].vlines(plot_times, plot_trials, plot_trials + 1, linewidth=0.5) for ax in axs[:, :].flatten(): ax.set_ylim([0, 30]) ax.set_yticks([0.5, 4.5, 9.5, 14.5, 19.5, 25.5, 29.5]) ax.set_yticklabels([1, 5, 10, 15, 20, 25, 30]) ax.set_ylabel('Trials') for ax in axs.flatten(): ax.set_xlim([t_start, t_end]) ax.set_xlabel('t (ms)') for i in range(3): axs[0, i].set_title(gids_to_plot[i]) plt.tight_layout() plt.savefig('figures/rasterplot_example_jitter.pdf')
def plot_psths(): df_neurons = data_access_shuffling.get_selected_L456_gids() gids = np.array(df_neurons.index) print gids.shape bcs = data_access_shuffling.get_jitter_flick_blueconfigs() df_network = data_access_shuffling.get_spike_times_multiple(bcs).loc[gids] fig, axs = plt.subplots(6, figsize=(14, 14)) t_start = 1000 t_end = 8000 df_network = df_network[(df_network['spike_time'] < t_end) & (df_network['spike_time'] >= t_start)] for k in range(30): times = df_network[df_network['spike_trial'] == k]['spike_time'] axs[0].hist(times, bins=np.arange(t_start, t_end + 5, 5), color='red', histtype='step', alpha=0.5, weights=np.zeros(times.size) + (1000 / 5.0) / gids.size) axs[0].set_xlim([t_start, t_end]) axs[0].set_ylim([0, 15]) axs[0].set_xlabel('t (ms)') gids_special = [74419, 75270, 93272] for i, gid in enumerate(gids_special): df_neuron = df_network.loc[gid] ax = axs[i + 1] ax.vlines(df_neuron['spike_time'], df_neuron['spike_trial'], df_neuron['spike_trial'] + 1, rasterized=True, lw=1) ax.set_xlim([t_start, t_end]) ax.set_ylim([0, 30]) ax.set_xlabel('t (ms)') ax.set_title(gid) plt.tight_layout() plt.savefig('figures/population_psths_jitter_flick.pdf', dpi=300)
def populations_psths_jitter(): df_neurons = data_access_shuffling.get_selected_L456_gids() gids = np.array(df_neurons.index) print gids.shape # spike_count_dict = data_access_shuffling.get_all_spike_counts_jitter() fig, axs = plt.subplots(6, figsize=(14, 14)) ids = data_access_shuffling.ids_jitter[[5, 0, 2, 4, 1, 3]] jitters = np.array([2, 50, 5, 200, 20, 0])[[5, 0, 2, 4, 1, 3]] for i, id in enumerate(ids): bcs = data_access_shuffling.get_jitter_blueconfigs(n=30, id_jitter=id) df_network = data_access_shuffling.get_spike_times_multiple( bcs).loc[gids] print df_network t_start = 1000 t_end = 7000 df_network = df_network[(df_network['spike_time'] < t_end) & (df_network['spike_time'] >= t_start)] for k in range(30): print k times = df_network[df_network['spike_trial'] == k]['spike_time'] axs[i].hist(times, bins=np.arange(t_start, t_end + 5, 5), color='red', histtype='step', alpha=0.5) for ax in axs.flatten(): ax.set_xlim([t_start, t_end]) ax.set_xlabel('t (ms)') plt.tight_layout() plt.savefig('figures/population_psths_jitter.pdf')