In [1]:
%run ~/set_localenv_vars.py
Importage
In [2]:
import pandas as pd
%matplotlib inline
import seaborn as sns
from nilearn.plotting import plot_stat_map
import os,sys
from nilearn.image import index_img
import numpy as np
import networkx as nx
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
In [3]:
from nilearn.plotting import cm as nl_cm
Define some variables
In [7]:
test_file = 'test_lesionmask_rs1mm.nii.gz'
fa_file = 'fmrib58_fa_1mm.nii.gz'
In [12]:
conwhat_dir = le['code_dir'] + '/libraries_of_mine/github/ConWhAt'
scratch_dir = conwhat_dir + '/conwhat/scratch'
Go to scratch dir
In [13]:
os.chdir(scratch_dir)
Load conwhat
In [15]:
#sys.path.append(conwhat_dir)
#import ConWhAt
#from ConWhAt.volumetric import VolConnAtlas
#from ConWhAt.volumetric.utils import get_bounding_box_inds
In [ ]:
from conwhat.
Initialize l2k8 sc33 volconn
In [9]:
vca = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')
Explore some things
In [10]:
vca.atlas_dir
Out[10]:
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33_v2'
In [11]:
vca.image_file_mappings.head()
Out[11]:
name
nii_file
nii_file_id
4dvolind
0
0_to_1
/home/jgriffiths/Code/libraries_of_mine/github...
0
0
1
0_to_2
/home/jgriffiths/Code/libraries_of_mine/github...
0
1
2
0_to_3
/home/jgriffiths/Code/libraries_of_mine/github...
0
2
3
0_to_4
/home/jgriffiths/Code/libraries_of_mine/github...
0
3
4
0_to_5
/home/jgriffiths/Code/libraries_of_mine/github...
0
4
In [12]:
vca.bboxes.head()
Out[12]:
xmin
xmax
ymin
ymax
zmin
zmax
0
39
86
52
186
38
86
1
42
88
136
192
40
88
2
44
108
133
189
35
108
3
37
82
135
187
42
82
4
38
64
128
163
65
64
In [13]:
vca.Gnx[1][0]
Out[13]:
{'4dvolind': 0,
'fullname': 'L_lateralorbitofrontal_to_L_parsorbitalis',
'idx': 0,
'name': '0_to_1',
'nii_file': '/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33_v2/vismap_grp_cat_rois1_norm.nii.gz',
'nii_file_id': 0,
'weight': 1436.9290540540539,
'xmax': 86,
'xmin': 39,
'ymax': 186,
'ymin': 52,
'zmax': 86,
'zmin': 38}
In [14]:
vca.Gnx[0][1]
Out[14]:
{'4dvolind': 0,
'fullname': 'L_lateralorbitofrontal_to_L_parsorbitalis',
'idx': 0,
'name': '0_to_1',
'nii_file': '/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33_v2/vismap_grp_cat_rois1_norm.nii.gz',
'nii_file_id': 0,
'weight': 1436.9290540540539,
'xmax': 86,
'xmin': 39,
'ymax': 186,
'ymin': 52,
'zmax': 86,
'zmin': 38}
In [15]:
df = nx.to_pandas_dataframe(vca.Gnx)#,nodelist=vca.Gnx.nodes
In [39]:
sns.heatmap(np.log1p(df.values), xticklabels='',yticklabels='')
Out[39]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa3442f8510>
Take a look at some of the atlas entries
In [40]:
vca.plot_image(idx=1)
Out[40]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa33da06150>
In [41]:
ifmaps = vca.image_file_mappings.ix[0]
plot_stat_map(index_img(ifmaps['nii_file'],ifmaps['4dvolind']),vmax=2.)
Out[41]:
<nilearn.plotting.displays.OrthoSlicer at 0x7fa33d5f0210>
Take a look at the connectivity stuff
In [42]:
vca.weights
Out[42]:
array([[ 1.45154003e+04, 1.43692905e+03, 4.10817568e+02, ...,
1.85810811e-02, 0.00000000e+00, 3.56418919e-01],
[ 1.43692905e+03, 3.28754899e+03, 1.05954392e+02, ...,
9.96621622e-02, 0.00000000e+00, 1.21621622e-01],
[ 4.10817568e+02, 1.05954392e+02, 6.68033784e+02, ...,
1.01351351e-02, 0.00000000e+00, 4.56081081e-02],
...,
[ 1.85810811e-02, 9.96621622e-02, 1.01351351e-02, ...,
4.35354730e+02, 3.48125000e+01, 2.02702703e-02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
3.48125000e+01, 9.18581081e+00, 0.00000000e+00],
[ 3.56418919e-01, 1.21621622e-01, 4.56081081e-02, ...,
2.02702703e-02, 0.00000000e+00, 5.91216216e-02]])
In [43]:
vca.region_labels
Out[43]:
['L_lateralorbitofrontal',
'L_parsorbitalis',
'L_frontalpole',
'L_medialorbitofrontal',
'L_parstriangularis',
'L_parsopercularis',
'L_rostralmiddlefrontal',
'L_superiorfrontal',
'L_caudalmiddlefrontal',
'L_precentral',
'L_paracentral',
'L_rostralanteriorcingulate',
'L_caudalanteriorcingulate',
'L_posteriorcingulate',
'L_isthmuscingulate',
'L_postcentral',
'L_supramarginal',
'L_superiorparietal',
'L_inferiorparietal',
'L_precuneus',
'L_cuneus',
'L_pericalcarine',
'L_lateraloccipital',
'L_lingual',
'L_fusiform',
'L_parahippocampal',
'L_entorhinal',
'L_temporalpole',
'L_inferiortemporal',
'L_middletemporal',
'L_bankssts',
'L_superiortemporal',
'L_transversetemporal',
'L_insula',
'L_thalamusproper',
'L_caudate',
'L_putamen',
'L_pallidum',
'L_accumbensarea',
'L_hyppocampus',
'L_amygdala',
'L_brainstem',
'R_lateralorbitofrontal',
'R_parsorbitalis',
'R_frontalpole',
'R_medialorbitofrontal',
'R_parstriangularis',
'R_parsopercularis',
'R_rostralmiddlefrontal',
'R_superiorfrontal',
'R_caudalmiddlefrontal',
'R_precentral',
'R_paracentral',
'R_rostralanteriorcingulate',
'R_caudalanteriorcingulate',
'R_posteriorcingulate',
'R_isthmuscingulate',
'R_postcentral',
'R_supramarginal',
'R_superiorparietal',
'R_inferiorparietal',
'R_precuneus',
'R_cuneus',
'R_pericalcarine',
'R_lateraloccipital',
'R_lingual',
'R_fusiform',
'R_parahippocampal',
'R_entorhinal',
'R_temporalpole',
'R_inferiortemporal',
'R_middletemporal',
'R_bankssts',
'R_superiortemporal',
'R_transversetemporal',
'R_insula',
'R_thalamusproper',
'R_caudate',
'R_putamen',
'R_pallidum',
'R_accumbensarea',
'R_hyppocampus',
'R_amygdala']
In [44]:
vca.hemispheres
Out[44]:
array([ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0.])
In [45]:
vca.cortex
Out[45]:
array([ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 0., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0., 0.,
0., 0., 0., 0., 0.])
In [23]:
mask = (vca.weights!=0)*((np.eye(vca.weights.shape[0])*-1)+1)==False
sns.heatmap(np.log1p(vca.weights), xticklabels='',yticklabels='', mask=mask)
Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa343eb9c50>
In [24]:
vca.region_labels_file
Out[24]:
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33_v2/region_labels.txt'
In [ ]:
vca.region_mapping_lh
Take a look at lesion map test file
In [25]:
plot_stat_map(test_file,vmax=2.)
Out[25]:
<nilearn.plotting.displays.OrthoSlicer at 0x7f4c98b10e50>
In [26]:
#df_bb = pd.read_csv('../atlases/volumetric/dipy_dsi_sd4_l2k8_sc33/bounding_boxes.txt', sep=',')
In [27]:
#va.bbs = df_bb
#test_bbox = get_bounding_box_inds(test_file)
In [28]:
#va.compute_roi_bb_overlaps??
#bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)
#bb_isoverlapping
In [29]:
#np.nonzero(bb_isoverlapping)[0].shape
In [47]:
idxs = 'all'# range(10) # #'all' # range(500) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]
In [48]:
hs_res,hs_df,hs_G = vca.compute_hit_stats(test_file,idxs,n_jobs=4)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
In [49]:
# TO DO
`
# - FA masking
# - modify connectome
# - IPN stuff
# - tidy up
# - other scales
In [50]:
hs_df['TPR'].sum()
Out[50]:
28.907334105925379
In [51]:
hs_df['TPR'].mean()
Out[51]:
0.018078382805456771
In [54]:
hs_df['TPR'].idxmax()
Out[54]:
'57_to_58'
In [59]:
hs_df['TPR'].sort_values(ascending=False).ix[:10]
Out[59]:
name
57_to_58 0.388393
56_to_57 0.379212
50_to_57 0.375284
57_to_59 0.352392
50_to_58 0.314029
58_to_59 0.304818
50_to_59 0.303734
56_to_58 0.295923
57_to_77 0.285658
57_to_72 0.283250
Name: TPR, dtype: float64
In [ ]:
plot_stat_map()
In [75]:
import nibabel as nib
In [93]:
region_img = nib.load(vca.region_nii_file)
roi1 = 51
roi2 = 58
roi1_img = nib.Nifti1Image((region_img.get_data() == roi1).astype(float),
region_img.affine)
roi2_img = nib.Nifti1Image((region_img.get_data() == roi2).astype(float),
region_img.affine)
img = index_img(vca.Gnx[50][57]['nii_file'],
vca.Gnx[50][57]['4dvolind'])
display = plot_stat_map(img,cmap='hot',threshold=0.2,dim=5)
display.add_overlay(test_file,alpha=0.4,cmap='Blues')
display.add_overlay(roi1_img,cmap=nl_cm.black_blue,vmax=3.)
display.add_overlay(roi2_img,cmap=nl_cm.green_transparent,vmax=3.)
In [66]:
img = index_img(vca.Gnx[57][72]['nii_file'],
vca.Gnx[57][72]['4dvolind'])
display = plot_stat_map(img,cmap='hot',threshold=0.2)
display.add_overlay(test_file,alpha=0.2,cmap='Blues')
In [ ]:
img = index_img(vca.Gnx[7][58]['nii_file'],
vca.Gnx[7][58]['4dvolind'])
display = plot_stat_map(img)
display.add_overlay(test_file)
In [ ]:
hs_df['TPR'][hs_df['TPR']!=0].hist(bins=50)
In [ ]:
sns.heatmap(nx.to_pandas_dataframe(hs_G,weight='TPR'),
xticklabels='',yticklabels='')
In [ ]:
redesign...
In [ ]:
# conwhat
# conwhat
# base.py: atlas class, atlas volumetric class, atlas streamlinetric class, ModAtlas class
# init.py: import atlas classes
# atlases folder - all atlases at one flat level
# atlas1
# atlas2
# atlas3
# ...etc
# utils folder
# viz folder
# construct folder
# scratch folder
# tests folder
# build folder
# doc folder
# examples folder
# build folder
In [ ]:
In [10]:
from ConWhAt.base import scalar_stats
In [11]:
f1 = fa_file
f2 = vca.image_file_mappings.ix[0]['nii_file']
In [15]:
stuff = scalar_stats(f1,index_img(f2,0).get_data())
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-15-ba841093b145> in <module>()
----> 1 stuff = scalar_stats(f1,index_img(f2,0).get_data())
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py in scalar_stats(roi, scalar, thr1, thr2)
163
164
--> 165 blah
166
167
NameError: global name 'blah' is not defined
In [13]:
%debug
> /home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py(165)scalar_stats()
164
--> 165 blah
166
ipdb> l(100,170)
100 dat2_thrbin[dat2_thrbin>0] = 1
101
102
103 thrbin_mul = dat1_thrbin*dat2_thrbin
104
105 thrbininv_mul = (dat1_thrbin==0)*(dat2_thrbin==0)
106
107
108 TP = thrbin_mul.sum()
109 TN = thrbininv_mul.sum()
110 FP = dat2_thrbin.sum() - TP
111 FN = (dat2_thrbin==0).sum() - TN
112
113 hit_stats = get_stats(TP,TN,FP,FN)
114
115 res = hit_stats
116
117 res['corr_nothr'] = np.corrcoef(dat1.ravel(),dat2.ravel())[0,1]
118 res['corr_thr'] = np.corrcoef(dat1_thr.ravel(),dat2_thr.ravel())[0,1]
119 res['corr_thrbin'] = np.corrcoef(dat1_thrbin.ravel(),dat2_thrbin.ravel())[0,1]
120
121 return res
122
123
124
125
126
127
128 def scalar_stats(roi,scalar, thr1=0,thr2=0):
129
130 # Image 1 is the reference image
131 # Image 2 is the image being tested
132
133 if type(roi) == np.ndarray:
134 roi_dat = roi
135 elif type(roi) == str:
136 roi_img = nib.load(roi)
137 roi_dat = roi_img.get_data()
138 else:
139 roi_img = roi
140 roi_dat = roi_img.get_data()
141
142
143 if type(scalar) == np.ndarray:
144 scalar_dat = scalar
145 elif type(roi) == str:
146 scalar_img = nib.load(scalar)
147 scalar_dat = scalar_img.get_data()
148 else:
149 scalar_img = scalar
150 scalar_dat = scalar_img.get_data()
151
152
153
154 nzinds = np.nonzero(roi_dat.ravel()>0)[0]
155
156 scalar_dat_nz = scalar_dat.ravel()[nzinds]
157
158 scalar_dat_mean = np.mean(scalar_dat_nz)
159 scalar_dat_mode = mode(scalar_dat_nz).mode
160 scalar_dat_std = np.std(scalar_dat_nz)
161
162 scalar_dat_hist = []
163
164
--> 165 blah
166
167
168 #res['mean']
169
170 return scalar_dat_mean,scalar_dat_std,scalar_dat_mode,scalar_dat_hist
ipdb> scalar_dat_mean
0.0
ipdb> roi_dat.max()
8676.0
ipdb> nzinds
array([ 650914, 651096, 651097, ..., 6169675, 6169676, 6169677])
ipdb> scalar_dat_nz.max()
0.0
ipdb> scalar_dat.max()
1.0
ipdb> scalar_dat.mean()
0.00012817011
ipdb> scalar_dat_nz.mean()
0.0
ipdb> roi_dat.ravel()>0
array([False, False, False, ..., False, False, False], dtype=bool)
ipdb> roi_dat.shape
(182, 218, 182)
ipdb> scalar_dat.shape
(182, 218, 182, 61)
ipdb> scalar.shape
*** AttributeError: 'str' object has no attribute 'shape'
ipdb> scalar
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33_v2/vismap_grp_cat_rois1_norm.nii.gz'
ipdb> c
In [ ]:
stuff[2].mode
In [ ]:
f2_dat = index_img(f2,0).get_data()
In [22]:
np.nonzero(f2_dat.ravel()>0)[0]
Out[22]:
array([1575090, 1575091, 1575272, ..., 3444947, 3445128, 3445129])
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [18]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 2min 5s, sys: 17.6 s, total: 2min 23s
Wall time: 2min 24s
In [19]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 2min 5s, sys: 17.3 s, total: 2min 22s
Wall time: 2min 23s
In [17]:
%time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 1min 36s, sys: 59.6 s, total: 2min 36s
Wall time: 2min 44s
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:22: RuntimeWarning: invalid value encountered in divide
TPR = TP / (TP + FN)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:40: RuntimeWarning: invalid value encountered in divide
FNR = FN / (FN + TP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in double_scalars
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [20]:
%time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 1min 36s, sys: 28.4 s, total: 2min 5s
Wall time: 2min 6s
In [21]:
idxs = 'all'
In [ ]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
In [ ]:
%time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)
parallellizing...
In [18]:
idxs = range(50)
In [19]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 2min 7s, sys: 18.7 s, total: 2min 26s
Wall time: 2min 26s
In [20]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs,n_jobs=2)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 6.05 s, sys: 200 ms, total: 6.25 s
Wall time: 1min 12s
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [21]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs,n_jobs=3)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 6.09 s, sys: 152 ms, total: 6.24 s
Wall time: 51.9 s
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [22]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs,n_jobs=4)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 6.02 s, sys: 204 ms, total: 6.22 s
Wall time: 42.3 s
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [23]:
idxs = 'all'
In [25]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs,n_jobs=1)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 1h 3min 17s, sys: 10min 18s, total: 1h 13min 36s
Wall time: 1h 13min 36s
In [24]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs,n_jobs=4)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 2min 28s, sys: 1.58 s, total: 2min 30s
Wall time: 20min 50s
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in divide
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [ ]:
In [ ]:
In [ ]:
In [33]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 1min 52s, sys: 17.6 s, total: 2min 10s
Wall time: 2min 14s
In [ ]:
%time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)
In [34]:
from joblib import Parallel,delayed
In [36]:
def chs(va,test_file,idxs):
return va.compute_hit_stats(test_file,idxs)
In [58]:
va.bboxes.shape
Out[58]:
(2480, 6)
In [59]:
idxs = range(va.bboxes.shape[0])
In [60]:
%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
---------------------------------------------------------------------------
JoblibValueError Traceback (most recent call last)
<ipython-input-60-3837ff67a0d5> in <module>()
----> 1 get_ipython().magic(u'time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)')
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
<decorator-gen-60> in time(self, line, cell, local_ns)
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
1127 else:
1128 st = clock2()
-> 1129 exec(code, glob, local_ns)
1130 end = clock2()
1131 out = None
<timed exec> in <module>()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/joblib/parallel.pyc in __call__(self, iterable)
787 # consumption.
788 self._iterating = False
--> 789 self.retrieve()
790 # Make sure that we get a last message telling us we are done
791 elapsed_time = time.time() - self._start_time
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/joblib/parallel.pyc in retrieve(self)
738 exception = exception_type(report)
739
--> 740 raise exception
741
742 def __call__(self, iterable):
JoblibValueError: JoblibValueError
___________________________________________________________________________
Multiprocessing exception:
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/scratch/<string> in <module>()
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py in main()
464
465 def main():
466 """Run an IPKernel as an application"""
467 app = IPKernelApp.instance()
468 app.initialize()
--> 469 app.start()
app.start = <bound method IPKernelApp.start of <IPython.kernel.zmq.kernelapp.IPKernelApp object>>
470
471
472 if __name__ == '__main__':
473 main()
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py in start(self=<IPython.kernel.zmq.kernelapp.IPKernelApp object>)
454 def start(self):
455 if self.poller is not None:
456 self.poller.start()
457 self.kernel.start()
458 try:
--> 459 ioloop.IOLoop.instance().start()
460 except KeyboardInterrupt:
461 pass
462
463 launch_new_instance = IPKernelApp.launch_instance
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/zmq/eventloop/ioloop.py in start(self=<zmq.eventloop.ioloop.ZMQIOLoop object>)
172 )
173 return loop
174
175 def start(self):
176 try:
--> 177 super(ZMQIOLoop, self).start()
self.start = <bound method ZMQIOLoop.start of <zmq.eventloop.ioloop.ZMQIOLoop object>>
178 except ZMQError as e:
179 if e.errno == ETERM:
180 # quietly return on ETERM
181 pass
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/tornado/ioloop.py in start(self=<zmq.eventloop.ioloop.ZMQIOLoop object>)
882 self._events.update(event_pairs)
883 while self._events:
884 fd, events = self._events.popitem()
885 try:
886 fd_obj, handler_func = self._handlers[fd]
--> 887 handler_func(fd_obj, events)
handler_func = <function null_wrapper>
fd_obj = <zmq.sugar.socket.Socket object>
events = 1
888 except (OSError, IOError) as e:
889 if errno_from_exception(e) == errno.EPIPE:
890 # Happens when the client closes the connection
891 pass
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=(<zmq.sugar.socket.Socket object>, 1), **kwargs={})
270 # Fast path when there are no active contexts.
271 def null_wrapper(*args, **kwargs):
272 try:
273 current_state = _state.contexts
274 _state.contexts = cap_contexts[0]
--> 275 return fn(*args, **kwargs)
args = (<zmq.sugar.socket.Socket object>, 1)
kwargs = {}
276 finally:
277 _state.contexts = current_state
278 null_wrapper._wrapped = True
279 return null_wrapper
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_events(self=<zmq.eventloop.zmqstream.ZMQStream object>, fd=<zmq.sugar.socket.Socket object>, events=1)
435 # dispatch events:
436 if events & IOLoop.ERROR:
437 gen_log.error("got POLLERR event on ZMQStream, which doesn't make sense")
438 return
439 if events & IOLoop.READ:
--> 440 self._handle_recv()
self._handle_recv = <bound method ZMQStream._handle_recv of <zmq.eventloop.zmqstream.ZMQStream object>>
441 if not self.socket:
442 return
443 if events & IOLoop.WRITE:
444 self._handle_send()
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_recv(self=<zmq.eventloop.zmqstream.ZMQStream object>)
467 gen_log.error("RECV Error: %s"%zmq.strerror(e.errno))
468 else:
469 if self._recv_callback:
470 callback = self._recv_callback
471 # self._recv_callback = None
--> 472 self._run_callback(callback, msg)
self._run_callback = <bound method ZMQStream._run_callback of <zmq.eventloop.zmqstream.ZMQStream object>>
callback = <function null_wrapper>
msg = [<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>]
473
474 # self.update_state()
475
476
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _run_callback(self=<zmq.eventloop.zmqstream.ZMQStream object>, callback=<function null_wrapper>, *args=([<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>],), **kwargs={})
409 close our socket."""
410 try:
411 # Use a NullContext to ensure that all StackContexts are run
412 # inside our blanket exception handler rather than outside.
413 with stack_context.NullContext():
--> 414 callback(*args, **kwargs)
callback = <function null_wrapper>
args = ([<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>],)
kwargs = {}
415 except:
416 gen_log.error("Uncaught exception, closing connection.",
417 exc_info=True)
418 # Close the socket on an uncaught exception from a user callback
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=([<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>],), **kwargs={})
270 # Fast path when there are no active contexts.
271 def null_wrapper(*args, **kwargs):
272 try:
273 current_state = _state.contexts
274 _state.contexts = cap_contexts[0]
--> 275 return fn(*args, **kwargs)
args = ([<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>],)
kwargs = {}
276 finally:
277 _state.contexts = current_state
278 null_wrapper._wrapped = True
279 return null_wrapper
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py in dispatcher(msg=[<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>])
276 if self.control_stream:
277 self.control_stream.on_recv(self.dispatch_control, copy=False)
278
279 def make_dispatcher(stream):
280 def dispatcher(msg):
--> 281 return self.dispatch_shell(stream, msg)
msg = [<zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>, <zmq.sugar.frame.Frame object>]
282 return dispatcher
283
284 for s in self.shell_streams:
285 s.on_recv(make_dispatcher(s), copy=False)
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py in dispatch_shell(self=<IPython.kernel.zmq.ipkernel.Kernel object>, stream=<zmq.eventloop.zmqstream.ZMQStream object>, msg={'buffers': [], 'content': {'allow_stdin': True, 'code': '%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', 'silent': False, 'store_history': True, 'user_expressions': {}, 'user_variables': []}, 'header': {'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'session': '92FEB9D677E542DC8998AB28EBC4E54F', 'username': 'username'}, 'metadata': {}, 'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'parent_header': {}})
240 self.log.error("UNKNOWN MESSAGE TYPE: %r", msg_type)
241 else:
242 # ensure default_int_handler during handler call
243 sig = signal(SIGINT, default_int_handler)
244 try:
--> 245 handler(stream, idents, msg)
handler = <bound method Kernel.execute_request of <IPython.kernel.zmq.ipkernel.Kernel object>>
stream = <zmq.eventloop.zmqstream.ZMQStream object>
idents = ['92FEB9D677E542DC8998AB28EBC4E54F']
msg = {'buffers': [], 'content': {'allow_stdin': True, 'code': '%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', 'silent': False, 'store_history': True, 'user_expressions': {}, 'user_variables': []}, 'header': {'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'session': '92FEB9D677E542DC8998AB28EBC4E54F', 'username': 'username'}, 'metadata': {}, 'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'parent_header': {}}
246 except Exception:
247 self.log.error("Exception in message handler:", exc_info=True)
248 finally:
249 signal(SIGINT, sig)
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py in execute_request(self=<IPython.kernel.zmq.ipkernel.Kernel object>, stream=<zmq.eventloop.zmqstream.ZMQStream object>, ident=['92FEB9D677E542DC8998AB28EBC4E54F'], parent={'buffers': [], 'content': {'allow_stdin': True, 'code': '%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', 'silent': False, 'store_history': True, 'user_expressions': {}, 'user_variables': []}, 'header': {'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'session': '92FEB9D677E542DC8998AB28EBC4E54F', 'username': 'username'}, 'metadata': {}, 'msg_id': 'BC6CF48DB7A74F308D8573D19558D0DF', 'msg_type': 'execute_request', 'parent_header': {}})
384
385 reply_content = {}
386 # FIXME: the shell calls the exception handler itself.
387 shell._reply_content = None
388 try:
--> 389 shell.run_cell(code, store_history=store_history, silent=silent)
shell.run_cell = <bound method ZMQInteractiveShell.run_cell of <I....kernel.zmq.zmqshell.ZMQInteractiveShell object>>
code = u'%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)'
store_history = True
silent = False
390 except:
391 status = u'error'
392 # FIXME: this code right now isn't being used yet by default,
393 # because the run_cell() call above directly fires off exception
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_cell(self=<IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object>, raw_cell=u'%time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', store_history=True, silent=False, shell_futures=True)
2736 code_ast = self.transform_ast(code_ast)
2737
2738 # Execute the user code
2739 interactivity = "none" if silent else self.ast_node_interactivity
2740 self.run_ast_nodes(code_ast.body, cell_name,
-> 2741 interactivity=interactivity, compiler=compiler)
interactivity = 'last_expr'
compiler = <IPython.core.compilerop.CachingCompiler instance>
2742
2743 self.events.trigger('post_execute')
2744 if not silent:
2745 self.events.trigger('post_run_cell')
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_ast_nodes(self=<IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object>, nodelist=[<_ast.Expr object>], cell_name='<ipython-input-60-3837ff67a0d5>', interactivity='last', compiler=<IPython.core.compilerop.CachingCompiler instance>)
2828 return True
2829
2830 for i, node in enumerate(to_run_interactive):
2831 mod = ast.Interactive([node])
2832 code = compiler(mod, cell_name, "single")
-> 2833 if self.run_code(code):
self.run_code = <bound method ZMQInteractiveShell.run_code of <I....kernel.zmq.zmqshell.ZMQInteractiveShell object>>
code = <code object <module> at 0x7efd555a4bb0, file "<ipython-input-60-3837ff67a0d5>", line 1>
2834 return True
2835
2836 # Flush softspace
2837 if softspace(sys.stdout, 0):
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_code(self=<IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object>, code_obj=<code object <module> at 0x7efd555a4bb0, file "<ipython-input-60-3837ff67a0d5>", line 1>)
2878 outflag = 1 # happens in more places, so it's easier as default
2879 try:
2880 try:
2881 self.hooks.pre_run_code_hook()
2882 #rprint('Running code', repr(code_obj)) # dbg
-> 2883 exec(code_obj, self.user_global_ns, self.user_ns)
code_obj = <code object <module> at 0x7efd555a4bb0, file "<ipython-input-60-3837ff67a0d5>", line 1>
self.user_global_ns = {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}
self.user_ns = {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}
2884 finally:
2885 # Reset our crash handler in place
2886 sys.excepthook = old_excepthook
2887 except SystemExit:
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/scratch/<ipython-input-60-3837ff67a0d5> in <module>()
----> 1 get_ipython().magic(u'time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)')
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.py in magic(self=<IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object>, arg_s=u'time res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)')
2200 compound statements.
2201 """
2202 # TODO: should we issue a loud deprecation warning here?
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
self.run_line_magic = <bound method ZMQInteractiveShell.run_line_magic....kernel.zmq.zmqshell.ZMQInteractiveShell object>>
magic_name = u'time'
magic_arg_s = u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)'
2206
2207 #-------------------------------------------------------------------------
2208 # Things related to macros
2209 #-------------------------------------------------------------------------
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self=<IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object>, magic_name=u'time', line=u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)')
2121 kwargs = {}
2122 # Grab local namespace if we need it:
2123 if getattr(fn, "needs_local_scope", False):
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
result = undefined
fn = <bound method ExecutionMagics.time of <IPython.core.magics.execution.ExecutionMagics object>>
args = [u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)']
kwargs = {'local_ns': {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([[...]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([[...]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([[...]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([[...]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([[...]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([[...]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([[...]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([[...]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([[...]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}}
2127 return result
2128
2129 def run_cell_magic(self, magic_name, line, cell):
2130 """Execute the given cell magic.
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/scratch/<decorator-gen-60> in time(self=<IPython.core.magics.execution.ExecutionMagics object>, line=u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', cell=None, local_ns={'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...})
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/magic.py in <lambda>(f=<function time>, *a=(<IPython.core.magics.execution.ExecutionMagics object>, u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', None, {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([[...]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([[...]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([[...]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([[...]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([[...]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([[...]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([[...]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([[...]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([[...]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}), **k={})
188 validate_type(magic_kind)
189
190 # This is a closure to capture the magic_kind. We could also use a class,
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
f = <function time>
a = (<IPython.core.magics.execution.ExecutionMagics object>, u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', None, {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([[...]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([[...]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([[...]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([[...]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([[...]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([[...]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([[...]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([[...]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([[...]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([[...]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([[...]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([[...]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([[...]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...})
k = {}
194
195 if callable(arg):
196 # "Naked" decorator call (just @foo, no args)
197 func = arg
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/IPython/core/magics/execution.py in time(self=<IPython.core.magics.execution.ExecutionMagics object>, line=u'res = Parallel(n_jobs=2)(delayed(chs)(va,test_file,[idx]) for idx in idxs)', cell=None, local_ns={'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...})
1124 st = clock2()
1125 out = eval(code, glob, local_ns)
1126 end = clock2()
1127 else:
1128 st = clock2()
-> 1129 exec(code, glob, local_ns)
code = <code object <module> at 0x7efd555a4db0, file "<timed exec>", line 1>
glob = {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}
local_ns = {'ConWhAt': <module 'ConWhAt' from '/home/jgriffiths/Code/li...ies_of_mine/github/ConWhAt/ConWhAt/__init__.pyc'>, 'In': ['', u"import pandas as pd\nget_ipython().magic(u'mat...arn.plotting import plot_stat_map\nimport os,sys", u"get_ipython().magic(u'run ~/set_localenv_vars.py')", u"conwhat_dir = le['code_dir'] + '/libraries_of_...chdir(scratch_dir)\nsys.path.append(conwhat_dir)", u'import numpy as np\nimport ConWhAt\nfrom ConWh...At.volumetric.utils import get_bounding_box_inds', u"va = VolConnAtlas('dipy_dsi_sd4_l2k8_sc33_v2')", u'va.image_file_mappings', u'va.bboxes', u"test_file = 'test_lesionmask_rs1mm.nii.gz'", u'plot_stat_map(test_file,vmax=2.)', u'from nilearn.image import index_img', u'ifmaps = va.image_file_mappings.ix[0]', u'test_bbox = get_bounding_box_inds(test_file)', u'bb_isoverlapping,bb_propoverlapping = va.compute_roi_bbox_overlaps(test_file)', u'#bb_isoverlapping', u'np.nonzero(bb_isoverlapping)[0].shape', u"idxs = range(50) # [1,2,3] # 'all' #range(1000)#[0,1,2,3]", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats_test(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", u"get_ipython().magic(u'time hs_res,hs_df= va.compute_hit_stats(test_file,idxs)')", ...], 'Out': {6: name ... 81 0
[2480 rows x 4 columns], 7: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 9: <nilearn.plotting.displays.OrthoSlicer object>, 15: (1682,), 29: name ... 81 0
[2480 rows x 4 columns], 30: xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], 39: [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], 40: 50, 41: ([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), 42: [['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], ...}, 'Parallel': <class 'joblib.parallel.Parallel'>, 'VolConnAtlas': <class ConWhAt.volumetric.atlas_volumetric.VolConnAtlas>, '_': (2480, 6), '_15': (1682,), '_29': name ... 81 0
[2480 rows x 4 columns], '_30': xmin xmax ymin ymax zmin zmax
0 ... 74 136 29 145
[2480 rows x 6 columns], '_39': [([['0_to_1', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 0, {'ACC': 0.97752579547250895, 'BM': 0.97752561328121024, 'F1': 0.00072089540180596723, 'FDR': 0.99963945, 'FN': 0, 'FNR': 0.0, 'FP': 160795.0, 'FPR': 0.022474386718789856, 'MCC': 0.018774288489603618, 'MK': 0.00036057765828445554, ...}]], val
structure me... 0.000000e+00
PPV 3.605777e-04), ([['0_to_2', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 1, {'ACC': 0.9823514670094956, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 126268.0, 'FPR': 0.017648532990504416, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_3', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 2, {'ACC': 0.98488899921435036, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 108113.0, 'FPR': 0.015111000785649602, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_4', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 3, {'ACC': 0.9761131042132446, 'BM': 0.97611281374793157, 'F1': 0.0010170858736124669, 'FDR': 0.99949121, 'FN': 0, 'FNR': 0.0, 'FP': 170903.0, 'FPR': 0.023887186252068426, 'MCC': 0.02228559722579963, 'MK': 0.00050880166236311197, ...}]], val
structure me... 0.000000e+00
PPV 5.088017e-04), ([['0_to_5', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 4, {'ACC': 0.97586092961445803, 'BM': 0.97586052811698898, 'F1': 0.001376152093717114, 'FDR': 0.99931145, 'FN': 0, 'FNR': 0.0, 'FP': 172708.0, 'FPR': 0.024139471883011028, 'MCC': 0.025921585453858722, 'MK': 0.000688549829646945, ...}]], val
structure me... 0.000000e+00
PPV 6.885498e-04), ([['0_to_6', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 5, {'ACC': 0.97393781420968184, 'BM': 0.97393756650451913, 'F1': 0.00072882391399877811, 'FDR': 0.99963546, 'FN': 0, 'FNR': 0.0, 'FP': 186466.0, 'FPR': 0.026062433495481013, 'MCC': 0.018842608015853697, 'MK': 0.00036454480141401291, ...}]], val
structure me... 0.000000e+00
PPV 3.645448e-04), ([['0_to_7', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 6, {'ACC': 0.9617815085458773, 'BM': 0.96178103312433461, 'F1': 0.00065053961895920973, 'FDR': 0.99967462, 'FN': 0, 'FNR': 0.0, 'FP': 273441.0, 'FPR': 0.038218966875665394, 'MCC': 0.017690113718678017, 'MK': 0.00032537564402446151, ...}]], val
structure me... 0.000000e+00
PPV 3.253756e-04), ([['0_to_8', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 7, {'ACC': 0.93880112349517175, 'BM': 0.93879005488645118, 'F1': 0.0058748751475528917, 'FDR': 0.99705392, 'FN': 0, 'FNR': 0.0, 'FP': 437932.0, 'FPR': 0.061209945113548804, 'MCC': 0.05259050705843709, 'MK': 0.0029460915829986334, ...}]], val
structure me... 0.000000e+00
PPV 2.946092e-03), ([['0_to_9', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 8, {'ACC': 0.97448700407528654, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 182535.0, 'FPR': 0.025512995924713493, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_10', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 9, {'ACC': 0.96044331747980294, 'BM': 0.96043825857781639, 'F1': 0.0064238024698291905, 'FDR': 0.99677777, 'FN': 0, 'FNR': 0.0, 'FP': 283048.0, 'FPR': 0.039561741422183723, 'MCC': 0.055630683384200318, 'MK': 0.0032222508452832699, ...}]], val
structure me... 0.000000e+00
PPV 3.222251e-03), ([['0_to_11', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 10, {'ACC': 0.97781851389449426, 'BM': 0.97780711093257766, 'F1': 0.044276711388793584, 'FDR': 0.97736043, 'FN': 0, 'FNR': 0.0, 'FP': 158781.0, 'FPR': 0.022192889067422322, 'MCC': 0.14878548680203829, 'MK': 0.022639557719230652, ...}]], val
structure me... 0.000000e+00
PPV 2.263956e-02), ([['0_to_12', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 11, {'ACC': 0.98650935784012195, 'BM': nan, 'F1': 0.0, 'FDR': 1.0, 'FN': 0, 'FNR': nan, 'FP': 96520.0, 'FPR': 0.013490642159878087, 'MCC': nan, 'MK': 0.0, ...}]], val
structure me... 0.000000e+00
PPV 0.000000e+00), ([['0_to_13', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 12, {'ACC': 0.98199563161978232, 'BM': 0.98199561148795533, 'F1': 0.00012419467515330281, 'FDR': 0.99993789, 'FN': 0, 'FNR': 0.0, 'FP': 128814.0, 'FPR': 0.018004388512044507, 'MCC': 0.0078091676812255166, 'MK': 6.2101193179842085e-05, ...}]], val
structure me... 0.000000e+00
PPV 6.210119e-05), ([['0_to_14', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 13, {'ACC': 0.98179222654587039, 'BM': 0.98179126711541365, 'F1': 0.0057544073876211552, 'FDR': 0.99711448, 'FN': 0, 'FNR': 0.0, 'FP': 130276.0, 'FPR': 0.018208732884586382, 'MCC': 0.053225599819547838, 'MK': 0.0028855057898908854, ...}]], val
structure me... 0.000000e+00
PPV 2.885506e-03), ([['0_to_15', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 14, {'ACC': 0.98251813096839136, 'BM': 0.98251639612002872, 'F1': 0.011224586587409493, 'FDR': 0.99435604, 'FN': 0, 'FNR': 0.0, 'FP': 125088.0, 'FPR': 0.017483603879971301, 'MCC': 0.074466717303259891, 'MK': 0.0056439689360558987, ...}]], val
structure me... 0.000000e+00
PPV 5.643969e-03), ([['0_to_16', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 15, {'ACC': 0.96616054497188775, 'BM': 0.96614396717966611, 'F1': 0.028125952912099374, 'FDR': 0.98573643, 'FN': 0, 'FNR': 0.0, 'FP': 242226.0, 'FPR': 0.033856032820333913, 'MCC': 0.1173910427476479, 'MK': 0.014263564720749855, ...}]], val
structure me... 0.000000e+00
PPV 1.426356e-02), ([['0_to_17', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 16, {'ACC': 0.96964993660823895, 'BM': 0.96964605514027435, 'F1': 0.0083561643835616435, 'FDR': 0.99580437, 'FN': 0, 'FNR': 0.0, 'FP': 217170.0, 'FPR': 0.030353944859725694, 'MCC': 0.063782900791860803, 'MK': 0.0041956119239330292, ...}]], val
structure me... 0.000000e+00
PPV 4.195612e-03), ([['0_to_18', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 17, {'ACC': 0.93776892248959487, 'BM': 0.93769509331703049, 'F1': 0.036685669336260808, 'FDR': 0.98131442, 'FN': 0, 'FNR': 0.0, 'FP': 445766.0, 'FPR': 0.062304906682969487, 'MCC': 0.13236834138876089, 'MK': 0.018685581162571907, ...}]], val
structure me... 0.000000e+00
PPV 1.868558e-02), ([['0_to_19', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 18, {'ACC': 0.94944166919550954, 'BM': 0.9493983511841142, 'F1': 0.032755000080150899, 'FDR': 0.9833498, 'FN': 0, 'FNR': 0.0, 'FP': 362034.0, 'FPR': 0.050601648815885858, 'MCC': 0.1257285230630075, 'MK': 0.016650188714265823, ...}]], val
structure me... 0.000000e+00
PPV 1.665019e-02), ([['0_to_20', '/home/jgriffiths/Code/libraries_of_mine/github/C...sd4_l2k8_sc33_v2/vismap_grp_cat_rois0_norm.nii.gz', 19, {'ACC': 0.94943766989955247, 'BM': 0.94935963477426855, 'F1': 0.057451319606134317, 'FDR': 0.97042477, 'FN': 0, 'FNR': 0.0, 'FP': 362311.0, 'FPR': 0.050640365225731343, 'MCC': 0.16756350258776057, 'MK': 0.029575226828455925, ...}]], val
structure me... 0.000000e+00
PPV 2.957523e-02), ...], ...}
1130 end = clock2()
1131 out = None
1132 wall_end = wtime()
1133 # Compute actual times and report
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/scratch/<timed exec> in <module>()
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/joblib/parallel.py in __call__(self=Parallel(n_jobs=2), iterable=<generator object <genexpr>>)
784 if pre_dispatch == "all" or n_jobs == 1:
785 # The iterable was consumed all at once by the above for loop.
786 # No need to wait for async callbacks to trigger to
787 # consumption.
788 self._iterating = False
--> 789 self.retrieve()
self.retrieve = <bound method Parallel.retrieve of Parallel(n_jobs=2)>
790 # Make sure that we get a last message telling us we are done
791 elapsed_time = time.time() - self._start_time
792 self._print('Done %3i out of %3i | elapsed: %s finished',
793 (len(self._output), len(self._output),
---------------------------------------------------------------------------
Sub-process traceback:
---------------------------------------------------------------------------
ValueError Tue Mar 7 23:31:58 2017
PID: 2492Python 2.7.12: /home/jgriffiths/Software/anaconda2/envs/ipython2.4/bin/python
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/joblib/parallel.py in __call__(self=<joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function chs>
args = (<ConWhAt.volumetric.atlas_volumetric.VolConnAtlas instance>, 'test_lesionmask_rs1mm.nii.gz', [83])
kwargs = {}
self.items = [(<function chs>, (<ConWhAt.volumetric.atlas_volumetric.VolConnAtlas instance>, 'test_lesionmask_rs1mm.nii.gz', [83]), {})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/scratch/<ipython-input-36-ae26bc98c679> in chs(va=<ConWhAt.volumetric.atlas_volumetric.VolConnAtlas instance>, test_file='test_lesionmask_rs1mm.nii.gz', idxs=[83])
1 def chs(va,test_file,idxs):
----> 2 return va.compute_hit_stats(test_file,idxs)
...........................................................................
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/volumetric/atlas_volumetric.py in compute_hit_stats(self=<ConWhAt.volumetric.atlas_volumetric.VolConnAtlas instance>, roi_file='test_lesionmask_rs1mm.nii.gz', idxs=[], readwith='indexgzip')
108
109 res.append([_name,_nii_file,_4dvolind,comp])
110
111
112 df = pd.concat({r[0]: pd.DataFrame(r[3].values(),index=r[3].keys(),
--> 113 columns=['val']) for r in res})
res = []
114 df.index.names = ['structure', 'metric']
115
116 return res,df
117
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/pandas/tools/merge.py in concat(objs={}, axis=0, join='outer', join_axes=None, ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False, copy=True)
1446 """
1447 op = _Concatenator(objs, axis=axis, join_axes=join_axes,
1448 ignore_index=ignore_index, join=join,
1449 keys=keys, levels=levels, names=names,
1450 verify_integrity=verify_integrity,
-> 1451 copy=copy)
copy = True
1452 return op.get_result()
1453
1454
1455 class _Concatenator(object):
...........................................................................
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/pandas/tools/merge.py in __init__(self=<pandas.tools.merge._Concatenator object>, objs=[], axis=0, join='outer', join_axes=None, keys=[], levels=None, names=None, ignore_index=False, verify_integrity=False, copy=True)
1479 objs = [objs[k] for k in keys]
1480 else:
1481 objs = list(objs)
1482
1483 if len(objs) == 0:
-> 1484 raise ValueError('No objects to concatenate')
1485
1486 if keys is None:
1487 objs = [obj for obj in objs if obj is not None]
1488 else:
ValueError: No objects to concatenate
___________________________________________________________________________
In [56]:
%time res = Parallel(n_jobs=5)(delayed(chs)(va,test_file,[idx]) for idx in idxs)
CPU times: user 748 ms, sys: 224 ms, total: 972 ms
Wall time: 49.3 s
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gzcomputing hit stats for roi test_lesionmask_rs1mm.nii.gz
In [ ]:
%time res = Parallel(n_jobs=3)(delayed(chs)(va,test_file,[idx]) for idx in idxs)
In [40]:
len(res)
Out[40]:
50
In [51]:
reses = pd.concat([r[1] for r in res])
In [53]:
reses.unstack('metric')
Out[53]:
val
metric
ACC
BM
F1
FDR
FN
FNR
FP
FPR
MCC
MK
NPV
PPV
TN
TNR
TP
TPR
corr_nothr
corr_thr
corr_thrbin
structure
0_to_1
0.977526
0.977526
0.000721
0.999639
0.0
0.0
160795.0
0.022474
0.018774
0.000361
1.0
0.000361
6993794.0
0.977526
58.0
1.0
-0.007156
-0.007156
-0.013976
0_to_10
0.960443
0.960438
0.006424
0.996778
0.0
0.0
283048.0
0.039562
0.055631
0.003222
1.0
0.003222
6871541.0
0.960438
915.0
1.0
-0.010794
-0.010794
-0.012669
0_to_11
0.977819
0.977807
0.044277
0.977360
0.0
0.0
158781.0
0.022193
0.148785
0.022640
1.0
0.022640
6995808.0
0.977807
3678.0
1.0
-0.004460
-0.004460
0.021352
0_to_12
0.986509
NaN
0.000000
1.000000
0.0
NaN
96520.0
0.013491
NaN
0.000000
1.0
0.000000
7058069.0
0.986509
0.0
NaN
-0.005991
-0.005991
-0.011217
0_to_13
0.981996
0.981996
0.000124
0.999938
0.0
0.0
128814.0
0.018004
0.007809
0.000062
1.0
0.000062
7025775.0
0.981996
8.0
1.0
-0.006894
-0.006894
-0.012900
0_to_14
0.981792
0.981791
0.005754
0.997114
0.0
0.0
130276.0
0.018209
0.053226
0.002886
1.0
0.002886
7024313.0
0.981791
377.0
1.0
-0.006887
-0.006887
-0.008979
0_to_15
0.982518
0.982516
0.011225
0.994356
0.0
0.0
125088.0
0.017484
0.074467
0.005644
1.0
0.005644
7029501.0
0.982516
710.0
1.0
-0.005507
-0.005507
-0.004961
0_to_16
0.966161
0.966144
0.028126
0.985736
0.0
0.0
242226.0
0.033856
0.117391
0.014264
1.0
0.014264
6912363.0
0.966144
3505.0
1.0
-0.007620
-0.007620
0.009951
0_to_17
0.969650
0.969646
0.008356
0.995804
0.0
0.0
217170.0
0.030354
0.063783
0.004196
1.0
0.004196
6937419.0
0.969646
915.0
1.0
-0.008805
-0.008805
-0.009252
0_to_18
0.937769
0.937695
0.036686
0.981314
0.0
0.0
445766.0
0.062305
0.132368
0.018686
1.0
0.018686
6708823.0
0.937695
8488.0
1.0
-0.004445
-0.004445
0.025736
0_to_19
0.949442
0.949398
0.032755
0.983350
0.0
0.0
362034.0
0.050602
0.125729
0.016650
1.0
0.016650
6792555.0
0.949398
6130.0
1.0
-0.008622
-0.008622
0.018082
0_to_2
0.982351
NaN
0.000000
1.000000
0.0
NaN
126268.0
0.017649
NaN
0.000000
1.0
0.000000
7028321.0
0.982351
0.0
NaN
-0.006291
-0.006291
-0.012856
0_to_20
0.949438
0.949360
0.057451
0.970425
0.0
0.0
362311.0
0.050640
0.167564
0.029575
1.0
0.029575
6792278.0
0.949360
11042.0
1.0
0.002156
0.002156
0.049825
0_to_21
0.980765
0.980764
0.004456
0.997767
0.0
0.0
137628.0
0.019236
0.046797
0.002233
1.0
0.002233
7016961.0
0.980764
308.0
1.0
-0.007236
-0.007236
-0.010185
0_to_22
0.975974
0.975973
0.002229
0.998884
0.0
0.0
171903.0
0.024027
0.032998
0.001116
1.0
0.001116
6982686.0
0.975973
192.0
1.0
-0.008307
-0.008307
-0.013232
0_to_23
0.964924
0.964918
0.008618
0.995672
0.0
0.0
250995.0
0.035082
0.064622
0.004328
1.0
0.004328
6903594.0
0.964918
1091.0
1.0
-0.009853
-0.009853
-0.009708
0_to_24
0.970015
0.970014
0.001703
0.999148
0.0
0.0
214536.0
0.029986
0.028753
0.000852
1.0
0.000852
6940053.0
0.970014
183.0
1.0
-0.008978
-0.008978
-0.015308
0_to_25
0.969408
0.969407
0.001760
0.999119
0.0
0.0
218877.0
0.030593
0.029224
0.000881
1.0
0.000881
6935712.0
0.969407
193.0
1.0
-0.008965
-0.008965
-0.015414
0_to_26
0.981198
0.981198
0.003747
0.998123
0.0
0.0
134523.0
0.018802
0.042917
0.001877
1.0
0.001877
7020066.0
0.981198
253.0
1.0
-0.006182
-0.006182
-0.010579
0_to_27
0.987582
0.987582
0.006664
0.996657
0.0
0.0
88846.0
0.012418
0.057458
0.003343
1.0
0.003343
7065743.0
0.987582
298.0
1.0
-0.004908
-0.004908
-0.006860
0_to_28
0.985510
0.985510
0.000482
0.999759
0.0
0.0
103668.0
0.014490
0.015414
0.000241
1.0
0.000241
7050921.0
0.985510
25.0
1.0
-0.005623
-0.005623
-0.011327
0_to_29
0.962598
0.962585
0.018703
0.990560
0.0
0.0
267688.0
0.037415
0.095324
0.009440
1.0
0.009440
6886901.0
0.962585
2551.0
1.0
-0.008609
-0.008609
0.000492
0_to_3
0.984889
NaN
0.000000
1.000000
0.0
NaN
108113.0
0.015111
NaN
0.000000
1.0
0.000000
7046476.0
0.984889
0.0
NaN
-0.006274
-0.006274
-0.011881
0_to_30
0.957921
0.957903
0.019966
0.989916
0.0
0.0
301189.0
0.042097
0.098281
0.010084
1.0
0.010084
6853400.0
0.957903
3068.0
1.0
-0.009003
-0.009003
0.001938
0_to_31
0.983811
0.983809
0.014916
0.992486
0.0
0.0
115839.0
0.016191
0.085979
0.007514
1.0
0.007514
7038750.0
0.983809
877.0
1.0
-0.005148
-0.005148
-0.002265
0_to_32
0.964524
0.964511
0.019615
0.990095
0.0
0.0
253908.0
0.035489
0.097740
0.009905
1.0
0.009905
6900681.0
0.964511
2540.0
1.0
-0.008172
-0.008172
0.001413
0_to_33
0.989731
0.989731
0.013375
0.993268
0.0
0.0
73473.0
0.010269
0.081629
0.006732
1.0
0.006732
7081116.0
0.989731
498.0
1.0
-0.003998
-0.003998
-0.002631
0_to_34
0.962361
0.962359
0.003368
0.998313
0.0
0.0
269307.0
0.037641
0.040289
0.001687
1.0
0.001687
6885282.0
0.962359
455.0
1.0
-0.009268
-0.009268
-0.015504
0_to_35
0.948524
0.948489
0.025434
0.987119
0.0
0.0
368540.0
0.051511
0.110531
0.012881
1.0
0.012881
6786049.0
0.948489
4809.0
1.0
-0.006879
-0.006879
0.008998
0_to_36
0.971266
0.971263
0.007070
0.996452
0.0
0.0
205603.0
0.028737
0.058700
0.003548
1.0
0.003548
6948986.0
0.971263
732.0
1.0
-0.007890
-0.007890
-0.010155
0_to_37
0.937131
0.937110
0.010881
0.994530
0.0
0.0
449955.0
0.062890
0.071599
0.005470
1.0
0.005470
6704634.0
0.937110
2475.0
1.0
-0.012160
-0.012160
-0.010102
0_to_38
0.965285
0.965279
0.009592
0.995181
0.0
0.0
248416.0
0.034721
0.068206
0.004819
1.0
0.004819
6906173.0
0.965279
1203.0
1.0
-0.008605
-0.008605
-0.008684
0_to_39
0.989136
NaN
0.000000
1.000000
0.0
NaN
77729.0
0.010864
NaN
0.000000
1.0
0.000000
7076860.0
0.989136
0.0
NaN
-0.004825
-0.004825
-0.010053
0_to_4
0.976113
0.976113
0.001017
0.999491
0.0
0.0
170903.0
0.023887
0.022286
0.000509
1.0
0.000509
6983686.0
0.976113
87.0
1.0
-0.007801
-0.007801
-0.014178
0_to_40
0.974390
0.974387
0.009695
0.995129
0.0
0.0
183254.0
0.025613
0.068893
0.004871
1.0
0.004871
6971335.0
0.974387
897.0
1.0
-0.007021
-0.007021
-0.007337
0_to_41
0.990110
0.990110
0.000509
0.999746
0.0
0.0
70758.0
0.009890
0.015868
0.000254
1.0
0.000254
7083831.0
0.990110
18.0
1.0
-0.004438
-0.004438
-0.009323
0_to_42
0.978381
0.978375
0.025681
0.986993
0.0
0.0
154719.0
0.021625
0.112810
0.013007
1.0
0.013007
6999870.0
0.978375
2039.0
1.0
-0.006247
-0.006247
0.005938
0_to_43
0.982570
0.982565
0.030136
0.984701
0.0
0.0
124740.0
0.017435
0.122605
0.015299
1.0
0.015299
7029849.0
0.982565
1938.0
1.0
-0.004460
-0.004460
0.008533
0_to_44
0.988748
0.988748
0.000794
0.999603
0.0
0.0
80507.0
0.011252
0.019820
0.000397
1.0
0.000397
7074082.0
0.988748
32.0
1.0
-0.005492
-0.005492
-0.009793
0_to_45
0.982259
0.982258
0.009983
0.994983
0.0
0.0
126939.0
0.017742
0.070196
0.005016
1.0
0.005016
7027650.0
0.982258
640.0
1.0
-0.006501
-0.006501
-0.005878
0_to_46
0.980242
0.980225
0.081357
0.957596
0.0
0.0
141482.0
0.019775
0.203875
0.042404
1.0
0.042404
7013107.0
0.980225
6265.0
1.0
0.001284
0.001284
0.050257
0_to_47
0.976751
0.976664
0.242354
0.862115
0.0
0.0
166958.0
0.023336
0.366971
0.137885
1.0
0.137885
6987631.0
0.976664
26703.0
1.0
0.083937
0.083937
0.223734
0_to_48
0.962036
0.961986
0.064809
0.966510
0.0
0.0
271976.0
0.038014
0.179490
0.033490
1.0
0.033490
6882613.0
0.961986
9424.0
1.0
-0.002952
-0.002952
0.051224
0_to_49
0.946619
0.946518
0.066080
0.965831
0.0
0.0
382640.0
0.053482
0.179838
0.034169
1.0
0.034169
6771949.0
0.946518
13537.0
1.0
-0.001742
-0.001742
0.063003
0_to_5
0.975861
0.975861
0.001376
0.999311
0.0
0.0
172708.0
0.024139
0.025922
0.000689
1.0
0.000689
6981881.0
0.975861
119.0
1.0
-0.007159
-0.007159
-0.013961
0_to_50
0.978270
0.978208
0.208244
0.883777
0.0
0.0
155915.0
0.021792
0.337180
0.116223
1.0
0.116223
6998674.0
0.978208
20504.0
1.0
0.048494
0.048494
0.177378
0_to_6
0.973938
0.973938
0.000729
0.999635
0.0
0.0
186466.0
0.026062
0.018843
0.000365
1.0
0.000365
6968123.0
0.973938
68.0
1.0
-0.007744
-0.007744
-0.015071
0_to_7
0.961782
0.961781
0.000651
0.999675
0.0
0.0
273441.0
0.038219
0.017690
0.000325
1.0
0.000325
6881148.0
0.961781
89.0
1.0
-0.010213
-0.010213
-0.018445
0_to_8
0.938801
0.938790
0.005875
0.997054
0.0
0.0
437932.0
0.061210
0.052591
0.002946
1.0
0.002946
6716657.0
0.938790
1294.0
1.0
-0.014200
-0.014200
-0.016672
0_to_9
0.974487
NaN
0.000000
1.000000
0.0
NaN
182535.0
0.025513
NaN
0.000000
1.0
0.000000
6972054.0
0.974487
0.0
NaN
-0.008087
-0.008087
-0.015519
In [24]:
len(hs_res)
Out[24]:
50
In [25]:
hs_df.unstack('metric')
Out[25]:
val
metric
ACC
F1
FNR
TNR
BM
corr_thr
MCC
corr_thrbin
MK
TN
TP
FDR
corr_nothr
TPR
FPR
NPV
FP
FN
PPV
structure
0_to_1
0.977526
0.000721
0.0
0.977526
0.977526
-0.007156
0.018774
-0.013976
0.000361
6993794.0
58.0
0.999639
-0.007156
1.0
0.022474
1.0
160795.0
0.0
0.000361
0_to_10
0.960443
0.006424
0.0
0.960438
0.960438
-0.010794
0.055631
-0.012669
0.003222
6871541.0
915.0
0.996778
-0.010794
1.0
0.039562
1.0
283048.0
0.0
0.003222
0_to_11
0.977819
0.044277
0.0
0.977807
0.977807
-0.004460
0.148785
0.021352
0.022640
6995808.0
3678.0
0.977360
-0.004460
1.0
0.022193
1.0
158781.0
0.0
0.022640
0_to_12
0.986509
0.000000
NaN
0.986509
NaN
-0.005991
NaN
-0.011217
0.000000
7058069.0
0.0
1.000000
-0.005991
NaN
0.013491
1.0
96520.0
0.0
0.000000
0_to_13
0.981996
0.000124
0.0
0.981996
0.981996
-0.006894
0.007809
-0.012900
0.000062
7025775.0
8.0
0.999938
-0.006894
1.0
0.018004
1.0
128814.0
0.0
0.000062
0_to_14
0.981792
0.005754
0.0
0.981791
0.981791
-0.006887
0.053226
-0.008979
0.002886
7024313.0
377.0
0.997114
-0.006887
1.0
0.018209
1.0
130276.0
0.0
0.002886
0_to_15
0.982518
0.011225
0.0
0.982516
0.982516
-0.005507
0.074467
-0.004961
0.005644
7029501.0
710.0
0.994356
-0.005507
1.0
0.017484
1.0
125088.0
0.0
0.005644
0_to_16
0.966161
0.028126
0.0
0.966144
0.966144
-0.007620
0.117391
0.009951
0.014264
6912363.0
3505.0
0.985736
-0.007620
1.0
0.033856
1.0
242226.0
0.0
0.014264
0_to_17
0.969650
0.008356
0.0
0.969646
0.969646
-0.008805
0.063783
-0.009252
0.004196
6937419.0
915.0
0.995804
-0.008805
1.0
0.030354
1.0
217170.0
0.0
0.004196
0_to_18
0.937769
0.036686
0.0
0.937695
0.937695
-0.004445
0.132368
0.025736
0.018686
6708823.0
8488.0
0.981314
-0.004445
1.0
0.062305
1.0
445766.0
0.0
0.018686
0_to_19
0.949442
0.032755
0.0
0.949398
0.949398
-0.008622
0.125729
0.018082
0.016650
6792555.0
6130.0
0.983350
-0.008622
1.0
0.050602
1.0
362034.0
0.0
0.016650
0_to_2
0.982351
0.000000
NaN
0.982351
NaN
-0.006291
NaN
-0.012856
0.000000
7028321.0
0.0
1.000000
-0.006291
NaN
0.017649
1.0
126268.0
0.0
0.000000
0_to_20
0.949438
0.057451
0.0
0.949360
0.949360
0.002156
0.167564
0.049825
0.029575
6792278.0
11042.0
0.970425
0.002156
1.0
0.050640
1.0
362311.0
0.0
0.029575
0_to_21
0.980765
0.004456
0.0
0.980764
0.980764
-0.007236
0.046797
-0.010185
0.002233
7016961.0
308.0
0.997767
-0.007236
1.0
0.019236
1.0
137628.0
0.0
0.002233
0_to_22
0.975974
0.002229
0.0
0.975973
0.975973
-0.008307
0.032998
-0.013232
0.001116
6982686.0
192.0
0.998884
-0.008307
1.0
0.024027
1.0
171903.0
0.0
0.001116
0_to_23
0.964924
0.008618
0.0
0.964918
0.964918
-0.009853
0.064622
-0.009708
0.004328
6903594.0
1091.0
0.995672
-0.009853
1.0
0.035082
1.0
250995.0
0.0
0.004328
0_to_24
0.970015
0.001703
0.0
0.970014
0.970014
-0.008978
0.028753
-0.015308
0.000852
6940053.0
183.0
0.999148
-0.008978
1.0
0.029986
1.0
214536.0
0.0
0.000852
0_to_25
0.969408
0.001760
0.0
0.969407
0.969407
-0.008965
0.029224
-0.015414
0.000881
6935712.0
193.0
0.999119
-0.008965
1.0
0.030593
1.0
218877.0
0.0
0.000881
0_to_26
0.981198
0.003747
0.0
0.981198
0.981198
-0.006182
0.042917
-0.010579
0.001877
7020066.0
253.0
0.998123
-0.006182
1.0
0.018802
1.0
134523.0
0.0
0.001877
0_to_27
0.987582
0.006664
0.0
0.987582
0.987582
-0.004908
0.057458
-0.006860
0.003343
7065743.0
298.0
0.996657
-0.004908
1.0
0.012418
1.0
88846.0
0.0
0.003343
0_to_28
0.985510
0.000482
0.0
0.985510
0.985510
-0.005623
0.015414
-0.011327
0.000241
7050921.0
25.0
0.999759
-0.005623
1.0
0.014490
1.0
103668.0
0.0
0.000241
0_to_29
0.962598
0.018703
0.0
0.962585
0.962585
-0.008609
0.095324
0.000492
0.009440
6886901.0
2551.0
0.990560
-0.008609
1.0
0.037415
1.0
267688.0
0.0
0.009440
0_to_3
0.984889
0.000000
NaN
0.984889
NaN
-0.006274
NaN
-0.011881
0.000000
7046476.0
0.0
1.000000
-0.006274
NaN
0.015111
1.0
108113.0
0.0
0.000000
0_to_30
0.957921
0.019966
0.0
0.957903
0.957903
-0.009003
0.098281
0.001938
0.010084
6853400.0
3068.0
0.989916
-0.009003
1.0
0.042097
1.0
301189.0
0.0
0.010084
0_to_31
0.983811
0.014916
0.0
0.983809
0.983809
-0.005148
0.085979
-0.002265
0.007514
7038750.0
877.0
0.992486
-0.005148
1.0
0.016191
1.0
115839.0
0.0
0.007514
0_to_32
0.964524
0.019615
0.0
0.964511
0.964511
-0.008172
0.097740
0.001413
0.009905
6900681.0
2540.0
0.990095
-0.008172
1.0
0.035489
1.0
253908.0
0.0
0.009905
0_to_33
0.989731
0.013375
0.0
0.989731
0.989731
-0.003998
0.081629
-0.002631
0.006732
7081116.0
498.0
0.993268
-0.003998
1.0
0.010269
1.0
73473.0
0.0
0.006732
0_to_34
0.962361
0.003368
0.0
0.962359
0.962359
-0.009268
0.040289
-0.015504
0.001687
6885282.0
455.0
0.998313
-0.009268
1.0
0.037641
1.0
269307.0
0.0
0.001687
0_to_35
0.948524
0.025434
0.0
0.948489
0.948489
-0.006879
0.110531
0.008998
0.012881
6786049.0
4809.0
0.987119
-0.006879
1.0
0.051511
1.0
368540.0
0.0
0.012881
0_to_36
0.971266
0.007070
0.0
0.971263
0.971263
-0.007890
0.058700
-0.010155
0.003548
6948986.0
732.0
0.996452
-0.007890
1.0
0.028737
1.0
205603.0
0.0
0.003548
0_to_37
0.937131
0.010881
0.0
0.937110
0.937110
-0.012160
0.071599
-0.010102
0.005470
6704634.0
2475.0
0.994530
-0.012160
1.0
0.062890
1.0
449955.0
0.0
0.005470
0_to_38
0.965285
0.009592
0.0
0.965279
0.965279
-0.008605
0.068206
-0.008684
0.004819
6906173.0
1203.0
0.995181
-0.008605
1.0
0.034721
1.0
248416.0
0.0
0.004819
0_to_39
0.989136
0.000000
NaN
0.989136
NaN
-0.004825
NaN
-0.010053
0.000000
7076860.0
0.0
1.000000
-0.004825
NaN
0.010864
1.0
77729.0
0.0
0.000000
0_to_4
0.976113
0.001017
0.0
0.976113
0.976113
-0.007801
0.022286
-0.014178
0.000509
6983686.0
87.0
0.999491
-0.007801
1.0
0.023887
1.0
170903.0
0.0
0.000509
0_to_40
0.974390
0.009695
0.0
0.974387
0.974387
-0.007021
0.068893
-0.007337
0.004871
6971335.0
897.0
0.995129
-0.007021
1.0
0.025613
1.0
183254.0
0.0
0.004871
0_to_41
0.990110
0.000509
0.0
0.990110
0.990110
-0.004438
0.015868
-0.009323
0.000254
7083831.0
18.0
0.999746
-0.004438
1.0
0.009890
1.0
70758.0
0.0
0.000254
0_to_42
0.978381
0.025681
0.0
0.978375
0.978375
-0.006247
0.112810
0.005938
0.013007
6999870.0
2039.0
0.986993
-0.006247
1.0
0.021625
1.0
154719.0
0.0
0.013007
0_to_43
0.982570
0.030136
0.0
0.982565
0.982565
-0.004460
0.122605
0.008533
0.015299
7029849.0
1938.0
0.984701
-0.004460
1.0
0.017435
1.0
124740.0
0.0
0.015299
0_to_44
0.988748
0.000794
0.0
0.988748
0.988748
-0.005492
0.019820
-0.009793
0.000397
7074082.0
32.0
0.999603
-0.005492
1.0
0.011252
1.0
80507.0
0.0
0.000397
0_to_45
0.982259
0.009983
0.0
0.982258
0.982258
-0.006501
0.070196
-0.005878
0.005016
7027650.0
640.0
0.994983
-0.006501
1.0
0.017742
1.0
126939.0
0.0
0.005016
0_to_46
0.980242
0.081357
0.0
0.980225
0.980225
0.001284
0.203875
0.050257
0.042404
7013107.0
6265.0
0.957596
0.001284
1.0
0.019775
1.0
141482.0
0.0
0.042404
0_to_47
0.976751
0.242354
0.0
0.976664
0.976664
0.083937
0.366971
0.223734
0.137885
6987631.0
26703.0
0.862115
0.083937
1.0
0.023336
1.0
166958.0
0.0
0.137885
0_to_48
0.962036
0.064809
0.0
0.961986
0.961986
-0.002952
0.179490
0.051224
0.033490
6882613.0
9424.0
0.966510
-0.002952
1.0
0.038014
1.0
271976.0
0.0
0.033490
0_to_49
0.946619
0.066080
0.0
0.946518
0.946518
-0.001742
0.179838
0.063003
0.034169
6771949.0
13537.0
0.965831
-0.001742
1.0
0.053482
1.0
382640.0
0.0
0.034169
0_to_5
0.975861
0.001376
0.0
0.975861
0.975861
-0.007159
0.025922
-0.013961
0.000689
6981881.0
119.0
0.999311
-0.007159
1.0
0.024139
1.0
172708.0
0.0
0.000689
0_to_50
0.978270
0.208244
0.0
0.978208
0.978208
0.048494
0.337180
0.177378
0.116223
6998674.0
20504.0
0.883777
0.048494
1.0
0.021792
1.0
155915.0
0.0
0.116223
0_to_6
0.973938
0.000729
0.0
0.973938
0.973938
-0.007744
0.018843
-0.015071
0.000365
6968123.0
68.0
0.999635
-0.007744
1.0
0.026062
1.0
186466.0
0.0
0.000365
0_to_7
0.961782
0.000651
0.0
0.961781
0.961781
-0.010213
0.017690
-0.018445
0.000325
6881148.0
89.0
0.999675
-0.010213
1.0
0.038219
1.0
273441.0
0.0
0.000325
0_to_8
0.938801
0.005875
0.0
0.938790
0.938790
-0.014200
0.052591
-0.016672
0.002946
6716657.0
1294.0
0.997054
-0.014200
1.0
0.061210
1.0
437932.0
0.0
0.002946
0_to_9
0.974487
0.000000
NaN
0.974487
NaN
-0.008087
NaN
-0.015519
0.000000
6972054.0
0.0
1.000000
-0.008087
NaN
0.025513
1.0
182535.0
0.0
0.000000
In [ ]:
# now time it
In [ ]:
# now go back through and tidy everything the fuck up
In [ ]:
# and check that it's working properly
In [ ]:
# then: connectome modification from this
In [ ]:
# have that slick by the end of the day
In [ ]:
# add in multiproc / joblib (check how mne uses joblib?)
In [ ]:
# consider the v2 lookup that opens each volume once
In [ ]:
# switch the atlas to be using the concat v1 version
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [10]:
%time res = va.compute_hit_stats(test_file,idxs,readwith='indexgzip')
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
CPU times: user 10 s, sys: 2.15 s, total: 12.2 s
Wall time: 15.1 s
/media/sf_SharedFolder/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:22: RuntimeWarning: invalid value encountered in divide
TPR = TP / (TP + FN)
/media/sf_SharedFolder/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:40: RuntimeWarning: invalid value encountered in divide
FNR = FN / (FN + TP)
/media/sf_SharedFolder/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in double_scalars
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
In [11]:
%time res = va.compute_hit_stats(test_file,idxs,readwith='index_img')
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
<ipython-input-11-e3e05514dbe1> in <module>()
----> 1 get_ipython().magic(u"time res = va.compute_hit_stats(test_file,idxs,readwith='index_img')")
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
<decorator-gen-60> in time(self, line, cell, local_ns)
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
1127 else:
1128 st = clock2()
-> 1129 exec(code, glob, local_ns)
1130 end = clock2()
1131 out = None
<timed exec> in <module>()
/media/sf_SharedFolder/Code/libraries_of_mine/github/ConWhAt/ConWhAt/volumetric/atlas_volumetric.pyc in compute_hit_stats(self, roi_file, idxs, readwith)
72
73 if readwith=='index_img':
---> 74 cnxn_img = index_img(_file,_vol)
75 cnxn_dat = cnxn_img.get_data()
76 elif readwith == 'indexgzip':
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nilearn/image/image.pyc in index_img(imgs, index)
554 """
555 imgs = check_niimg_4d(imgs)
--> 556 return _index_img(imgs, index)
557
558
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nilearn/_utils/niimg_conversions.pyc in _index_img(img, index)
72 """Helper function for check_niimg_4d."""
73 return new_img_like(
---> 74 img, img.get_data()[:, :, :, index], img.get_affine(),
75 copy_header=True)
76
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nibabel/spatialimages.pyc in get_data(self, caching)
570 if self._data_cache is not None:
571 return self._data_cache
--> 572 data = np.asanyarray(self._dataobj)
573 if caching == 'fill':
574 self._data_cache = data
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/numpy/core/numeric.pyc in asanyarray(a, dtype, order)
581
582 """
--> 583 return array(a, dtype, copy=False, order=order, subok=True)
584
585
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nibabel/arrayproxy.pyc in __array__(self)
143 def __array__(self):
144 # Read array and scale
--> 145 raw_data = self.get_unscaled()
146 return apply_read_scaling(raw_data, self._slope, self._inter)
147
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nibabel/arrayproxy.pyc in get_unscaled(self)
138 offset=self._offset,
139 order=self.order,
--> 140 mmap=self._mmap)
141 return raw_data
142
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/site-packages/nibabel/volumeutils.pyc in array_from_file(shape, in_dtype, infile, offset, order, mmap)
522 if hasattr(infile, 'readinto'):
523 data_bytes = bytearray(n_bytes)
--> 524 n_read = infile.readinto(data_bytes)
525 needs_copy = False
526 else:
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/gzip.pyc in read(self, size)
266 try:
267 while size > self.extrasize:
--> 268 self._read(readsize)
269 readsize = min(self.max_read_chunk, readsize * 2)
270 except EOFError:
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/gzip.pyc in _read(self, size)
318
319 uncompress = self.decompress.decompress(buf)
--> 320 self._add_read_data( uncompress )
321
322 if self.decompress.unused_data != "":
/home/john/Software/anaconda/envs/_ipython2.4/lib/python2.7/gzip.pyc in _add_read_data(self, data)
336 self.crc = zlib.crc32(data, self.crc) & 0xffffffffL
337 offset = self.offset - self.extrastart
--> 338 self.extrabuf = self.extrabuf[offset:] + data
339 self.extrasize = self.extrasize + len(data)
340 self.extrastart = self.offset
MemoryError:
In [ ]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs,readwith='indexgzip')
In [132]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 5.05 s per loop
In [13]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 6.66 s per loop
In [17]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs,readwith='index_img')
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 1min 13s per loop
In [16]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs,readwith='indexgzip')
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 6.53 s per loop
alternative hit stats function
In [20]:
%timeit -n 1 res = va.compute_hit_stats_test(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 26.6 s per loop
try using tmp folder
In [24]:
va.at_dir = '/tmp/nifti_io_testing/dipy_dsi_sd4_l2k8_sc33'
In [25]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 6.69 s per loop
In [26]:
va.at_dir = '/tmp/nifti_io_testing/dipy_dsi_sd4_l2k8_sc33'
In [27]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs)
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
computing hit stats for roi test_lesionmask_rs1mm.nii.gz
1 loops, best of 3: 7.04 s per loop
try reading from tmp
In [19]:
va.at_dir = '/tmp/nifti_io_testing/dipy_dsi_sd4_l2k8_sc33'
In [ ]:
%timeit -n 1 res = va.compute_hit_stats(test_file,idxs,readwith='indexgzip')
try making sparse matrix
In [37]:
ls
config.yaml ConWhAt/ Dockerfile README.md
In [39]:
cd github/ConWhAt/ConWhAt/
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt
In [42]:
f = 'atlases/volumetric/dipy_dsi_sd4_l2k8_sc33/vismap_grp_cat_rois_v2_2_norm.nii.gz'
In [48]:
import nibabel as nib
import csv
In [45]:
img = nib.load(f)
In [114]:
dat = img.get_data()#[:,:,:,0].ravel()
In [118]:
csr_dat = csr_matrix([dat[:,:,:,i].ravel() for i in np.arange(img.shape[3]-1)])
In [119]:
csr_dat.shape
Out[119]:
(83, 7221032)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [95]:
import h5py
In [96]:
F = h5py.File('test_sparser.h5', 'w')
In [102]:
csr_dat.astype('float32')
Out[102]:
<83x7221032 sparse matrix of type '<type 'numpy.float32'>'
with 654924 stored elements in Compressed Sparse Row format>
In [111]:
csr_dat.astype('float32')
Out[111]:
<83x7221032 sparse matrix of type '<type 'numpy.float32'>'
with 654924 stored elements in Compressed Sparse Row format>
In [113]:
F.create_dataset('csr_dat',data=csr_dat.astype('float32'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-113-3cb41999cd64> in <module>()
----> 1 F.create_dataset('csr_dat',data=csr_dat.astype('float32'))
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_hl/group.pyc in create_dataset(self, name, shape, dtype, data, **kwds)
103 """
104 with phil:
--> 105 dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
106 dset = dataset.Dataset(dsid)
107 if name is not None:
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_hl/dataset.pyc in make_new_dset(parent, shape, dtype, data, chunks, compression, shuffle, fletcher32, maxshape, compression_opts, fillvalue, scaleoffset, track_times)
91 else:
92 dtype = numpy.dtype(dtype)
---> 93 tid = h5t.py_create(dtype, logical=1)
94
95 # Legacy
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:16090)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:15924)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:15825)()
TypeError: Object dtype dtype('O') has no native HDF5 equivalent
In [105]:
F['csr_dat'] = csr_dat.astype('float32')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-105-8846541278f4> in <module>()
----> 1 F['csr_dat'] = csr_dat.astype('float32')
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_objects.so in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2696)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_objects.so in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2654)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_hl/group.pyc in __setitem__(self, name, obj)
290
291 else:
--> 292 ds = self.create_dataset(None, data=obj, dtype=base.guess_dtype(obj))
293 h5o.link(ds.id, self.id, name, lcpl=lcpl)
294
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_hl/group.pyc in create_dataset(self, name, shape, dtype, data, **kwds)
103 """
104 with phil:
--> 105 dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
106 dset = dataset.Dataset(dsid)
107 if name is not None:
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/_hl/dataset.pyc in make_new_dset(parent, shape, dtype, data, chunks, compression, shuffle, fletcher32, maxshape, compression_opts, fillvalue, scaleoffset, track_times)
91 else:
92 dtype = numpy.dtype(dtype)
---> 93 tid = h5t.py_create(dtype, logical=1)
94
95 # Legacy
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:16090)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:15924)()
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/h5py/h5t.so in h5py.h5t.py_create (/home/ilan/minonda/conda-bld/work/h5py/h5t.c:15825)()
TypeError: Object dtype dtype('O') has no native HDF5 equivalent
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [53]:
from scipy.sparse import csr_matrix
In [54]:
csr_dat = csr_matrix(dat)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-54-9d2460cd63fc> in <module>()
----> 1 csr_dat = csr_matrix(dat)
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/scipy/sparse/compressed.pyc in __init__(self, arg1, shape, dtype, copy)
76 self.format)
77 from .coo import coo_matrix
---> 78 self._set_self(self.__class__(coo_matrix(arg1, dtype=dtype)))
79
80 # Read matrix dimensions given, if any
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/scipy/sparse/coo.pyc in __init__(self, arg1, shape, dtype, copy)
171
172 if M.ndim != 2:
--> 173 raise TypeError('expected dimension <= 2 array or matrix')
174 else:
175 self.shape = M.shape
TypeError: expected dimension <= 2 array or matrix
In [ ]:
In [82]:
img_file =at_dir + '/' + _f
start = datetime.now()
img = nib.load(img_file)
dat = img.get_data()[:,:,:,image_idxs]
str(datetime.now() - start)
Out[82]:
'0:00:30.292433'
In [83]:
from nilearn.image import index_img
In [84]:
img_file =at_dir + '/' + _f
start = datetime.now()
dat = index_img(img_file,image_idxs).shape
str(datetime.now() - start)
Out[84]:
'0:00:26.165479'
In [90]:
(26*80)/60./60. # 36 minutes = 0.57 hours just to load 60 files, in serial
# with 4 simultaneous jobs that cuts down to under 10 mins
Out[90]:
0.5777777777777777
In [92]:
(26*500)/60./60. # 36 minutes just to load 60 files, in serial
# 3 hours for 500 cnxns
Out[92]:
3.611111111111111
In [94]:
(26*7000)/60./50. # 36 minutes just to load 60 files, in serial
# 60 hours for 700 cnxns
Out[94]:
60.66666666666667
In [ ]:
index_
In [13]:
from datetime import datetime
In [48]:
volsforthisfile
Out[48]:
array([0, 1, 2, 3, 4, 5, 6])
In [ ]:
In [ ]:
va.atlas_info['ma]
In [46]:
volsforthisfile
Out[46]:
array([0, 1, 2, 3, 4, 5, 6])
In [43]:
volsforthisfile = va.atlas_info['mappings'].ix[idsforthisfile]['4dvolind'].values
Out[43]:
array([9])
In [11]:
va.atlas_info['mappings'][5]
Out[11]:
['0_to_5',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
5]
In [16]:
test_file = 'mni_lesionmask_12331_rs1mm.nii.gz'
In [13]:
os.path.abspath('../')
Out[13]:
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt'
In [14]:
plot_stat_map(test_file,vmax=2.)
Out[14]:
<nilearn.plotting.displays.OrthoSlicer at 0x7f0d0e978f50>
In [15]:
va.atlas_info['mappings'][0]
Out[15]:
['0_to_0',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
0]
In [16]:
va.atlas_info['mappings'][1]
Out[16]:
['0_to_1',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
1]
In [17]:
va.atlas_info['mappings'][4]
Out[17]:
['0_to_4',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
4]
In [16]:
from datetime import datetime
In [19]:
start = datetime.now()
idxs = range(10)# [0,1,2] # 'all'
res,df = va.compute_hit_stats(test_file,idxs)
In [22]:
finish = datetime.now()
dur = finish-start
str(dur)
Out[22]:
'0:03:47.470633'
In [17]:
idxs = [0,3,5,7]
In [18]:
va.at_dir = '/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33'
In [20]:
from datetime import datetime
In [23]:
# compute hit stats v1
In [21]:
start = datetime.now()
idxs = range(10)# [0,1,2] # 'all'
#res,df = va.compute_hit_stats(test_file,idxs)
res,df = va.compute_hit_stats(test_file,idxs)
finish = datetime.now()
dur = finish-start
str(dur)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:22: RuntimeWarning: invalid value encountered in divide
TPR = TP / (TP + FN)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:28: RuntimeWarning: invalid value encountered in float_scalars
PPV = TP / (TP + FP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:37: RuntimeWarning: invalid value encountered in float_scalars
FDR = FP / (FP + TP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:40: RuntimeWarning: invalid value encountered in divide
FNR = FN / (FN + TP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:46: RuntimeWarning: invalid value encountered in double_scalars
F1 = (2*TP) / (2*TP + FP + FN)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in double_scalars
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/numpy/lib/function_base.py:2569: RuntimeWarning: invalid value encountered in true_divide
c /= stddev[:, None]
computing hit stats for roi mni_lesionmask_12331_rs1mm.nii.gz
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/numpy/lib/function_base.py:2570: RuntimeWarning: invalid value encountered in true_divide
c /= stddev[None, :]
Out[21]:
'0:10:04.268097'
In [25]:
# compute hit stats v2 - 1/3 the time?
In [61]:
start = datetime.now()
idxs = range(10)# [0,1,2] # 'all'
#res,df = va.compute_hit_stats(test_file,idxs)
res,df = va.compute_hit_stats_test(test_file,idxs)
finish = datetime.now()
dur = finish-start
str(dur)
computing hit stats for roi mni_lesionmask_12331_rs1mm.nii.gz
Out[61]:
'0:00:54.510522'
using nzmappings
In [ ]:
In [ ]:
In [19]:
res,df = va.compute_hit_stats_test(test_file,idxs)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:22: RuntimeWarning: invalid value encountered in divide
TPR = TP / (TP + FN)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:28: RuntimeWarning: invalid value encountered in float_scalars
PPV = TP / (TP + FP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:37: RuntimeWarning: invalid value encountered in float_scalars
FDR = FP / (FP + TP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:40: RuntimeWarning: invalid value encountered in divide
FNR = FN / (FN + TP)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:46: RuntimeWarning: invalid value encountered in double_scalars
F1 = (2*TP) / (2*TP + FP + FN)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py:49: RuntimeWarning: invalid value encountered in double_scalars
MCC = (TP*TN - FP*FN) / (np.sqrt((TP + FP)*(TP+FN)*(TN+FP)*(TN+FN)))
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/numpy/lib/function_base.py:2569: RuntimeWarning: invalid value encountered in true_divide
c /= stddev[:, None]
computing hit stats for roi mni_lesionmask_12331_rs1mm.nii.gz
/home/jgriffiths/Software/anaconda2/envs/ipython2.4/lib/python2.7/site-packages/numpy/lib/function_base.py:2570: RuntimeWarning: invalid value encountered in true_divide
c /= stddev[None, :]
In [ ]:
df
In [ ]:
In [ ]:
In [ ]:
In [20]:
at_dir = '/va.atlas_info['atlas_name']
Out[20]:
'dipy_dsi_sd4_l2k8_sc33'
In [21]:
mappings = va.atlas_info['mappings']
In [23]:
file_id = 0
In [24]:
np.nonzero(mappings.ix[idxs]['nii_file_id'] == file_id)[0]
Out[24]:
array([0, 1, 2, 3])
In [27]:
np.nonzero(mappings.ix[idxs]['nii_file_id'] == file_id)
Out[27]:
(array([0, 1, 2, 3]),)
In [37]:
file_id
Out[37]:
0
In [38]:
np.nonzero(mappings['nii_file_id'] == file_id)[0]
Out[38]:
array([ 0, 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, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82])
In [41]:
(mappings['nii_file_id'] == file_id).ix[idxs]
Out[41]:
0 True
3 True
5 True
7 True
Name: nii_file_id, dtype: bool
In [45]:
for i in mappings.index:
thing = 5
In [52]:
mappings.ix[i]
Out[52]:
name 82_to_82
nii_file vismap_grp_cat_rois_v2_82_norm.nii.gz
nii_file_id 82
4dvolind 82
Name: 6888, dtype: object
In [51]:
[_name,_file,_nii_file_id,_4dvolind =
thing = [[_name,_file,_nii_file_id,_4dvolind = mappings.ix[i].values for i in mappings.index if i in idxs]
_mappings.ix[i].values
Out[51]:
array(['82_to_82', 'vismap_grp_cat_rois_v2_82_norm.nii.gz', 82, 82], dtype=object)
In [49]:
mappings.ix[i]['name'], mappings.ix[i]['nii_file']
Out[49]:
name 82_to_82
nii_file vismap_grp_cat_rois_v2_82_norm.nii.gz
nii_file_id 82
4dvolind 82
Name: 6888, dtype: object
In [57]:
idxsforthisfile = np.nonzero(mappings['nii_file_id'] == file_id)[0]
idxstouse = [i for i in idxsforthisfile if i in idxs]
In [ ]:
In [21]:
# now change from index_img and see how long it takes...
In [22]:
import numpy as np
In [23]:
import pandas as pd
In [24]:
_arr = np.array(va.atlas_info['mappings'])
In [87]:
#_arr.sort()
In [32]:
df_arr = pd.DataFrame(_arr, columns=['rois', 'path', 'vol'])
In [35]:
df_arr.sort_values(['path', 'vol'])
Out[35]:
rois
path
vol
0
0_to_0
/home/jgriffiths/Code/libraries_of_mine/github...
0
1
0_to_1
/home/jgriffiths/Code/libraries_of_mine/github...
1
10
0_to_10
/home/jgriffiths/Code/libraries_of_mine/github...
10
11
0_to_11
/home/jgriffiths/Code/libraries_of_mine/github...
11
12
0_to_12
/home/jgriffiths/Code/libraries_of_mine/github...
12
13
0_to_13
/home/jgriffiths/Code/libraries_of_mine/github...
13
14
0_to_14
/home/jgriffiths/Code/libraries_of_mine/github...
14
15
0_to_15
/home/jgriffiths/Code/libraries_of_mine/github...
15
16
0_to_16
/home/jgriffiths/Code/libraries_of_mine/github...
16
17
0_to_17
/home/jgriffiths/Code/libraries_of_mine/github...
17
18
0_to_18
/home/jgriffiths/Code/libraries_of_mine/github...
18
19
0_to_19
/home/jgriffiths/Code/libraries_of_mine/github...
19
2
0_to_2
/home/jgriffiths/Code/libraries_of_mine/github...
2
20
0_to_20
/home/jgriffiths/Code/libraries_of_mine/github...
20
21
0_to_21
/home/jgriffiths/Code/libraries_of_mine/github...
21
22
0_to_22
/home/jgriffiths/Code/libraries_of_mine/github...
22
23
0_to_23
/home/jgriffiths/Code/libraries_of_mine/github...
23
24
0_to_24
/home/jgriffiths/Code/libraries_of_mine/github...
24
25
0_to_25
/home/jgriffiths/Code/libraries_of_mine/github...
25
26
0_to_26
/home/jgriffiths/Code/libraries_of_mine/github...
26
27
0_to_27
/home/jgriffiths/Code/libraries_of_mine/github...
27
28
0_to_28
/home/jgriffiths/Code/libraries_of_mine/github...
28
29
0_to_29
/home/jgriffiths/Code/libraries_of_mine/github...
29
3
0_to_3
/home/jgriffiths/Code/libraries_of_mine/github...
3
30
0_to_30
/home/jgriffiths/Code/libraries_of_mine/github...
30
31
0_to_31
/home/jgriffiths/Code/libraries_of_mine/github...
31
32
0_to_32
/home/jgriffiths/Code/libraries_of_mine/github...
32
33
0_to_33
/home/jgriffiths/Code/libraries_of_mine/github...
33
34
0_to_34
/home/jgriffiths/Code/libraries_of_mine/github...
34
35
0_to_35
/home/jgriffiths/Code/libraries_of_mine/github...
35
...
...
...
...
804
9_to_57
/home/jgriffiths/Code/libraries_of_mine/github...
57
805
9_to_58
/home/jgriffiths/Code/libraries_of_mine/github...
58
806
9_to_59
/home/jgriffiths/Code/libraries_of_mine/github...
59
753
9_to_6
/home/jgriffiths/Code/libraries_of_mine/github...
6
807
9_to_60
/home/jgriffiths/Code/libraries_of_mine/github...
60
808
9_to_61
/home/jgriffiths/Code/libraries_of_mine/github...
61
809
9_to_62
/home/jgriffiths/Code/libraries_of_mine/github...
62
810
9_to_63
/home/jgriffiths/Code/libraries_of_mine/github...
63
811
9_to_64
/home/jgriffiths/Code/libraries_of_mine/github...
64
812
9_to_65
/home/jgriffiths/Code/libraries_of_mine/github...
65
813
9_to_66
/home/jgriffiths/Code/libraries_of_mine/github...
66
814
9_to_67
/home/jgriffiths/Code/libraries_of_mine/github...
67
815
9_to_68
/home/jgriffiths/Code/libraries_of_mine/github...
68
816
9_to_69
/home/jgriffiths/Code/libraries_of_mine/github...
69
754
9_to_7
/home/jgriffiths/Code/libraries_of_mine/github...
7
817
9_to_70
/home/jgriffiths/Code/libraries_of_mine/github...
70
818
9_to_71
/home/jgriffiths/Code/libraries_of_mine/github...
71
819
9_to_72
/home/jgriffiths/Code/libraries_of_mine/github...
72
820
9_to_73
/home/jgriffiths/Code/libraries_of_mine/github...
73
821
9_to_74
/home/jgriffiths/Code/libraries_of_mine/github...
74
822
9_to_75
/home/jgriffiths/Code/libraries_of_mine/github...
75
823
9_to_76
/home/jgriffiths/Code/libraries_of_mine/github...
76
824
9_to_77
/home/jgriffiths/Code/libraries_of_mine/github...
77
825
9_to_78
/home/jgriffiths/Code/libraries_of_mine/github...
78
826
9_to_79
/home/jgriffiths/Code/libraries_of_mine/github...
79
755
9_to_8
/home/jgriffiths/Code/libraries_of_mine/github...
8
827
9_to_80
/home/jgriffiths/Code/libraries_of_mine/github...
80
828
9_to_81
/home/jgriffiths/Code/libraries_of_mine/github...
81
829
9_to_82
/home/jgriffiths/Code/libraries_of_mine/github...
82
756
9_to_9
/home/jgriffiths/Code/libraries_of_mine/github...
9
6889 rows × 3 columns
In [27]:
neworder = df_arr.sort_values(by=1)[1]
In [29]:
df_arr
Out[29]:
0
1
2
0
0_to_0
/home/jgriffiths/Code/libraries_of_mine/github...
0
1
0_to_1
/home/jgriffiths/Code/libraries_of_mine/github...
1
2
0_to_2
/home/jgriffiths/Code/libraries_of_mine/github...
2
3
0_to_3
/home/jgriffiths/Code/libraries_of_mine/github...
3
4
0_to_4
/home/jgriffiths/Code/libraries_of_mine/github...
4
5
0_to_5
/home/jgriffiths/Code/libraries_of_mine/github...
5
6
0_to_6
/home/jgriffiths/Code/libraries_of_mine/github...
6
7
0_to_7
/home/jgriffiths/Code/libraries_of_mine/github...
7
8
0_to_8
/home/jgriffiths/Code/libraries_of_mine/github...
8
9
0_to_9
/home/jgriffiths/Code/libraries_of_mine/github...
9
10
0_to_10
/home/jgriffiths/Code/libraries_of_mine/github...
10
11
0_to_11
/home/jgriffiths/Code/libraries_of_mine/github...
11
12
0_to_12
/home/jgriffiths/Code/libraries_of_mine/github...
12
13
0_to_13
/home/jgriffiths/Code/libraries_of_mine/github...
13
14
0_to_14
/home/jgriffiths/Code/libraries_of_mine/github...
14
15
0_to_15
/home/jgriffiths/Code/libraries_of_mine/github...
15
16
0_to_16
/home/jgriffiths/Code/libraries_of_mine/github...
16
17
0_to_17
/home/jgriffiths/Code/libraries_of_mine/github...
17
18
0_to_18
/home/jgriffiths/Code/libraries_of_mine/github...
18
19
0_to_19
/home/jgriffiths/Code/libraries_of_mine/github...
19
20
0_to_20
/home/jgriffiths/Code/libraries_of_mine/github...
20
21
0_to_21
/home/jgriffiths/Code/libraries_of_mine/github...
21
22
0_to_22
/home/jgriffiths/Code/libraries_of_mine/github...
22
23
0_to_23
/home/jgriffiths/Code/libraries_of_mine/github...
23
24
0_to_24
/home/jgriffiths/Code/libraries_of_mine/github...
24
25
0_to_25
/home/jgriffiths/Code/libraries_of_mine/github...
25
26
0_to_26
/home/jgriffiths/Code/libraries_of_mine/github...
26
27
0_to_27
/home/jgriffiths/Code/libraries_of_mine/github...
27
28
0_to_28
/home/jgriffiths/Code/libraries_of_mine/github...
28
29
0_to_29
/home/jgriffiths/Code/libraries_of_mine/github...
29
...
...
...
...
6859
82_to_53
/home/jgriffiths/Code/libraries_of_mine/github...
53
6860
82_to_54
/home/jgriffiths/Code/libraries_of_mine/github...
54
6861
82_to_55
/home/jgriffiths/Code/libraries_of_mine/github...
55
6862
82_to_56
/home/jgriffiths/Code/libraries_of_mine/github...
56
6863
82_to_57
/home/jgriffiths/Code/libraries_of_mine/github...
57
6864
82_to_58
/home/jgriffiths/Code/libraries_of_mine/github...
58
6865
82_to_59
/home/jgriffiths/Code/libraries_of_mine/github...
59
6866
82_to_60
/home/jgriffiths/Code/libraries_of_mine/github...
60
6867
82_to_61
/home/jgriffiths/Code/libraries_of_mine/github...
61
6868
82_to_62
/home/jgriffiths/Code/libraries_of_mine/github...
62
6869
82_to_63
/home/jgriffiths/Code/libraries_of_mine/github...
63
6870
82_to_64
/home/jgriffiths/Code/libraries_of_mine/github...
64
6871
82_to_65
/home/jgriffiths/Code/libraries_of_mine/github...
65
6872
82_to_66
/home/jgriffiths/Code/libraries_of_mine/github...
66
6873
82_to_67
/home/jgriffiths/Code/libraries_of_mine/github...
67
6874
82_to_68
/home/jgriffiths/Code/libraries_of_mine/github...
68
6875
82_to_69
/home/jgriffiths/Code/libraries_of_mine/github...
69
6876
82_to_70
/home/jgriffiths/Code/libraries_of_mine/github...
70
6877
82_to_71
/home/jgriffiths/Code/libraries_of_mine/github...
71
6878
82_to_72
/home/jgriffiths/Code/libraries_of_mine/github...
72
6879
82_to_73
/home/jgriffiths/Code/libraries_of_mine/github...
73
6880
82_to_74
/home/jgriffiths/Code/libraries_of_mine/github...
74
6881
82_to_75
/home/jgriffiths/Code/libraries_of_mine/github...
75
6882
82_to_76
/home/jgriffiths/Code/libraries_of_mine/github...
76
6883
82_to_77
/home/jgriffiths/Code/libraries_of_mine/github...
77
6884
82_to_78
/home/jgriffiths/Code/libraries_of_mine/github...
78
6885
82_to_79
/home/jgriffiths/Code/libraries_of_mine/github...
79
6886
82_to_80
/home/jgriffiths/Code/libraries_of_mine/github...
80
6887
82_to_81
/home/jgriffiths/Code/libraries_of_mine/github...
81
6888
82_to_82
/home/jgriffiths/Code/libraries_of_mine/github...
82
6889 rows × 3 columns
In [28]:
neworder
Out[28]:
0 /home/jgriffiths/Code/libraries_of_mine/github...
60 /home/jgriffiths/Code/libraries_of_mine/github...
59 /home/jgriffiths/Code/libraries_of_mine/github...
58 /home/jgriffiths/Code/libraries_of_mine/github...
57 /home/jgriffiths/Code/libraries_of_mine/github...
56 /home/jgriffiths/Code/libraries_of_mine/github...
55 /home/jgriffiths/Code/libraries_of_mine/github...
54 /home/jgriffiths/Code/libraries_of_mine/github...
53 /home/jgriffiths/Code/libraries_of_mine/github...
52 /home/jgriffiths/Code/libraries_of_mine/github...
51 /home/jgriffiths/Code/libraries_of_mine/github...
50 /home/jgriffiths/Code/libraries_of_mine/github...
49 /home/jgriffiths/Code/libraries_of_mine/github...
48 /home/jgriffiths/Code/libraries_of_mine/github...
47 /home/jgriffiths/Code/libraries_of_mine/github...
46 /home/jgriffiths/Code/libraries_of_mine/github...
45 /home/jgriffiths/Code/libraries_of_mine/github...
44 /home/jgriffiths/Code/libraries_of_mine/github...
61 /home/jgriffiths/Code/libraries_of_mine/github...
43 /home/jgriffiths/Code/libraries_of_mine/github...
62 /home/jgriffiths/Code/libraries_of_mine/github...
64 /home/jgriffiths/Code/libraries_of_mine/github...
81 /home/jgriffiths/Code/libraries_of_mine/github...
80 /home/jgriffiths/Code/libraries_of_mine/github...
79 /home/jgriffiths/Code/libraries_of_mine/github...
78 /home/jgriffiths/Code/libraries_of_mine/github...
77 /home/jgriffiths/Code/libraries_of_mine/github...
76 /home/jgriffiths/Code/libraries_of_mine/github...
75 /home/jgriffiths/Code/libraries_of_mine/github...
74 /home/jgriffiths/Code/libraries_of_mine/github...
...
751 /home/jgriffiths/Code/libraries_of_mine/github...
750 /home/jgriffiths/Code/libraries_of_mine/github...
749 /home/jgriffiths/Code/libraries_of_mine/github...
748 /home/jgriffiths/Code/libraries_of_mine/github...
747 /home/jgriffiths/Code/libraries_of_mine/github...
829 /home/jgriffiths/Code/libraries_of_mine/github...
763 /home/jgriffiths/Code/libraries_of_mine/github...
764 /home/jgriffiths/Code/libraries_of_mine/github...
765 /home/jgriffiths/Code/libraries_of_mine/github...
766 /home/jgriffiths/Code/libraries_of_mine/github...
785 /home/jgriffiths/Code/libraries_of_mine/github...
784 /home/jgriffiths/Code/libraries_of_mine/github...
783 /home/jgriffiths/Code/libraries_of_mine/github...
782 /home/jgriffiths/Code/libraries_of_mine/github...
781 /home/jgriffiths/Code/libraries_of_mine/github...
780 /home/jgriffiths/Code/libraries_of_mine/github...
779 /home/jgriffiths/Code/libraries_of_mine/github...
778 /home/jgriffiths/Code/libraries_of_mine/github...
787 /home/jgriffiths/Code/libraries_of_mine/github...
777 /home/jgriffiths/Code/libraries_of_mine/github...
775 /home/jgriffiths/Code/libraries_of_mine/github...
774 /home/jgriffiths/Code/libraries_of_mine/github...
773 /home/jgriffiths/Code/libraries_of_mine/github...
772 /home/jgriffiths/Code/libraries_of_mine/github...
771 /home/jgriffiths/Code/libraries_of_mine/github...
770 /home/jgriffiths/Code/libraries_of_mine/github...
769 /home/jgriffiths/Code/libraries_of_mine/github...
768 /home/jgriffiths/Code/libraries_of_mine/github...
776 /home/jgriffiths/Code/libraries_of_mine/github...
828 /home/jgriffiths/Code/libraries_of_mine/github...
Name: 1, dtype: object
In [82]:
# NOW CHANGE THE LOOP IN THE FUNCTION TO LOAD IN ONE IMAGE AND THEN GET ALL THE VOLUMES OF INTEREST FROM THAT IMAGE AT ONCE...
In [ ]:
# ...
In [ ]:
In [ ]:
In [ ]:
In [ ]:
np.sort()
In [49]:
_arr.shape
Out[49]:
(6889, 3)
In [48]:
np.sort(_arr,axis=0)
Out[48]:
array([['0_to_0',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
'0'],
['0_to_1',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
'0'],
['0_to_10',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz',
'0'],
...,
['9_to_81',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_9_norm.nii.gz',
'9'],
['9_to_82',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_9_norm.nii.gz',
'9'],
['9_to_9',
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_l2k8_sc33/vismap_grp_cat_rois_v2_9_norm.nii.gz',
'9']],
dtype='|S138')
In [ ]:
In [36]:
# = /home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric'/dipy_dsi_sd4_l2k8_sc33_v2'
In [37]:
import nibabel as nib
In [38]:
f
Out[38]:
'/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33/vismap_grp_cat_rois_v2_0_norm.nii.gz'
In [53]:
f = '/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/atlases/volumetric/dipy_dsi_sd4_l2k8_sc33/vismap_grp_cat_rois_v2_9_norm.nii.gz'
In [54]:
img = nib.load(f)
In [55]:
from ConWhAt.base import hit_stats,compare_images
In [31]:
compare_images(f,test_file)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-31-e4d096d213f4> in <module>()
----> 1 compare_images(f,test_file)
/home/jgriffiths/Code/libraries_of_mine/github/ConWhAt/ConWhAt/base/hit_stats.py in compare_images(f1, f2, thr1, thr2)
95
96
---> 97 thrbin_mul = dat1_thrbin*dat2_thrbin
98 thrbininv_mul = (dat1_thrbin==0)*(dat2_thrbin==0)
99
ValueError: operands could not be broadcast together with shapes (182,218,182,84) (182,218,182)
In [32]:
img = nib.load(f)
In [33]:
test_img = nib.load(test_file)
In [34]:
img.shape
Out[34]:
(182, 218, 182, 84)
In [35]:
dat = img.get_data()
In [39]:
dat.shape
Out[39]:
(182, 218, 182, 84)
In [40]:
test_dat*dat
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-40-cf6ed5958238> in <module>()
----> 1 test_dat*dat
ValueError: operands could not be broadcast together with shapes (182,218,182) (182,218,182,84)
In [36]:
test_dat = test_img.get_data()
In [37]:
dat.shape
Out[37]:
(182, 218, 182, 84)
In [38]:
test_dat.shape
Out[38]:
(182, 218, 182)
In [58]:
# that's 3.5 minutes for 10 cnxns
# so for ((N-1)/2)**2 = 1521, that would take
# 1521./3.5/60 = 7.242 hours = 434.5 minutes
# we need to speed that up.
In [59]:
#((80-1)/2)**2
In [60]:
#1521./3.5/60
In [ ]:
In [ ]:
In [52]:
df
Out[52]:
val
structure
metric
0_to_0
ACC
1.000000e+00
F1
NaN
FNR
NaN
TNR
1.000000e+00
BM
NaN
corr_thr
NaN
MCC
NaN
corr_thrbin
NaN
MK
NaN
TN
7.154589e+06
TP
0.000000e+00
FDR
NaN
corr_nothr
NaN
TPR
NaN
FPR
0.000000e+00
NPV
1.000000e+00
FP
0.000000e+00
FN
0.000000e+00
PPV
NaN
0_to_1
ACC
9.775258e-01
F1
7.208954e-04
FNR
0.000000e+00
TNR
9.775256e-01
BM
9.775256e-01
corr_thr
-7.156460e-03
MCC
1.877429e-02
corr_thrbin
-1.397583e-02
MK
3.605777e-04
TN
6.993794e+06
TP
5.800000e+01
...
...
...
0_to_8
MK
2.946092e-03
TN
6.716657e+06
TP
1.294000e+03
FDR
9.970539e-01
corr_nothr
-1.419978e-02
TPR
1.000000e+00
FPR
6.120995e-02
NPV
1.000000e+00
FP
4.379320e+05
FN
0.000000e+00
PPV
2.946092e-03
0_to_9
ACC
9.744870e-01
F1
0.000000e+00
FNR
NaN
TNR
9.744870e-01
BM
NaN
corr_thr
-8.087002e-03
MCC
NaN
corr_thrbin
-1.551906e-02
MK
0.000000e+00
TN
6.972054e+06
TP
0.000000e+00
FDR
1.000000e+00
corr_nothr
-8.087002e-03
TPR
NaN
FPR
2.551300e-02
NPV
1.000000e+00
FP
1.825350e+05
FN
0.000000e+00
PPV
0.000000e+00
190 rows × 1 columns
canonical connectome
In [29]:
import pandas as pd
In [30]:
df = pd.read_hdf('../atlases/volumetric/dipy_dsi_l2k8_sc33/cancon_l2k8_sc33.h5', 'df_cm_avg')
Opening ../atlases/volumetric/dipy_dsi_l2k8_sc33/cancon_l2k8_sc33.h5 in read-only mode
In [34]:
import numpy as np
In [44]:
mask = (df.values!=0)*((np.eye(df.shape[0])*-1)+1)==False
sns.heatmap(np.log1p(df.values), xticklabels='',yticklabels='',
mask=mask)
Out[44]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fe3326d0e10>
In [15]:
len(res)
Out[15]:
20
In [16]:
res[0]
Out[16]:
['Anterior thalamic radiation L',
'/usr/share/fsl/data/atlases/JHU/JHU-ICBM-tracts-prob-2mm.nii.gz',
0,
{'ACC': 0.98796847874375848,
'BM': 0.98795168693024293,
'F1': 0.1880980861244019,
'FDR': 0.89618748968476647,
'FN': 0,
'FNR': 0.0,
'FP': 10860.0,
'FPR': 0.01204831306975707,
'MCC': 0.32025262635987578,
'MK': 0.10381251031523364,
'NPV': 1,
'PPV': 0.10381251031523353,
'TN': 890511,
'TNR': 0.98795168693024293,
'TP': 1258.0,
'TPR': 1.0,
'corr_nothr': 0.86519832016660103,
'corr_thr': 0.86519832016660103,
'corr_thrbin': 0.32025262635987012}]
In [28]:
df.unstack('structure').ix['corr_thrbin'].plot(kind='bar')
Out[28]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fece86dfb50>
In [32]:
# this is right I think; made the roi from the first image, which is anterior thalamic radiation
In [31]:
va.atlas_info['mappings'][0]
Out[31]:
['Anterior thalamic radiation L',
'/usr/share/fsl/data/atlases/JHU/JHU-ICBM-tracts-prob-2mm.nii.gz',
0]
In [ ]:
Content source: JohnGriffiths/ConWhAt
Similar notebooks: