123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- import matplotlib.pyplot as plt
- import numpy as np
- import pandas as pd
- from master_funcs import *
- from collections import Counter
- from imblearn.over_sampling import SMOTE
- from imblearn.under_sampling import RandomUnderSampler
- from imblearn.pipeline import Pipeline
- import dill
- #%matplotlib qt
- import scipy
- import seaborn as sn
- import pingouin as pg
- import warnings
- import dataframe_image as dfi
- warnings.filterwarnings("ignore")
- ## Manual Rater Results Table
- # ============================================================================================================================================
- mr_cyl_1=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jan_figure.csv", index_col=0, delimiter=',', header=0)
- mr_cyl_2=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Nicole_figure.csv", index_col=0, delimiter=',', header=0)
- mr_cyl_3=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jule_figure.csv", index_col=0, delimiter=',', header=0)
- mr_gw_1=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Jan_figure.csv", index_col=0, delimiter=',', header=0)
- mr_gw_2=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Nicole_figure.csv", index_col=0, delimiter=',', header=0)
- mr_gw_3=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Jule_figure.csv", index_col=0, delimiter=',', header=0)
- dfi.export(mr_cyl_1, '/home/user/owncloud/thesis_figures/MR_CY_1.png', max_cols=51)
- dfi.export(mr_cyl_2, '/home/user/owncloud/thesis_figures/MR_CY_2.png', max_cols=51)
- dfi.export(mr_cyl_3, '/home/user/owncloud/thesis_figures/MR_CY_3.png', max_cols=51)
- dfi.export(mr_gw_1, '/home/user/owncloud/thesis_figures/MR_GW_1.png')
- dfi.export(mr_gw_2, '/home/user/owncloud/thesis_figures/MR_GW_2.png')
- dfi.export(mr_gw_3, '/home/user/owncloud/thesis_figures/MR_GW_3.png')
- # ============================================================================================================================================
- ## Correlation Feature Footfault within MR and between MR and DLC plus FI 2D and 3D
- # ============================================================================================================================================
- mr_cyl_1=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Jan.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_2=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Nicole.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_3=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_GridWalk_Analyse_Jule.csv", index_col=0, delimiter=',', header=None)
- patients=['PB_T2_3_1', 'PB_T2_3_2', 'PB_T2_3_3', 'PB_T2_4_2', 'PB_T2_5_1', 'PB_T2_6_1', 'PB_T2_6_2', 'PB_T3_23_1', 'PB_T3_23_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3']
- max_i=np.array([np.nanmax(mr_cyl_1.loc['PB_T2_3_1']), np.nanmax(mr_cyl_2.loc['PB_T2_3_1']), np.nanmax(mr_cyl_3.loc['PB_T2_3_1']), np.nanmax(footfault_2d.loc['PB_T2_3_1']), np.nanmax(footfault_FI_2d.loc['PB_T2_3_1']), np.nanmax(footfault_3d.loc['PB_T2_3_1']), np.nanmax(footfault_FI_3d.loc['PB_T2_3_1'])])
- mr_cyl_1_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_2_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_3_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_FI_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_FI_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_1.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_2.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_3.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_3_corr[int(i-15):int(i+16)]=1
- for i in footfault_2d.loc['PB_T2_3_1']:
- if i>0:
- footfault_2d_corr[int(i-15):int(i+16)]=1
- for i in footfault_FI_2d.loc['PB_T2_3_1']:
- if i>0:
- footfault_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in footfault_3d.loc['PB_T2_3_1']:
- if i>0:
- footfault_3d_corr[int(i-15):int(i+16)]=1
- for i in footfault_FI_3d.loc['PB_T2_3_1']:
- if i>0:
- footfault_FI_3d_corr[int(i-15):int(i+16)]=1
-
- for z in patients[1:]:
- max_i=np.array([np.nanmax(mr_cyl_1.loc[z]), np.nanmax(mr_cyl_2.loc[z]), np.nanmax(mr_cyl_3.loc[z]), np.nanmax(footfault_2d.loc[z]), np.nanmax(footfault_FI_2d.loc[z]), np.nanmax(footfault_3d.loc[z]), np.nanmax(footfault_FI_3d.loc[z])])
- if all(max_i==max_i):
- mr_cyl_1_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_2_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_3_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_FI_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- footfault_FI_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_1.loc[z]:
- if i>0:
- mr_cyl_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_2.loc[z]:
- if i>0:
- mr_cyl_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_3.loc[z]:
- if i>0:
- mr_cyl_3_corr[int(i-15):int(i+16)]=1
- for i in footfault_2d.loc[z]:
- if i>0:
- footfault_2d_corr[int(i-15):int(i+16)]=1
- for i in footfault_FI_2d.loc[z]:
- if i>0:
- footfault_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in footfault_3d.loc[z]:
- if i>0:
- footfault_3d_corr[int(i-15):int(i+16)]=1
- for i in footfault_FI_3d.loc[z]:
- if i>0:
- footfault_FI_3d_corr[int(i-15):int(i+16)]=1
- mr_cyl_1_corr=np.r_[mr_cyl_1_corr, mr_cyl_1_corr_temp]
- mr_cyl_2_corr=np.r_[mr_cyl_2_corr, mr_cyl_2_corr_temp]
- mr_cyl_3_corr=np.r_[mr_cyl_3_corr, mr_cyl_3_corr_temp]
- footfault_2d_corr=np.r_[footfault_2d_corr, footfault_2d_corr_temp]
- footfault_FI_2d_corr=np.r_[footfault_FI_2d_corr, footfault_FI_2d_corr_temp]
- footfault_3d_corr=np.r_[footfault_3d_corr, footfault_3d_corr_temp]
- footfault_FI_3d_corr=np.r_[footfault_FI_3d_corr, footfault_FI_3d_corr_temp]
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_1_corr, mr_cyl_2_corr), jaccard(mr_cyl_1_corr, mr_cyl_3_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_2_corr), 1, jaccard(mr_cyl_2_corr, mr_cyl_3_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, mr_cyl_3_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(3, 3))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_MR_GW.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_1_corr, mr_cyl_2_corr), jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_1_corr, footfault_2d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_2_corr), 1, jaccard(mr_cyl_2_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, footfault_2d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, mr_cyl_3_corr), 1, jaccard(mr_cyl_3_corr, footfault_2d_corr)],
- [jaccard(mr_cyl_1_corr, footfault_2d_corr), jaccard(mr_cyl_2_corr, footfault_2d_corr), jaccard(mr_cyl_3_corr, footfault_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_GW_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_1_corr, mr_cyl_2_corr), jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_1_corr, footfault_FI_2d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_2_corr), 1, jaccard(mr_cyl_2_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, footfault_FI_2d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, mr_cyl_3_corr), 1, jaccard(mr_cyl_3_corr, footfault_FI_2d_corr)],
- [jaccard(mr_cyl_1_corr, footfault_FI_2d_corr), jaccard(mr_cyl_2_corr, footfault_FI_2d_corr), jaccard(mr_cyl_3_corr, footfault_FI_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_GW_FI_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_1_corr, mr_cyl_2_corr), jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_1_corr, footfault_3d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_2_corr), 1, jaccard(mr_cyl_2_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, footfault_3d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, mr_cyl_3_corr), 1, jaccard(mr_cyl_3_corr, footfault_3d_corr)],
- [jaccard(mr_cyl_1_corr, footfault_3d_corr), jaccard(mr_cyl_2_corr, footfault_3d_corr), jaccard(mr_cyl_3_corr, footfault_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_GW_3d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_1_corr, mr_cyl_2_corr), jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_1_corr, footfault_FI_3d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_2_corr), 1, jaccard(mr_cyl_2_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, footfault_FI_3d_corr)],
- [jaccard(mr_cyl_1_corr, mr_cyl_3_corr), jaccard(mr_cyl_2_corr, mr_cyl_3_corr), 1, jaccard(mr_cyl_3_corr, footfault_FI_3d_corr)],
- [jaccard(mr_cyl_1_corr, footfault_FI_3d_corr), jaccard(mr_cyl_2_corr, footfault_FI_3d_corr), jaccard(mr_cyl_3_corr, footfault_FI_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_GW_FI_3d.png", format='png', dpi=200)
- print('GW 3D')
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_1_corr))]+[i for i in range(len(mr_cyl_2_corr))]+[i for i in range(len(mr_cyl_3_corr))], 'rater':['1']*len(mr_cyl_1_corr)+['2']*len(mr_cyl_2_corr)+['3']*len(mr_cyl_3_corr), 'rating':np.concatenate((mr_cyl_1_corr, mr_cyl_2_corr, mr_cyl_3_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_1_corr))]+[i for i in range(len(mr_cyl_2_corr))]+[i for i in range(len(mr_cyl_3_corr))]+[i for i in range(len(footfault_2d_corr))], 'rater':['1']*len(mr_cyl_1_corr)+['2']*len(mr_cyl_2_corr)+['3']*len(mr_cyl_3_corr)+['DLC']*len(footfault_2d_corr), 'rating':np.concatenate((mr_cyl_1_corr, mr_cyl_2_corr, mr_cyl_3_corr, footfault_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_1_corr))]+[i for i in range(len(mr_cyl_2_corr))]+[i for i in range(len(mr_cyl_3_corr))]+[i for i in range(len(footfault_FI_2d_corr))], 'rater':['1']*len(mr_cyl_1_corr)+['2']*len(mr_cyl_2_corr)+['3']*len(mr_cyl_3_corr)+['DLC']*len(footfault_FI_2d_corr), 'rating':np.concatenate((mr_cyl_1_corr, mr_cyl_2_corr, mr_cyl_3_corr, footfault_FI_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_1_corr))]+[i for i in range(len(mr_cyl_2_corr))]+[i for i in range(len(mr_cyl_3_corr))]+[i for i in range(len(footfault_3d_corr))], 'rater':['1']*len(mr_cyl_1_corr)+['2']*len(mr_cyl_2_corr)+['3']*len(mr_cyl_3_corr)+['DLC']*len(footfault_3d_corr), 'rating':np.concatenate((mr_cyl_1_corr, mr_cyl_2_corr, mr_cyl_3_corr, footfault_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_1_corr))]+[i for i in range(len(mr_cyl_2_corr))]+[i for i in range(len(mr_cyl_3_corr))]+[i for i in range(len(footfault_FI_3d_corr))], 'rater':['1']*len(mr_cyl_1_corr)+['2']*len(mr_cyl_2_corr)+['3']*len(mr_cyl_3_corr)+['DLC']*len(footfault_FI_3d_corr), 'rating':np.concatenate((mr_cyl_1_corr, mr_cyl_2_corr, mr_cyl_3_corr, footfault_FI_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- # ============================================================================================================================================
- ## Correlation Feature Cylinder Touch within MR and between MR and DLC plus FI 2D and 3D
- # ============================================================================================================================================
- mr_cyl_touch_1=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jan_touch.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_touch_2=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Nicole_touch.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_touch_3=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jule_touch.csv", index_col=0, delimiter=',', header=None)
- patients=['PB_T2_3_1', 'PB_T2_3_2', 'PB_T2_3_3', 'PB_T2_4_2', 'PB_T2_5_1', 'PB_T2_6_1', 'PB_T2_6_2', 'PB_T3_23_1', 'PB_T3_23_2', 'PB_T3_23_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3']
- max_i=np.array([np.nanmax(mr_cyl_touch_1.loc['PB_T2_3_1']), np.nanmax(mr_cyl_touch_2.loc['PB_T2_3_1']), np.nanmax(mr_cyl_touch_3.loc['PB_T2_3_1']), np.nanmax(touch_2d.loc['PB_T2_3_1']), np.nanmax(touch_FI_2d.loc['PB_T2_3_1']), np.nanmax(touch_3d.loc['PB_T2_3_1']), np.nanmax(touch_FI_3d.loc['PB_T2_3_1'])])
- mr_cyl_touch_1_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_touch_2_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_touch_3_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_FI_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_FI_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_touch_1.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_touch_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_touch_2.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_touch_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_touch_3.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_touch_3_corr[int(i-15):int(i+16)]=1
- for i in touch_2d.loc['PB_T2_3_1']:
- if i>0:
- touch_2d_corr[int(i-15):int(i+16)]=1
- for i in touch_FI_2d.loc['PB_T2_3_1']:
- if i>0:
- touch_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in touch_3d.loc['PB_T2_3_1']:
- if i>0:
- touch_3d_corr[int(i-15):int(i+16)]=1
- for i in touch_FI_3d.loc['PB_T2_3_1']:
- if i>0:
- touch_FI_3d_corr[int(i-15):int(i+16)]=1
-
- for z in patients[1:]:
- max_i=np.array([np.nanmax(mr_cyl_touch_1.loc[z]), np.nanmax(mr_cyl_touch_2.loc[z]), np.nanmax(mr_cyl_touch_3.loc[z]), np.nanmax(touch_2d.loc[z]), np.nanmax(touch_FI_2d.loc[z]), np.nanmax(touch_3d.loc[z]), np.nanmax(touch_FI_3d.loc[z])])
- if all(max_i==max_i):
- mr_cyl_touch_1_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_touch_2_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_touch_3_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_FI_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- touch_FI_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_touch_1.loc[z]:
- if i>0:
- mr_cyl_touch_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_touch_2.loc[z]:
- if i>0:
- mr_cyl_touch_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_touch_3.loc[z]:
- if i>0:
- mr_cyl_touch_3_corr[int(i-15):int(i+16)]=1
- for i in touch_2d.loc[z]:
- if i>0:
- touch_2d_corr[int(i-15):int(i+16)]=1
- for i in touch_FI_2d.loc[z]:
- if i>0:
- touch_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in touch_3d.loc[z]:
- if i>0:
- touch_3d_corr[int(i-15):int(i+16)]=1
- for i in touch_FI_3d.loc[z]:
- if i>0:
- touch_FI_3d_corr[int(i-15):int(i+16)]=1
- mr_cyl_touch_1_corr=np.r_[mr_cyl_touch_1_corr, mr_cyl_touch_1_corr_temp]
- mr_cyl_touch_2_corr=np.r_[mr_cyl_touch_2_corr, mr_cyl_touch_2_corr_temp]
- mr_cyl_touch_3_corr=np.r_[mr_cyl_touch_3_corr, mr_cyl_touch_3_corr_temp]
- touch_2d_corr=np.r_[touch_2d_corr, touch_2d_corr_temp]
- touch_FI_2d_corr=np.r_[touch_FI_2d_corr, touch_FI_2d_corr_temp]
- touch_3d_corr=np.r_[touch_3d_corr, touch_3d_corr_temp]
- touch_FI_3d_corr=np.r_[touch_FI_3d_corr, touch_FI_3d_corr_temp]
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), 1, jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(3, 3))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_MR_CY_touch.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_1_corr, touch_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), 1, jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, touch_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), 1, jaccard(mr_cyl_touch_3_corr, touch_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, touch_2d_corr), jaccard(mr_cyl_touch_2_corr, touch_2d_corr), jaccard(mr_cyl_touch_3_corr, touch_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_touch_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_1_corr, touch_FI_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), 1, jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, touch_FI_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), 1, jaccard(mr_cyl_touch_3_corr, touch_FI_2d_corr)],
- [jaccard(mr_cyl_touch_1_corr, touch_FI_2d_corr), jaccard(mr_cyl_touch_2_corr, touch_FI_2d_corr), jaccard(mr_cyl_touch_3_corr, touch_FI_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_touch_FI_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_1_corr, touch_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), 1, jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, touch_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), 1, jaccard(mr_cyl_touch_3_corr, touch_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, touch_3d_corr), jaccard(mr_cyl_touch_2_corr, touch_3d_corr), jaccard(mr_cyl_touch_3_corr, touch_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_touch_3d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_1_corr, touch_FI_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_2_corr), 1, jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, touch_FI_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, mr_cyl_touch_3_corr), jaccard(mr_cyl_touch_2_corr, mr_cyl_touch_3_corr), 1, jaccard(mr_cyl_touch_3_corr, touch_FI_3d_corr)],
- [jaccard(mr_cyl_touch_1_corr, touch_FI_3d_corr), jaccard(mr_cyl_touch_2_corr, touch_FI_3d_corr), jaccard(mr_cyl_touch_3_corr, touch_FI_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_touch_FI_3d.png", format='png', dpi=200)
- print('CY touch 3D')
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_touch_1_corr))]+[i for i in range(len(mr_cyl_touch_2_corr))]+[i for i in range(len(mr_cyl_touch_3_corr))], 'rater':['1']*len(mr_cyl_touch_1_corr)+['2']*len(mr_cyl_touch_2_corr)+['3']*len(mr_cyl_touch_3_corr), 'rating':np.concatenate((mr_cyl_touch_1_corr, mr_cyl_touch_2_corr, mr_cyl_touch_3_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_touch_1_corr))]+[i for i in range(len(mr_cyl_touch_2_corr))]+[i for i in range(len(mr_cyl_touch_3_corr))]+[i for i in range(len(touch_2d_corr))], 'rater':['1']*len(mr_cyl_touch_1_corr)+['2']*len(mr_cyl_touch_2_corr)+['3']*len(mr_cyl_touch_3_corr)+['DLC']*len(touch_2d_corr), 'rating':np.concatenate((mr_cyl_touch_1_corr, mr_cyl_touch_2_corr, mr_cyl_touch_3_corr, touch_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_touch_1_corr))]+[i for i in range(len(mr_cyl_touch_2_corr))]+[i for i in range(len(mr_cyl_touch_3_corr))]+[i for i in range(len(touch_FI_2d_corr))], 'rater':['1']*len(mr_cyl_touch_1_corr)+['2']*len(mr_cyl_touch_2_corr)+['3']*len(mr_cyl_touch_3_corr)+['DLC']*len(touch_FI_2d_corr), 'rating':np.concatenate((mr_cyl_touch_1_corr, mr_cyl_touch_2_corr, mr_cyl_touch_3_corr, touch_FI_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_touch_1_corr))]+[i for i in range(len(mr_cyl_touch_2_corr))]+[i for i in range(len(mr_cyl_touch_3_corr))]+[i for i in range(len(touch_3d_corr))], 'rater':['1']*len(mr_cyl_touch_1_corr)+['2']*len(mr_cyl_touch_2_corr)+['3']*len(mr_cyl_touch_3_corr)+['DLC']*len(touch_3d_corr), 'rating':np.concatenate((mr_cyl_touch_1_corr, mr_cyl_touch_2_corr, mr_cyl_touch_3_corr, touch_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_touch_1_corr))]+[i for i in range(len(mr_cyl_touch_2_corr))]+[i for i in range(len(mr_cyl_touch_3_corr))]+[i for i in range(len(touch_FI_3d_corr))], 'rater':['1']*len(mr_cyl_touch_1_corr)+['2']*len(mr_cyl_touch_2_corr)+['3']*len(mr_cyl_touch_3_corr)+['DLC']*len(touch_FI_3d_corr), 'rating':np.concatenate((mr_cyl_touch_1_corr, mr_cyl_touch_2_corr, mr_cyl_touch_3_corr, touch_FI_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- # ============================================================================================================================================
- ## Correlation Feature Cylinder Drag within MR and between MR and DLC plus FI 2D and 3D
- # ============================================================================================================================================
- mr_cyl_drag_1=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jan_drag.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_drag_2=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Nicole_drag.csv", index_col=0, delimiter=',', header=None)
- mr_cyl_drag_3=pd.read_csv("/home/user/owncloud/3D_videos/manual_raters/Manual_Cylinder_Analyse_Jule_drag.csv", index_col=0, delimiter=',', header=None)
- patients=['PB_T2_3_1', 'PB_T2_3_2', 'PB_T2_3_3', 'PB_T2_4_2', 'PB_T2_5_1', 'PB_T2_6_1', 'PB_T2_6_2', 'PB_T3_23_1', 'PB_T3_23_2', 'PB_T3_23_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3']
- max_i=np.array([np.nanmax(mr_cyl_drag_1.loc['PB_T2_3_1']), np.nanmax(mr_cyl_drag_2.loc['PB_T2_3_1']), np.nanmax(mr_cyl_drag_3.loc['PB_T2_3_1']), np.nanmax(drag_2d.loc['PB_T2_3_1']), np.nanmax(drag_FI_2d.loc['PB_T2_3_1']), np.nanmax(drag_3d.loc['PB_T2_3_1']), np.nanmax(drag_FI_3d.loc['PB_T2_3_1'])])
- mr_cyl_drag_1_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_drag_2_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_drag_3_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_FI_2d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_FI_3d_corr=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_drag_1.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_drag_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_drag_2.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_drag_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_drag_3.loc['PB_T2_3_1']:
- if i>0:
- mr_cyl_drag_3_corr[int(i-15):int(i+16)]=1
- for i in drag_2d.loc['PB_T2_3_1']:
- if i>0:
- drag_2d_corr[int(i-15):int(i+16)]=1
- for i in drag_FI_2d.loc['PB_T2_3_1']:
- if i>0:
- drag_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in drag_3d.loc['PB_T2_3_1']:
- if i>0:
- drag_3d_corr[int(i-15):int(i+16)]=1
- for i in drag_FI_3d.loc['PB_T2_3_1']:
- if i>0:
- drag_FI_3d_corr[int(i-15):int(i+16)]=1
-
- for z in patients[1:]:
- max_i=np.array([np.nanmax(mr_cyl_drag_1.loc[z]), np.nanmax(mr_cyl_drag_2.loc[z]), np.nanmax(mr_cyl_drag_3.loc[z]), np.nanmax(drag_2d.loc[z]), np.nanmax(drag_FI_2d.loc[z]), np.nanmax(drag_3d.loc[z]), np.nanmax(drag_FI_3d.loc[z])])
- if all(max_i==max_i):
- mr_cyl_drag_1_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_drag_2_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- mr_cyl_drag_3_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_FI_2d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- drag_FI_3d_corr_temp=np.zeros(shape=(int(np.nanmax(max_i)+11),))
- for i in mr_cyl_drag_1.loc[z]:
- if i>0:
- mr_cyl_drag_1_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_drag_2.loc[z]:
- if i>0:
- mr_cyl_drag_2_corr[int(i-15):int(i+16)]=1
- for i in mr_cyl_drag_3.loc[z]:
- if i>0:
- mr_cyl_drag_3_corr[int(i-15):int(i+16)]=1
- for i in drag_2d.loc[z]:
- if i>0:
- drag_2d_corr[int(i-15):int(i+16)]=1
- for i in drag_FI_2d.loc[z]:
- if i>0:
- drag_FI_2d_corr[int(i-15):int(i+16)]=1
- for i in drag_3d.loc[z]:
- if i>0:
- drag_3d_corr[int(i-15):int(i+16)]=1
- for i in drag_FI_3d.loc[z]:
- if i>0:
- drag_FI_3d_corr[int(i-15):int(i+16)]=1
- mr_cyl_drag_1_corr=np.r_[mr_cyl_drag_1_corr, mr_cyl_drag_1_corr_temp]
- mr_cyl_drag_2_corr=np.r_[mr_cyl_drag_2_corr, mr_cyl_drag_2_corr_temp]
- mr_cyl_drag_3_corr=np.r_[mr_cyl_drag_3_corr, mr_cyl_drag_3_corr_temp]
- drag_2d_corr=np.r_[drag_2d_corr, drag_2d_corr_temp]
- drag_FI_2d_corr=np.r_[drag_FI_2d_corr, drag_FI_2d_corr_temp]
- drag_3d_corr=np.r_[drag_3d_corr, drag_3d_corr_temp]
- drag_FI_3d_corr=np.r_[drag_FI_3d_corr, drag_FI_3d_corr_temp]
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), 1, jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(3, 3))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_MR_CY_drag.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_1_corr, drag_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), 1, jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, drag_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), 1, jaccard(mr_cyl_drag_3_corr, drag_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, drag_2d_corr), jaccard(mr_cyl_drag_2_corr, drag_2d_corr), jaccard(mr_cyl_drag_3_corr, drag_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_drag_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_1_corr, drag_FI_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), 1, jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, drag_FI_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), 1, jaccard(mr_cyl_drag_3_corr, drag_FI_2d_corr)],
- [jaccard(mr_cyl_drag_1_corr, drag_FI_2d_corr), jaccard(mr_cyl_drag_2_corr, drag_FI_2d_corr), jaccard(mr_cyl_drag_3_corr, drag_FI_2d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_drag_FI_2d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_1_corr, drag_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), 1, jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, drag_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), 1, jaccard(mr_cyl_drag_3_corr, drag_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, drag_3d_corr), jaccard(mr_cyl_drag_2_corr, drag_3d_corr), jaccard(mr_cyl_drag_3_corr, drag_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_drag_3d.png", format='png', dpi=200)
- sn.set_theme(style="white")
- d = pd.DataFrame(data=np.array([[1,jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_1_corr, drag_FI_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_2_corr), 1, jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, drag_FI_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, mr_cyl_drag_3_corr), jaccard(mr_cyl_drag_2_corr, mr_cyl_drag_3_corr), 1, jaccard(mr_cyl_drag_3_corr, drag_FI_3d_corr)],
- [jaccard(mr_cyl_drag_1_corr, drag_FI_3d_corr), jaccard(mr_cyl_drag_2_corr, drag_FI_3d_corr), jaccard(mr_cyl_drag_3_corr, drag_FI_3d_corr), 1]])
- , columns=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'], index=['Manual Rater 1', 'Manual Rater 2', 'Manual Rater 3', 'DLC'])
- mask = np.tril(np.ones_like(d, dtype=bool), k=-1)
- f, ax = plt.subplots(figsize=(4, 4))
- cmap = sn.diverging_palette(10, 250, s=90, l=40, as_cmap=True)
- sn.set(font_scale=3)
- hmap=sn.heatmap(d, mask=mask.T, cmap=cmap, vmax=1, vmin=0, center=0, annot=True, square=True, linewidths=1, cbar_kws={"shrink": .6}, fmt=".3g")
- hmap.set_xticklabels(hmap.get_xmajorticklabels(), fontsize = 40, rotation=45)
- hmap.set_yticklabels(hmap.get_ymajorticklabels(), fontsize = 40)
- hmap.figure.set_size_inches(22, 18)
- plt.tight_layout()
- hmap.figure.savefig("/home/user/owncloud/thesis_figures/Correlation_DLC_CY_drag_FI_3d.png", format='png', dpi=200)
- print('CY drag 3D')
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_drag_1_corr))]+[i for i in range(len(mr_cyl_drag_2_corr))]+[i for i in range(len(mr_cyl_drag_3_corr))], 'rater':['1']*len(mr_cyl_drag_1_corr)+['2']*len(mr_cyl_drag_2_corr)+['3']*len(mr_cyl_drag_3_corr), 'rating':np.concatenate((mr_cyl_drag_1_corr, mr_cyl_drag_2_corr, mr_cyl_drag_3_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_drag_1_corr))]+[i for i in range(len(mr_cyl_drag_2_corr))]+[i for i in range(len(mr_cyl_drag_3_corr))]+[i for i in range(len(drag_2d_corr))], 'rater':['1']*len(mr_cyl_drag_1_corr)+['2']*len(mr_cyl_drag_2_corr)+['3']*len(mr_cyl_drag_3_corr)+['DLC']*len(drag_2d_corr), 'rating':np.concatenate((mr_cyl_drag_1_corr, mr_cyl_drag_2_corr, mr_cyl_drag_3_corr, drag_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_drag_1_corr))]+[i for i in range(len(mr_cyl_drag_2_corr))]+[i for i in range(len(mr_cyl_drag_3_corr))]+[i for i in range(len(drag_FI_2d_corr))], 'rater':['1']*len(mr_cyl_drag_1_corr)+['2']*len(mr_cyl_drag_2_corr)+['3']*len(mr_cyl_drag_3_corr)+['DLC']*len(drag_FI_2d_corr), 'rating':np.concatenate((mr_cyl_drag_1_corr, mr_cyl_drag_2_corr, mr_cyl_drag_3_corr, drag_FI_2d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_drag_1_corr))]+[i for i in range(len(mr_cyl_drag_2_corr))]+[i for i in range(len(mr_cyl_drag_3_corr))]+[i for i in range(len(drag_3d_corr))], 'rater':['1']*len(mr_cyl_drag_1_corr)+['2']*len(mr_cyl_drag_2_corr)+['3']*len(mr_cyl_drag_3_corr)+['DLC']*len(drag_3d_corr), 'rating':np.concatenate((mr_cyl_drag_1_corr, mr_cyl_drag_2_corr, mr_cyl_drag_3_corr, drag_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- df=pd.DataFrame({'index':[i for i in range(len(mr_cyl_drag_1_corr))]+[i for i in range(len(mr_cyl_drag_2_corr))]+[i for i in range(len(mr_cyl_drag_3_corr))]+[i for i in range(len(drag_FI_3d_corr))], 'rater':['1']*len(mr_cyl_drag_1_corr)+['2']*len(mr_cyl_drag_2_corr)+['3']*len(mr_cyl_drag_3_corr)+['DLC']*len(drag_FI_3d_corr), 'rating':np.concatenate((mr_cyl_drag_1_corr, mr_cyl_drag_2_corr, mr_cyl_drag_3_corr, drag_FI_3d_corr))})
- icc = pg.intraclass_corr(data=df, targets='index', raters='rater', ratings='rating', nan_policy='omit')
- print(icc.loc[2])
- # ============================================================================================================================================
|