Skip to content

Instantly share code, notes, and snippets.

View danlurie's full-sized avatar

Daniel Lurie danlurie

View GitHub Profile
Process Process-25:
Traceback (most recent call last):
File "/home2/dlurie/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home2/dlurie/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/home2/dlurie/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/CPAC/pipeline/cpac_pipeline.py", line 4339, in prep_workflow
workflow.run(updatehash=True, plugin='MultiProc', plugin_args={'n_procs': c.numCoresPerSubject})
File "/home2/dlurie/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nipype/pipeline/engine.py", line 689, in run
runner.run(execgraph, updatehash=updatehash, config=self.config)
def ttestconv( oldfile ):
newfile = os.path.basename(oldfile)
#Read in Variables (Case Sensitive)
print gen_code
#gen_code = raw_input("Please Enter Gender Code (Case Sensitive):")
#age_code = raw_input("Please Enter Age Code (Case Sensitive):")
ttest_code = raw_input("Please Enter T Test Code (Case Sensitive):")
In [1]: age_code = "[CONY_48]"
In [2]: gen_code ="[CONY_49]"
In [3]: from code
code codecs codetools
codeconvert_dl_130211 codeop
In [3]: from codeconvert_dl_130211 import ttestconv
# Define a function that creates a row of histograms for MeanFD, MeanDVARS, Pct. Overthreshold Volumes, and tSNR
def func_quad (site_name, meanfd_column, meandvars_column, pctvols_column, tsnr_column, **kwargs):
sns.set_context("notebook")
fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize=(15, 3))
suptitle(site_name, size="x-large", position=(0.5,1.05))
ax1.hist(meanfd_column, 70, histtype="stepfilled", alpha=.7, color='steelblue')
avg_meanfd = np.mean(meanfd_column)
ax1.text(0.85, .925,'Mean = '+str(avg_meanfd)[:5], horizontalalignment='center', verticalalignment='center', transform = ax1.transAxes)
ax1.set_title('Mean FD')
ax2.hist(meandvars_column, 70, histtype="stepfilled", alpha=.7, color='olivedrab')
# Define a function that creates site-specific data frames based on a range of subject numbers (specified as regex)
# One data frame for motion data, one for SNR data
# Prints number of rows in each new DF
def slice_site (site_name, sub_range):
snr_df = site_name+"_snr"
site_name = combined[combined['Subject'].str.contains(sub_range)]
snr_df = snr[snr['subject'].str.contains(sub_range)]
print "Subjects in motion data = "+str(len(site_name.index))
print "Subjects in SNR data = "+str(len(snr_df.index))
# Define a function that creates site-specific data frames based on a range of subject numbers (specified as regex)
# One data frame for motion data, one for SNR data
# Prints number of rows in each new DF
def slice_site (site_name, sub_range):
snr_df = site_name+"_snr"
foo = combined[combined['Subject'].str.contains(sub_range)]
vars()[snr_df] = snr[snr['subject'].str.contains(sub_range)]
print "Scans in motion data = "+str(len(foo.index))
print "Scans in SNR data = "+str(len(vars()[snr_df].index))
#import code
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
combined = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/temp_motion_326.csv', sep=',')
snr = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/tsnr_temp_328.csv', sep=',')
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
combined = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/temp_motion_326.csv', sep=',')
snr = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/tsnr_temp_328.csv', sep=',')
#NYU
nyu_csc = combined[combined['Subject'].str.contains("25[0-1][0-9][0-9]|252[0-2][0-9]|2523[0-2]")]
nyu_csc_snr = snr[snr['subject'].str.contains("25[0-1][0-9][0-9]|252[0-2][0-9]|2523[0-2]")]
print len(nyu_csc.index)
print len(nyu_csc_snr.index)
# this makes some pretty graphs useing the data frames just created.
func_quad(site_name = "NYU", meanfd_column = nyu_csc.MeanFD,
meandvars_column = nyu_csc.MeanDVARS, pctvols_column = nyu_csc[nyu_csc.columns[37]],
tsnr_column = nyu_csc_snr.tsnr)
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
combined = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/temp_motion_326.csv', sep=',')
snr = pd.read_csv('/Users/daniel.lurie/Dropbox/CMI/INDI/CoRR/qc/tsnr_temp_328.csv', sep=',')