s2_tetl_firststopstorebeac = np.zeros((len(days), len(mice),2));s2_tetl_firststopstorenbeac = np.zeros((len(days), len(mice),2));s2_tetl_firststopstoreprobe = np.zeros((len(days), len(mice),2)) s2_tetl_firststopstorebeac[:,:,:] = np.nan;s2_tetl_firststopstorenbeac[:,:,:] = np.nan; s2_tetl_firststopstoreprobe[:,:,:] = np.nan s2_tetl_firststopstorebeac_s = np.zeros((len(days), len(mice),2));s2_tetl_firststopstorenbeac_s = np.zeros((len(days), len(mice),2));s2_tetl_firststopstoreprobe_s = np.zeros((len(days), len(mice),2)) s2_tetl_firststopstorebeac_s[:,:,:] = np.nan;s2_tetl_firststopstorenbeac_s[:,:,:] = np.nan; s2_tetl_firststopstoreprobe_s[:,:,:] = np.nan s2_teth_firststopstorebeac = np.zeros((len(days), len(mice),2));s2_teth_firststopstorenbeac = np.zeros((len(days), len(mice),2));s2_teth_firststopstoreprobe = np.zeros((len(days), len(mice),2)) s2_teth_firststopstorebeac[:,:,:] = np.nan;s2_teth_firststopstorenbeac[:,:,:] = np.nan; s2_teth_firststopstoreprobe[:,:,:] = np.nan s2_teth_firststopstorebeac_s = np.zeros((len(days), len(mice),2));s2_teth_firststopstorenbeac_s = np.zeros((len(days), len(mice),2));s2_teth_firststopstoreprobe_s = np.zeros((len(days), len(mice),2)) s2_teth_firststopstorebeac_s[:,:,:] = np.nan;s2_teth_firststopstorenbeac_s[:,:,:] = np.nan; s2_teth_firststopstoreprobe_s[:,:,:] = np.nan #loop days and mice to collect data for mcount,mouse in enumerate(mice): for dcount,day in enumerate(days): try: saraharray = readhdfdata(filename,day,mouse,'raw_data') except KeyError: print ('Error, no file') continue # make array of trial number per row of data in dataset trialarray = maketrialarray(saraharray) # make array of trial number same size as saraharray saraharray[:,9] = trialarray[:,0] # replace trial number because of increment error (see README.py) # split data by trial type dailymouse_b = np.delete(saraharray, np.where(saraharray[:, 8] > 0), 0) # delete all data not on beaconed tracks dailymouse_nb = np.delete(saraharray, np.where(saraharray[:, 8] != 10), 0)# delete all data not on non beaconed tracks dailymouse_p = np.delete(saraharray, np.where(saraharray[:, 8] != 20), 0)# delete all data not on probe tracks #extract stops stopsdata_b = extractstops(dailymouse_b) stopsdata_p = extractstops(dailymouse_p)
filename = 'Data_Input/Behaviour_DataFiles/Task13_0300.h5' #specify mouse/mice and day/s to analyse #days = ['Day' + str(int(x)) for x in np.arange(1,21.1)] # Several days #mice = ['M' + str(int(x)) for x in np.arange(1,8.1)] # Several mice mice = ['M' + str(int(x)) for x in [6]]# specific mice days = ['Day' + str(int(x)) for x in [1,17]]# specific day/s bins = np.arange(0.5,20.5,1) # array of bins for location # For each day and mouse, pull raw data, calculate stops/speed and plot graph for dcount,day in enumerate(days): for mcount,mouse in enumerate(mice): print ('Processing...',day,mouse) try: saraharray = readhdfdata(filename,day,mouse,'raw_data')#load HDF5 data set for that day and mouse except KeyError: # if there is no datafile, skip that mouse & day print ('Error, no file') continue trialno = np.max(saraharray[:,9]) # total number of trials for that day and mouse (used later for defining y axis max) # make array of trial number for each row in dataset trialarray = maketrialarray(saraharray) saraharray[:,9] = trialarray[:,0] # replace trial column in dataset *see README for why this is done* # Extract data for beaconed, non-beaconed, probe dailymouse_b = np.delete(saraharray, np.where(saraharray[:, 8] > 0), 0) # delete all data not on beaconed tracks dailymouse_nb = np.delete(saraharray, np.where(saraharray[:, 8] != 10), 0)# delete all data not on non beaconed tracks dailymouse_p = np.delete(saraharray, np.where(saraharray[:, 8] != 20), 0)# delete all data not on probe tracks #extract stops
firststopstorebeac[:, :] = np.nan firststopstorenbeac[:, :] = np.nan firststopstoreprobe[:, :] = np.nan firststopstorebeac_s = np.zeros((len(days), len(mice))) firststopstorenbeac_s = np.zeros((len(days), len(mice))) firststopstoreprobe_s = np.zeros((len(days), len(mice))) firststopstorebeac_s[:, :] = np.nan firststopstorenbeac_s[:, :] = np.nan firststopstoreprobe_s[:, :] = np.nan # For each day and mouse, pull raw data, calculate zscore and store data for mcount, mouse in enumerate(mice): for dcount, day in enumerate(days): try: saraharray = readhdfdata( filename, day, mouse, 'raw_data') # get raw datafile for mouse and day except KeyError: print('Error, no file') continue # make array of trial number for each row in dataset trialarray = maketrialarray( saraharray) # write array of trial per row in datafile saraharray[:, 9] = trialarray[:, 0] # replace trial column in dataset *see README for why this is done* # get stops and trial arrays dailymouse_b = np.delete(saraharray, np.where(saraharray[:, 8] > 0), 0) # delete all data not on beaconed tracks