r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_37', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_38', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_39', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_48', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_49', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_50', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_51', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_52', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_53', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_54', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_55' ] cr = activitytables.read_subjects( datafolders, days=days, selector=lambda x: activitytables.crossings(x, True, False)) rr = activitytables.read_subjects(datafolders, days=days, key=activitytables.rewards_key) info = activitytables.read_subjects(datafolders, days=days, key=activitytables.info_key) # For video analysis (4,10,12,16) days = [0] datafolders = [r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_21'] cr = activitytables.read_subjects(datafolders, days=days) rr = activitytables.read_subjects(datafolders, days=days, key=activitytables.rewards_key) info = activitytables.read_subjects(datafolders,
{"frame": [12580, 15257, 20847, 27342, 31621], "side": [l, r, l, r, l]}, {"frame": [4245, 6565, 9791, 12862, 16398], "side": [l, r, l, r, l]}, {"frame": [10165, 11735, 17579, 21866, 25543], "side": [l, r, l, r, l]}, {"frame": [7676, 10867, 13523, 15892, 18356], "side": [l, r, l, r, l]}, {"frame": [6186, 9075, 14168, 17987, 19739], "side": [l, r, l, r, l]}, {"frame": [5057, 7080, 9776, 11300, 13048], "side": [l, r, l, r, l]}, {"frame": [8362, 11371, 14830, 16943, 18357], "side": [l, r, l, r, l]}, {"frame": [8652, 14440, 17459, 19832, 21512], "side": [l, r, l, r, l]}, {"frame": [13777, 17682, 23882, 27264, 30507], "side": [l, r, l, r, l]}, {"frame": [5872, 8290, 9864, 11833, 15068], "side": [l, r, l, r, l]}, {"frame": [12992, 15174, 17832, 22024, 26694], "side": [l, r, l, r, l]}, {"frame": [6107, 8033, 10056, 12672, 14898], "side": [l, r, l, r, l]}, {"frame": [9091, 12196, 19427, 24159, 29414], "side": [l, l, l, r, l]}, ] act = activitytables.read_subjects(subjects, days=[0], includeinfokey=False) cr = activitytables.read_subjects(subjects, days=[0], selector=lambda x: activitytables.crossings(x, True, True)) info = activitytables.read_subjects(subjects, days=[0], key=activitytables.info_key) figure1.figure1m(firststeps, info, fbase) # Figure 1N (Slip clustering) info = activitytables.read_subjects(subjects, days=[3, 4], key=activitytables.info_key) fbase = r"C:\figs\figure1n" figure1.figure1n(info, fbase) # Figure 2 (Ethograms) act = activitytables.read_subjects(subjects, days=[5], includeinfokey=False) cr = activitytables.read_subjects(subjects, days=[5], selector=lambda x: activitytables.crossings(x, False, False)) rr = activitytables.read_subjects(subjects, days=[5], key=activitytables.rewards_key) info = activitytables.read_subjects(subjects, days=[5], key=activitytables.info_key) # Figure 2A (Ethogram aligned on stretch)
r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_28', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_29', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_36', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_37', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_38', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_39', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_48', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_49', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_50', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_51', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_52', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_53', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_54', r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_55'] cr = activitytables.read_subjects(datafolders,days=days, selector=lambda x:activitytables.crossings(x,True,False)) rr = activitytables.read_subjects(datafolders,days=days, key=activitytables.rewards_key) info = activitytables.read_subjects(datafolders,days=days, key=activitytables.info_key) # For video analysis (4,10,12,16) days = [0] datafolders = [r'E:/Protocols/Shuttling/LightDarkServoStable/Data/JPAK_21'] cr = activitytables.read_subjects(datafolders,days=days) rr = activitytables.read_subjects(datafolders,days=days,key=activitytables.rewards_key) info = activitytables.read_subjects(datafolders,days=days,key=activitytables.info_key) def clusterstepframes(cr,info,leftstep,rightstep): # Compute step times
mmut = mut.query(mq) plt.bar(0, lmst.mean(), color='b', yerr=lmst.sem(), label='stable') plt.bar(1, lmut.mean(), color='r', yerr=lmst.sem(), label='unstable') plt.bar(3, mmst.mean(), color='b', yerr=lmst.sem(), label='stable') plt.bar(4, mmut.mean(), color='r', yerr=lmst.sem(), label='unstable') plt.bar(6, cmst.mean(), color='b', yerr=lmst.sem(), label='stable') plt.bar(7, cmut.mean(), color='r', yerr=lmst.sem(), label='unstable') plt.ylabel('y (zscore)') plt.xticks([1, 4, 7], ['Lesions', 'Matched', 'Controls']) plt.legend(['stable', 'unstable'], loc=0) # EXTRACT INDIVIDUAL ACTIVITY TRACES act = activitytables.read_subjects(subjects[1], days=range(13, 14), includeinfokey=False) cr = activitytables.crossings(act) info = activitytables.read_subjects(subjects[1], days=range(13, 14), key=activitytables.info_key) ts = [act.ix[t.timeslice, :] for i, t in cr.iterrows()] d = [t.ix[:, slice(17, 25)].diff() for t in ts] ps = [activitytables.findpeaks(t, 1000)[1] for t in d] p = [t.trial[0] for t, p in zip(ts, ps) if len(p) == 0] fs = [act.ix[t.timeslice, :].frame for i, t in cr.iterrows()] # Figure 1L8 (Pooled Hindlimb Step Postures on Random) ct = activitytables.read_subjects(subjects[1], days=range(13, 14), selector=activitytables.compensation)