np.mean, smooth_frames, int(smooth_frames / 3)) tn = preproc.normalize(t, norm='l1', axis=0) tn = np.asarray(t) for i in np.arange(len(t)): tn[i, :] = binning.scale(t[i], 0, 1) y_positions = template_info['position Y'].values position_sorted_indices = np.argsort(y_positions) regions_pos = list(const.BRAIN_REGIONS.values()) region_lines = [] for rp in regions_pos: region_lines.append( sync_funcs.find_nearest( y_positions[position_sorted_indices] * const.POSITION_MULT, rp)[0]) region_lines = np.array(region_lines) tns = tn[position_sorted_indices] plt.imshow(np.flipud(tns), aspect='auto') plt.hlines(y=len(t) - region_lines, xmin=0, xmax=len(tns[0]) - 1, linewidth=3, color='w') plt.vlines(x=int(len(tns[0]) / 2), ymin=0, ymax=len(tns) - 1) i = 0 sv.graph_pane(globals(), 'i', 'tn')
smooth_frames = smooth_time * 120 t = binning.rolling_window_with_step(avg_firing_rate_around_suc_trials, np.mean, smooth_frames, int(smooth_frames / 3)) #tn = preproc.normalize(t, norm='l1', axis=0) tn = np.empty(t.shape) for i in np.arange(len(t)): tn[i, :] = binning.scale(t[i], 0, 1) y_positions = template_info['position Y'].values position_sorted_indices = np.argsort(y_positions) regions_pos = list(const_rat.BRAIN_REGIONS.values()) region_lines = [] for rp in regions_pos: region_lines.append(sync_funcs.find_nearest(y_positions[position_sorted_indices] * const_com.POSITION_MULT, rp)[0]) region_lines = np.array(region_lines) tns = tn[position_sorted_indices] plt.imshow(np.flipud(tns), aspect='auto') plt.hlines(y=len(t) - region_lines, xmin=0, xmax=len(tns[0])-1, linewidth=3, color='w') plt.vlines(x=int(len(tns[0]) / 2), ymin=0, ymax=len(tns) - 1) plt.imshow(np.flipud(tns), aspect='auto', extent=[-8, 8, len(tns), 0]) plt.hlines(y=len(t) - region_lines, xmin=-8, xmax=8, linewidth=2, color='w') plt.vlines(x=0, ymin=0, ymax=len(tns) - 1) i = 0