Created
March 31, 2014 15:34
-
-
Save danlurie/9895047 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=',') | |
# 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 | |
#code.interact(local=locals()) | |
return foo | |
# Utah 26017-26043 (178) | |
slice_site(site_name="utah", sub_range="2601[7-9]|260[2-3][0-9]|2604[0-3]") | |
print len(foo.index) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment