ufreqs = np.unique(rr_stimparams[:, 0]) urrs = np.unique(rr_stimparams[:, 1]) freq_played, freq_ix_played, _ = misc.closest(ufreqs, cf, log = True) rr_bins = np.arange(0, 6, 0.05) rr_psth_stim, usp = Spikes.calc_psth_by_stim(rr_rast, rr_stimparams, bins = rr_bins) cf_psth = rr_psth_stim[freq_ix_played, :, :] noise_psth = rr_psth_stim[0, :, :] fig = plt.figure() nrrs = cf_psth.shape[0] ax = [] for i in range(nrrs): ax.append(fig.add_subplot(nrrs, 1, i+1)) ax[-1].plot(rr_bins[:-1], cf_psth[i, :]) RR.plot_tone_pips(urrs[i], 6, 0.05, 0.025, ax = ax[-1], color = 'r') if i>0: ax[-1].set_xticklabels('') misc.sameyaxis(ax) if len(voc_path) > 0: voc_file = h5py.File(voc_path, 'r') voc_rast = voc_file['rast'].value voc_stimparams = voc_file['stimID'].value voc_file.close() # voc_rast = voc_rast[1:, :] # voc_stimparams = voc_stimparams[:-1, :] voc_stimparams = voc_stimparams[:, 0]