def makeDF(camdir): # creates data frame for CAM experiments, and returns paths to all experiments list_of_dirs = os.walk(camdir).next()[1] list_of_paths = [] for i in list_of_dirs: nwb_path = camdir + i + '/' + i + '.nwb' list_of_paths.append(nwb_path) CAM_df = pd.DataFrame(index=range(len(list_of_paths),),columns=cn.getMetaData(list_of_paths[0])) row_counter = 0 for path in list_of_paths: CAM_df.loc[row_counter] = pd.Series(cn.getMetaData(path)) row_counter += 1 # add a metric of running speed to that data frame mean_speed = [] for path in list_of_paths: run_data = cn.getRunningSpeed(path) mean_speed.append(np.nanmean(run_data[0])) CAM_df['mean speed'] = mean_speed CAM_df['path_to_exp'] = list_of_paths return list_of_paths, CAM_df
list_of_paths = [] for i in list_of_dirs: nwb_path = CAMDIR + i + '/' + i + '.nwb' list_of_paths.append(nwb_path) CAM_df = pd.DataFrame(index=range(len(list_of_paths),), columns=cn.getMetaData(list_of_paths[0])) row_counter = 0 for path in list_of_paths: CAM_df.loc[row_counter] = pd.Series(cn.getMetaData(path)) row_counter += 1 # add a metric of running speed to that data frame mean_speed = [] for path in list_of_paths: run_data = cn.getRunningSpeed(path) mean_speed.append(np.nanmean(run_data[0])) CAM_df['mean speed'] = mean_speed CAM_df['path_to_exp'] = list_of_paths # LOOP OVER ALL EXPERIMENTS AND CALCULATE HISTOGRAM OF LIFETIME SPARSENESSES FOR EACH lift_spar_list = [] pop_spar_list = [] meta_list = [] for path in list_of_paths: print path # extract interesting information meta = cn.getMetaData(path) # get meta data for experiment of interest proj = cn.getMaxProjection(path) # getMaxProjection returns a 512x512 array of the # maximum projection of the 2P movie print meta