-
-
Save theresaanna/9895634 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=',') | |
class Site(): | |
def __init__(self, site_name, sub_range): | |
self.site_name = site_name | |
self.sub_range = sub_range | |
self.snr_df_name = self.site_name + "_snr" | |
self.motion_data = None | |
self.signal_data = None | |
self.slice_site() | |
# 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(self): | |
self.motion_data = combined[combined['Subject'].str.contains(self.sub_range)] | |
self.signal_data = snr[snr['subject'].str.contains(self.sub_range)] | |
print "Scans in motion data = "+str(len(self.motion_data.index)) | |
print "Scans in SNR data = "+str(len(self.signal_data.index)) | |
# for the love of god, rename me | |
def make_pretty_thing(self): | |
func_quad(site_name = self.site_name, meanfd_column = self.motion_data.MeanFD, | |
meandvars_column = self.motion_data.MeanDVARS, | |
pctvols_column = self.motion_data[self.motion_data.columns[37]], | |
tsnr_column = self.signal_data.tsnr) | |
# Utah 26017-26043 (178) | |
utah = Site(site_name="Utah", sub_range="2601[7-9]|260[2-3][0-9]|2604[0-3]") | |
utah.make_pretty_thing() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment