2] # get data for each bin only speedmean = np.nanmean(barray, axis=0) # average speed in that bin stopsarraybeacon[bcount, tcount] = speedmean # store speed bcount += 1 return stopsarraybeacon # ------------------------------------------------------------------------------ # #GET AND STORE STOPS DATA for dcount, day in enumerate(days): for mcount, mouse in enumerate(mice): try: saraharray = readhdfdata( filename, day, mouse, 'raw_data') # get raw datafile for mouse and day except KeyError: # if data file doesnt exist... 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) trialarray = saraharray[:, 9] # makes an array of trial number per row in saraharray trarray = np.arange(np.min(saraharray[:, 9]), np.max(saraharray[:, 9] + 0.1), 1)
firststop_b = np.zeros((len(session_paths), 6, 2)) firststop_b[:, :, :] = np.nan firststop_nb = np.zeros((len(session_paths), 6, 2)) firststop_nb[:, :, :] = np.nan firststop_p = np.zeros((len(session_paths), 6, 2)) firststop_p[:, :, :] = np.nan # loop thorugh mice and days to get data for session_path, session_paths in enumerate(mice): session_count = 0 for dcount, day in enumerate(days): #load mouse and day print('Processing...', day, mouse) #load HDF5 data set for that day and mouse try: saraharray = readhdfdata(filename, day, mouse, 'raw_data') except KeyError: print('Error, no file') continue dayb = day.encode('UTF-8') #"""" mouseb = mouse.encode( 'UTF-8') #required for importing string from marray in python3 length = np.max(saraharray[:, 1]) # max track length trial = np.max(saraharray[:, 9]) # max number of trials dayss = array[ dcount, mcount] # array which has days to analyse (day with highest beaconed first stop on that track) trialarray = saraharray[:, 9] # makes an array of trial number per row in saraharray trialno = np.max( saraharray[:, 9]) # total number of trials for that day and mouse