<jupyter_start><jupyter_text>This script is used for writing all the gradient PNGs to files in scratch First, the gradients for all the 'difference' matrices are plotted using dataframes containing information for each task, and the differences calculated between cases/controls, average for all subjects in that task<jupyter_code>! ls '/scratch/a/arisvoin/lbassman/spins_gradients/sub-CMH0001'
import pandas as pd
rs_gsr_df = pd.read_csv('/scratch/a/arisvoin/lbassman/spins_gradients/rs_gsr_df')
rs_gsr_grad_group = rs_gsr_df.groupby('grad_num')
rs_gsr_grad1_group = rs_gsr_grad_group.get_group('grad1')
rs_gsr_grad2_group = rs_gsr_grad_group.get_group('grad2')
rs_gsr_grad3_group = rs_gsr_grad_group.get_group('grad3')

ea_gsr_df = pd.read_csv('/scratch/a/arisvoin/lbassman/spins_gradients/ea_gsr_df')
ea_gsr_grad_group = ea_gsr_df.groupby('grad_num')
ea_gsr_grad1_group = ea_gsr_grad_group.get_group('grad1')
ea_gsr_grad2_group = ea_gsr_grad_group.get_group('grad2')
ea_gsr_grad3_group = ea_gsr_grad_group.get_group('grad3')

rs_nogsr_df = pd.read_csv('/scratch/a/arisvoin/lbassman/spins_gradients/rs_nogsr_df')
rs_nogsr_grad_group = rs_nogsr_df.groupby('grad_num')
rs_nogsr_grad1_group = rs_nogsr_grad_group.get_group('grad1')
rs_nogsr_grad2_group = rs_nogsr_grad_group.get_group('grad2')
rs_nogsr_grad3_group = rs_nogsr_grad_group.get_group('grad3')

ea_nogsr_df = pd.read_csv('/scratch/a/arisvoin/lbassman/spins_gradients/ea_nogsr_df')
ea_nogsr_grad_group = ea_nogsr_df.groupby('grad_num')
ea_nogsr_grad1_group = ea_nogsr_grad_group.get_group('grad1')
ea_nogsr_grad2_group = ea_nogsr_grad_group.get_group('grad2')
ea_nogsr_grad3_group = ea_nogsr_grad_group.get_group('grad3')
write_df_column_to_pscalar_nib(grad1_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad1.pscalar.nii')
write_df_column_to_pscalar_nib(grad2_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad2.pscalar.nii')
write_df_column_to_pscalar_nib(grad3_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad3.pscalar.nii')

write_df_column_to_pscalar_nib(grad1_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_GSR_grad1.pscalar.nii')
write_df_column_to_pscalar_nib(grad2_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_GSR_grad2.pscalar.nii')
write_df_column_to_pscalar_nib(grad3_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_GSR_grad3.pscalar.nii')

write_df_column_to_pscalar_nib(grad1_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_noGSR_grad1.pscalar.nii')
write_df_column_to_pscalar_nib(grad2_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_noGSR_grad2.pscalar.nii')
write_df_column_to_pscalar_nib(grad3_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_noGSR_grad3.pscalar.nii')

write_df_column_to_pscalar_nib(grad1_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_noGSR_grad1.pscalar.nii')
write_df_column_to_pscalar_nib(grad2_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_noGSR_grad2.pscalar.nii')
write_df_column_to_pscalar_nib(grad3_group, pconnGrad, columns = ['statistic'], labelname_column = 'ROI', to_filename = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_ea_noGSR_grad3.pscalar.nii')
test_plot = plot_cifti_surf_montage(left_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.L.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        right_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.R.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        cifti_map = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad1.pscalar.nii', 
                        bg_cifti_map = None, 
                        bg_cifti_map_index = 0,
                        colormap = "RdYlBu", 
                        darkness = 0,
                        to_filename = None)

test_plot = plot_cifti_surf_montage(left_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.L.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        right_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.R.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        cifti_map = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad2.pscalar.nii', 
                        bg_cifti_map = None, 
                        bg_cifti_map_index = 0,
                        colormap = "RdYlBu", 
                        darkness = 0,
                        to_filename = None)

test_plot = plot_cifti_surf_montage(left_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.L.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        right_surf = '/scratch/a/arisvoin/edickie/SPINS_glasser_tian/tpl-fsLR/S1200.R.inflated_MSMAll.32k_fs_LR.surf.gii', 
                        cifti_map = '/scratch/a/arisvoin/lbassman/spins_gradients/difference_rs_GSR_grad3.pscalar.nii', 
                        bg_cifti_map = None, 
                        bg_cifti_map_index = 0,
                        colormap = "RdYlBu", 
                        darkness = 0,
                        to_filename = None)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup