X, Y, sulci_df_qc = load_residualized_bmi_data(cache=False) colnames = sulci_df_qc.columns penalty_start = 11 # # if add tiv² as an additionnal cofound # penalty_start = 12 # Initialize beta_map beta_map = np.zeros((X.shape[1], Y.shape[1])) print "##############################################################" print ("# Perform Mass-Univariate Linear Modeling " "based Ordinary Least Squares #") print "##############################################################" #MUOLS bigols = MUOLS() bigols.fit(X, Y) t, p, df = bigols.stats_t_coefficients(X, Y, contrast=[0.] * penalty_start + [1.] * (X.shape[1] - penalty_start), # # if add tiv² as an additionnal cofound # contrast=[0.] * penalty_start + # [1.] * (X.shape[1] - penalty_start), # # if want the contrast associated to mean_pds # contrast=[0.] * (penalty_start - 2) + [1.] # + [0.] * (X.shape[1] - penalty_start + 1), pval=True) proba = [] for i in np.arange(0, p.shape[0]): if (p[i] > 0.95):
# Load data X, Y, sulci_df_qc = load_residualized_bmi_data(cache=False) colnames = sulci_df_qc.columns penalty_start = 12 # Initialize beta_map beta_map = np.zeros((X.shape[1], Y.shape[1])) print "##############################################################" print( "# Perform Mass-Univariate Linear Modeling " "based Ordinary Least Squares #") print "##############################################################" #MUOLS bigols = MUOLS() bigols.fit(X, Y) t, p, df = bigols.stats_t_coefficients( X, Y, # if add tiv² as an additionnal cofound contrast=[0.] * penalty_start + [1.] * (X.shape[1] - penalty_start), pval=True) proba = [] for i in np.arange(0, p.shape[0]): if (p[i] > 0.95): p[i] = 1 - p[i] proba.append('%.15f' % p[i]) # Beta values: coefficients of the fit
SHARED_DIR = os.path.join(BASE_SHARED_DIR, 'residualized_bmi_cache_IMAGEN') if not os.path.exists(SHARED_DIR): os.makedirs(SHARED_DIR) X, Y = load_residualized_bmi_data(cache=False) n, p = Y.shape np.save(os.path.join(WD, 'X.npy'), X) np.save(os.path.join(WD, 'Y.npy'), Y) print "################################" print "# Perform Mass-Univariate Linear Modeling based Ordinary Least Squares #" print "################################" #MUOLS beta_map = np.zeros(p) bigols = MUOLS() bigols.fit(X, Y) s, p = bigols.stats_t_coefficients( X, Y, contrast=[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.], pval=True) beta_map[:] = s[:] template_for_size = os.path.join(DATA_PATH, 'mask', 'mask.nii') template_for_size_img = ni.load(template_for_size) mask_data = template_for_size_img.get_data() masked_data_index = (mask_data == 1.0) image = np.zeros(template_for_size_img.get_data().shape) image[masked_data_index] = beta_map
sulci_depthMax_df.to_csv(os.path.join(QC_PATH, 'sulci_depthMax_df.csv')) print "Dataframe containing sulci maximal depth after quality control has been saved." colnames = sulci_depthMax_df.columns penalty_start = 11 # Initialize beta_map beta_map = np.zeros((X.shape[1], Y.shape[1])) print "##############################################################" print ("# Perform Mass-Univariate Linear Modeling " "based Ordinary Least Squares #") print "##############################################################" #MUOLS bigols = MUOLS() bigols.fit(X, Y) t, p, df = bigols.stats_t_coefficients(X, Y, contrast=[0.] * penalty_start + [1.] * (X.shape[1] - penalty_start), pval=True) proba = [] for i in np.arange(0, p.shape[0]): if (p[i] > 0.95): p[i] = 1 - p[i] proba.append('%.15f' % p[i]) # Beta values: coefficients of the fit beta_map = bigols.coef_