# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

# # Code for trial and error analysis and sanity checks

# +
import pandas as pd
import os
import sys
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
import nibabel as nib

sys.path.append('../')
from lib.stats_utils import *
# -

project_dir = '../../../'
data_dir = project_dir + 'data/preproc_T1s/'
metadata_dir = '../metadata/'
results_dir = '../results/MAGeT/'

# ### Check cerebellum volumes of the atlas labels

# +
atlas_volume_csv = metadata_dir + 'atlas_volumes.csv'
atlas_volume_df = pd.read_csv(atlas_volume_csv)

cols_L = ['L_I_II', 'L_III', 'L_IV', 'L_V', 'L_VI', 'L_Crus_I','L_Crus_II', 'L_VIIB', 'L_VIIIA', 'L_VIIIB', 'L_IX', 'L_X', 'L_CM']
cols_R = ['R_I_II', 'R_III', 'R_IV', 'R_V', 'R_VI', 'R_Crus_I', 'R_Crus_II','R_VIIB', 'R_VIIIA', 'R_VIIIB', 'R_IX', 'R_X', 'R_CM']

atlas_volume_df['L_CB'] = atlas_volume_df[cols_L].sum(axis=1)
atlas_volume_df['R_CB'] = atlas_volume_df[cols_R].sum(axis=1)
atlas_volume_df.head()

# +
plot_df = atlas_volume_df.copy()
plot_df = pd.melt(plot_df, id_vars = ['Subject'], value_vars = ['L_CB','R_CB'] , 
                      var_name ='ROI', value_name ='volume')

palette = sns.color_palette('husl',2)


with sns.axes_style("whitegrid"):
    g = sns.catplot(x='volume', y='ROI', kind='bar',aspect=3, height=4, palette = palette,
                    data=plot_df)
# -



StarcoderdataJupyterScriptsDedupFiltered