voc_paths = glob.glob(os.path.join(basedir, 'fileconversion', 'VOC*.h5')) ix2freq = RF.get_ix2freq() p = re.compile('RF(\d+).h5') for rf_path in rf_paths: penno = p.findall(rf_path)[0] rr_path = [f for f in rr_paths if penno in f][0] voc_path = [f for f in voc_paths if penno in f][0] rf_file = h5py.File(rf_path, 'r') rf_rast = rf_file['rast'].value rf_stimparams = rf_file['stimID'].value rf_file.close() cfs = load_cfs(experiment) cf_ix = np.int32(np.round(RF.find_cf(cfs, np.int32(penno)))) cf = ix2freq[20:][cf_ix] # perform analysis if len(rr_path) > 0: rr_file = h5py.File(rr_path, 'r') rr_rast = rr_file['rast'].value rr_stimparams = rr_file['stimID'].value rr_file.close() # rr_rast = rr_rast[1:, :] # rr_stimparams = rr_stimparams[:-1, :] ufreqs = np.unique(rr_stimparams[:, 0]) urrs = np.unique(rr_stimparams[:, 1]) freq_played, freq_ix_played, _ = misc.closest(ufreqs, cf, log = True)