forked from samsydco/HBN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
motion_check.py
44 lines (38 loc) · 1.01 KB
/
motion_check.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
#!/usr/bin/env python3
import tqdm
import random
import numpy as np
import deepdish as dd
from ISC_settings import *
nsub = 40
bins = [0,4]
task='DM'
n_time=750
D2 = {}
outliers = []
vals2 = {}
vals3 = {}
max2 = {}
max3 = {}
for b in range(nbinseq):
subl = np.concatenate([ageeq[i][1][b] for i in [0,1]])
D2[b] = np.zeros((len(subl),n_time))
for sidx, sub in enumerate(subl):
D2[b][sidx] = dd.io.load(sub,['/'+task+'/reg'])[0][:,2]
vals2[b] = np.median(D2[b],1)
max2[b] = np.max(D2[b],1)
vals3[b] = vals2[b][vals2[b] < np.std(vals2[0])*3]
max3[b] = max2[b][vals2[b] < np.std(vals2[0])*3]
outliers.extend(subl[vals2[b] > np.std(vals2[0])*3])
if __name__ == "__main__":
import scipy.stats as stats
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 5))
histbins=np.histogram(np.hstack((vals3[0],vals3[4])), bins=15)[1]
for b in bins:
ax.hist(vals3[b], histbins)
ax.legend(['Young', 'Old'])
fig.tight_layout()
plt.show()
stats.ttest_ind(vals3[0],vals3[4])
df = len(vals3[0])+len(vals3[4])-2