In [254]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import subprocess
In [2]:
!ls
In [156]:
df = pd.read_csv('2016-09-06-neurovault_metadata.csv')
df.shape
Out[156]:
In [7]:
wh_cogatlas = [c for c in df.columns if 'cogatlas' in c]
In [221]:
[(n,c) for n,c in enumerate(df.columns) if not str.isupper(c[0])]
Out[221]:
In [42]:
_ = sns.distplot(df.groupby('cognitive_contrast_cogatlas_id')['id'].count(), kde=False)
In [48]:
for i in df['modality'].unique():
print i
In [66]:
df = df.drop(np.where(df['modality'] != 'fMRI-BOLD')[0])
In [67]:
df.shape
Out[67]:
In [80]:
df.groupby('map_type')['modality'].count()
Out[80]:
In [82]:
xt = pd.crosstab(df['modality'], df['map_type'])
In [322]:
nv = pd.read_csv('2016-09-06-neurovault_metadata.csv')
nv.shape
Out[322]:
In [329]:
for i in nv.map_type.unique():
print i
In [ ]:
nv['map_type'].isin(['T map', 'Z map'])
In [313]:
wh_labeled = []
wh_labeled.append(nv['cognitive_contrast_cogatlas'].isnull())
wh_labeled.append(nv['cognitive_contrast_cogatlas'] == 'Other')
wh_labeled.append(nv['cognitive_contrast_cogatlas'] == 'None / Other')
wh_labeled.append(nv['modality'] != 'fMRI-BOLD')
wh_labeled.append(nv['map_type'].str.contains('map') == False)
wh_labeled.append(nv['map_type'])
In [ ]:
wh_unlabeled = []
wh_unlabeled.append(nv['cognitive_contrast_cogatlas'].isnull())
wh_unlabeled.append(nv['cognitive_contrast_cogatlas'] == 'Other')
wh_unlabeled.append(nv['cognitive_contrast_cogatlas'] == 'None / Other')
wh_unlabeled.append(nv['modality'] == 'fMRI-BOLD')
wh_unlabeled.append(nv['map_type'].str.contains('map'))
In [317]:
nv_old = nv.copy()
= nv.loc[~np.any(np.array(wh_labeled), axis=0), :]
print nv.shape
In [318]:
nv = nv.drop_duplicates()
print nv.shape
In [319]:
x = nv['file'].iloc[0]
x.split('/')[-1]
# ${x##*/}
Out[319]:
In [320]:
# proc = subprocess.Popen(['/bin/bash'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
!rm -r images
!mkdir images
n=0
for f in nv['file']:
# n=n+1
# if n > 20:
# break
fout = f.split('/')[-1]
print "downloading: ", fout
subprocess.call('curl %s > images/%s' % (f, fout), shell=True)
# subprocess.call('touch images/%s' % (fout), shell=True)
In [321]:
!lsi images --h -V