-
Notifications
You must be signed in to change notification settings - Fork 1
/
runAnalysisOnMultipleRecsOfOneMouse.py
57 lines (51 loc) · 2.22 KB
/
runAnalysisOnMultipleRecsOfOneMouse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import tools.extractSaveData as extractSaveData
#import tools.dataAnalysis as dataAnalysis
#import tools.openCVImageProcessingTools as openCVImageProcessingTools
import pdb
import os
import subprocess
import time
import pickle
import multiprocessing
saveDir = 'scriptRunHistory/'
runList = {0:{'mouse':'210120_m85','days':{'210323':{'recs910':'0'},\
'210324':{'recs910':'0', 'recs820':'1'},\
'210325':{'recs910':'0'},\
'210326':{'recs910':'0'},\
'210329':{'recs910':'0'},\
'210330':{'recs910':'0'},\
'210331':{'recs910':'0'},\
'210401':{'recs910':'0', 'recs820':'1'},\
'210402':{'recs910':'0', 'recs820':'1'},\
}
}
}
script = 'extractPawTrackingOutliers'
do820analysis = False
commandHist = []
# loop over mice
for key,value in runList.items():
print('mouse : ', value['mouse'])
mouse = value['mouse']
# loop over all recording days of one mouse
for d,r in value['days'].items():
recordings910 = [int(i) for i in r['recs910'].split(',')]
#print(value['mouse'], d, '910rec:', r['recs910'])
commandString9 = 'python %s.py -m %s -d %s -r %s' % (script,mouse,d,r['recs910'])
print('running ', commandString9)
(out,err) = subprocess.getstatusoutput(commandString9)
print(out,err)
commandHist.append([commandString9, out, err])
if do820analysis:
try:
r['recs820']
except:
pass #print()
else:
recordings820 = [int(i) for i in r['recs820'].split(',')]
#print('820rec:',r['recs820'])
commandString8 = 'python %s.py -m %s -d %s -r %s' % (script, mouse, d, r['recs820'])
print(commandString8)
ttt = time.strftime("%y-%m-%d")
sname = os.path.basename(__file__)
pickle.dump( commandHist, open( saveDir+"%s_%s_script-%s.p" % (ttt,sname,script), "wb" ) )