6767#alphas = [0, 0.001, 0.01, 0.1, 1.0, 5.0]
6868#alphas = [0, 0.001, 0.01, 0.1, 1.0, 5.0, 10, 100, 1000, 10000, 100000, 1000000]
6969alphas = [1 ]
70+ #alphas = [0.01, 1, 100, 10000]
7071
7172def format_axis (ax ):
7273 ax .spines ['top' ].set_visible (False )
@@ -972,7 +973,8 @@ def plot_pd_deviation(layers, tmdevs, cmdevs, trainedmodel):
972973
973974 for i in range (len (tmdevs )):
974975 plt .plot (range (len (layers )), tmdevs [i ], color = trainedmodel ['color' ], marker = 'D' , alpha = 0.15 , label = 'ind trained' )
975- plt .plot (range (len (layers )), cmdevs [i ], color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind control' )
976+ #plt.plot(range(len(layers)), cmdevs[i], color='grey', marker = 'D', alpha = 0.15, label='ind control')
977+ plt .plot (range (len (layers )), cmdevs [i ], color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ## eLife
976978
977979 #solution to calculate conf. interval of means from https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.t.html
978980 #t_corr = t.ppf(0.975, 4)
@@ -1011,8 +1013,10 @@ def plot_pd_deviation(layers, tmdevs, cmdevs, trainedmodel):
10111013 handles , _ = ax .get_legend_handles_labels ()
10121014 handles = np .array (handles )
10131015
1014- plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind control' , \
1015- 'mean of trained' , 'mean of controls' ])
1016+ #plt.legend(handles[[0,1,10,11]], ['ind trained', 'ind control', \
1017+ # 'mean of trained', 'mean of controls'])
1018+ plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind untrained' , \
1019+ 'mean of trained' , 'mean of untrained' ]) ## eLife
10161020
10171021 plt .tight_layout ()
10181022
@@ -1280,8 +1284,8 @@ def plotcomp_dir_accs(tcfdf, tcf, model):
12801284
12811285 handles , _ = ax .get_legend_handles_labels ()
12821286 handles = np .array (handles )
1283- plt .legend (['Dir Trained' , 'Dir Controls ' , \
1284- 'Acc Trained' , 'Acc Controls ' ])
1287+ plt .legend (['Dir Trained' , 'Dir Untrained ' , \
1288+ 'Acc Trained' , 'Acc Untrained ' ])
12851289
12861290 ax = format_axis (ax )
12871291
@@ -1419,9 +1423,11 @@ def plotcomp_tr_reg_twovars(tcfdf, tcfs, model, regressionmodel):
14191423
14201424 for i , mname in enumerate (trainednames ):
14211425 plt .plot (x , traineddirs [i ], color = combined_colorselector (model ['cmap' ], tcfs [0 ]), marker = 'o' , alpha = 0.15 , label = 'ind trained' )
1422- plt .plot (x , controldirs [i ], color = combined_colorselector (regressionmodel ['regression_cmap' ], tcfs [0 ]), marker = 'D' , alpha = 0.15 , label = 'ind control' )
1426+ #plt.plot(x, controldirs[i], color=combined_colorselector(regressionmodel['regression_cmap'], tcfs[0]), marker = 'D', alpha = 0.15, label='ind control')
1427+ plt .plot (x , controldirs [i ], color = combined_colorselector (regressionmodel ['regression_cmap' ], tcfs [0 ]), marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ##eLife
14231428 plt .plot (x , trainedlabels [i ], color = combined_colorselector (model ['cmap' ], tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'o' , alpha = 0.15 , label = 'ind trained' )
1424- plt .plot (x , controllabels [i ], color = combined_colorselector (regressionmodel ['regression_cmap' ], tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , alpha = 0.15 , label = 'ind control' )
1429+ #plt.plot(x, controllabels[i], color=combined_colorselector(regressionmodel['regression_cmap'], tcfs[1]), linestyle=(0,(5,5)), marker = 'D', alpha = 0.15, label='ind control')
1430+ plt .plot (x , controllabels [i ], color = combined_colorselector (regressionmodel ['regression_cmap' ], tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ##eLife
14251431
14261432 #print(traineddirs)
14271433 #print(errs_traineddirs)
@@ -1527,17 +1533,19 @@ def plotcomp_twovars(tcfdf, tcfs, model):
15271533
15281534 for i , mname in enumerate (trainednames ):
15291535 plt .plot (x , traineddirs [i ], color = combined_colorselector (model ['cmap' ], tcfs [0 ]), marker = 'o' , alpha = 0.15 , label = 'ind trained' )
1530- plt .plot (x , controldirs [i ], color = combined_colorselector ('Greys_r' , tcfs [0 ]), marker = 'D' , alpha = 0.15 , label = 'ind control' )
1536+ #plt.plot(x, controldirs[i], color=combined_colorselector('Greys_r', tcfs[0]), marker = 'D', alpha = 0.15, label='ind control')
1537+ plt .plot (x , controldirs [i ], color = combined_colorselector ('Greys_r' , tcfs [0 ]), marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ## eLife
15311538 plt .plot (x , trainedlabels [i ], color = combined_colorselector (model ['cmap' ], tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'o' , alpha = 0.15 , label = 'ind trained' )
1532- plt .plot (x , controllabels [i ], color = combined_colorselector ('Greys_r' , tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , alpha = 0.15 , label = 'ind control' )
1539+ ##plt.plot(x, controllabels[i], color=combined_colorselector('Greys_r', tcfs[1]), linestyle=(0,(5,5)), marker = 'D', alpha = 0.15, label='ind control')
1540+ plt .plot (x , controllabels [i ], color = combined_colorselector ('Greys_r' , tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , alpha = 0.15 , label = 'ind untrained' )
15331541
15341542 #print(traineddirs)
15351543 #print(errs_traineddirs)
15361544
15371545 plt .errorbar (x , mean_traineddirs , yerr = errs_traineddirs , color = combined_colorselector (model ['cmap' ], tcfs [0 ]), marker = 'o' , capsize = 3.0 , label = 'mean trained dir' )
1538- plt .errorbar (x , mean_controldirs , yerr = errs_controldirs , color = combined_colorselector ('Greys_r' , tcfs [0 ]), marker = 'D' , capsize = 3.0 , label = 'mean controls dir' )
1546+ plt .errorbar (x , mean_controldirs , yerr = errs_controldirs , color = combined_colorselector ('Greys_r' , tcfs [0 ]), marker = 'D' , capsize = 3.0 , label = 'mean untrained dir' )
15391547 plt .errorbar (x , mean_trainedlabels , yerr = errs_trainedlabels , color = combined_colorselector (model ['cmap' ], tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'o' , capsize = 3.0 , label = 'mean trained pos' )
1540- plt .errorbar (x , mean_controllabels , yerr = errs_controllabels , color = combined_colorselector ('Greys_r' , tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , capsize = 3.0 , label = 'mean controls dir' )
1548+ plt .errorbar (x , mean_controllabels , yerr = errs_controllabels , color = combined_colorselector ('Greys_r' , tcfs [1 ]), linestyle = (0 ,(5 ,5 )), marker = 'D' , capsize = 3.0 , label = 'mean untrained dir' )
15411549 plt .ylabel ('r2 score' )
15421550
15431551 #plt.xticks(np.array(x), ['Spindles'] + ['Layer %d' %i for i in np.arange(1,model['nlayers']+1)], rotation=45,
@@ -1562,9 +1570,9 @@ def plotcomp_twovars(tcfdf, tcfs, model):
15621570 #plt.legend(handles[[0,20]], ['Ind.', 'Mean'], loc='upper left')
15631571 print ("MODEL REGRESSION TASK for model %s : %s" % (model ['name' ], model ['regression_task' ]))
15641572 if not model ['regression_task' ]:
1565- plt .legend (handles [[20 ,21 ]], ['ART-trained' , 'Controls ' ], loc = 'upper left' )
1573+ plt .legend (handles [[20 ,21 ]], ['ART-trained' , 'Untrained ' ], loc = 'upper left' )
15661574 else :
1567- plt .legend (handles [[20 ,21 ]], ['TDT-trained' , 'Controls ' ], loc = 'upper left' )
1575+ plt .legend (handles [[20 ,21 ]], ['TDT-trained' , 'Untrained ' ], loc = 'upper left' )
15681576
15691577 ax .add_artist (leg1 )
15701578
@@ -1640,8 +1648,8 @@ def plotcomp_ees(tcfdf, model):
16401648
16411649 handles , _ = ax .get_legend_handles_labels ()
16421650 handles = np .array (handles )
1643- plt .legend (['Cart Trained' , 'Cart Controls ' , \
1644- 'Polar Trained' , 'Polar Controls ' ])
1651+ plt .legend (['Cart Trained' , 'Cart Untrained ' , \
1652+ 'Polar Trained' , 'Polar Untrained ' ])
16451653
16461654 ax = format_axis (ax )
16471655
@@ -1774,10 +1782,12 @@ def plotcomp_decoding(tcfdf, tcf, model):
17741782
17751783 for i , mname in enumerate (trainednames ):
17761784 plt .plot (x , traineddirs [i ], color = model ['color' ], marker = 'D' , alpha = 0.15 , label = 'ind trained' )
1777- plt .plot (x , controldirs [i ], color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind control' )
1785+ #plt.plot(x, controldirs[i], color='grey', marker = 'D', alpha = 0.15, label='ind control')
1786+ plt .plot (x , controldirs [i ], color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ##eLife
17781787
17791788 plt .errorbar (x , traineddirs_mean , yerr = errs_traineddirs , color = colorselector_dec (model ['cmap' ], tcf ), marker = 'D' , capsize = 3.0 , label = 'mean trained' )
1780- plt .errorbar (x , controldirs_mean , yerr = errs_controldirs , color = colorselector_dec ('Greys_r' , tcf ), marker = 'D' , capsize = 3.0 , label = 'mean controls' )
1789+ #plt.errorbar(x, controldirs_mean, yerr=errs_controldirs, color=colorselector_dec('Greys_r', tcf), marker='D', capsize=3.0, label='mean controls')
1790+ plt .errorbar (x , controldirs_mean , yerr = errs_controldirs , color = colorselector_dec ('Greys_r' , tcf ), marker = 'D' , capsize = 3.0 , label = 'mean untrained' ) ##eLife
17811791 plt .ylabel ('r2 score' )
17821792 #plt.xticks(np.array(x), ['Spindles'] + ['Layer %d' %i for i in np.arange(1,model['nlayers']+1)], rotation=45,
17831793 # horizontalalignment = 'right')
@@ -1793,8 +1803,11 @@ def plotcomp_decoding(tcfdf, tcf, model):
17931803 handles , _ = ax .get_legend_handles_labels ()
17941804 handles = np .array (handles )
17951805
1796- plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind control' , \
1797- 'mean of trained' , 'mean of controls' ])
1806+ #plt.legend(handles[[0,1,10,11]], ['ind trained', 'ind control', \
1807+ # 'mean of trained', 'mean of controls'])
1808+
1809+ plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind untrained' , \
1810+ 'mean of trained' , 'mean of untrained' ]) ## eLife
17981811
17991812 plt .tight_layout ()
18001813
@@ -1878,9 +1891,11 @@ def plotcomp_decoding_twovars(tcfdf, tcfs, model):
18781891
18791892 #plt.legend(handles=[line_indtrainedvar1, line_meantrainedvar1], labels=["Ind.", 'Mean'], loc='upper left')
18801893 if not model ['regression_task' ]:
1881- plt .legend (handles = [line_meantrainedvar1 , line_meancontrolsvar1 ], labels = ["ART-trained" , 'Controls' ], loc = 'upper left' )
1894+ #plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["ART-trained", 'Untrained'], loc='upper left')
1895+ plt .legend (handles = [line_meantrainedvar1 , line_meancontrolsvar1 ], labels = ["ART-trained" , 'Untrained' ], loc = 'upper left' ) ##eLife
18821896 else :
1883- plt .legend (handles = [line_meantrainedvar1 , line_meancontrolsvar1 ], labels = ["TDT-trained" , 'Controls' ], loc = 'upper left' )
1897+ #plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["TDT-trained", 'Untrained'], loc='upper left')
1898+ plt .legend (handles = [line_meantrainedvar1 , line_meancontrolsvar1 ], labels = ["TDT-trained" , 'Untrained' ], loc = 'upper left' )
18841899
18851900 #print("Handles: ", handles)
18861901
@@ -2070,9 +2085,9 @@ def plotcomp_tr_reg_decoding_twovars(tcfdf, tcfs, model, regressionmodel):
20702085 #plt.legend(handles=[line_indtrainedvar1, line_meantrainedvar1], labels=["Ind.", 'Mean'], loc='upper left')
20712086 '''
20722087 if not model['regression_task']:
2073- plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["ART-trained", 'Controls '], loc='upper left')
2088+ plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["ART-trained", 'Untrained '], loc='upper left')
20742089 else:
2075- plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["TDT-trained", 'Controls '], loc='upper left')
2090+ plt.legend(handles=[line_meantrainedvar1, line_meancontrolsvar1], labels=["TDT-trained", 'Untrained '], loc='upper left')
20762091 '''
20772092 plt .legend (handles = [line_meantrainedvar1 , line_meancontrolsvar1 ], labels = ["ART" , 'TDT' ], loc = 'upper left' )
20782093
@@ -2412,7 +2427,8 @@ def plot_inic_am(layers, alltmdevmeans, allcmdevmeans, trainedmodel):
24122427
24132428 for i in range (len (alltmdevmeans )):
24142429 plt .plot (layers , np .nanmean (np .abs (alltmdevmeans [i ]), axis = 1 ), color = trainedmodel ['color' ], marker = 'D' , alpha = 0.15 , label = 'ind trained' )
2415- plt .plot (layers , np .nanmean (np .abs (allcmdevmeans [i ]), axis = 1 ), color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind control' )
2430+ #plt.plot(layers, np.nanmean(np.abs(allcmdevmeans[i]), axis=1), color='grey', marker = 'D', alpha = 0.15, label='ind control')
2431+ plt .plot (layers , np .nanmean (np .abs (allcmdevmeans [i ]), axis = 1 ), color = 'grey' , marker = 'D' , alpha = 0.15 , label = 'ind untrained' ) ##eLife
24162432
24172433 plt .errorbar (layers , tmsmean , yerr = errs_tmsmean , marker = 'D' , color = trainedmodel ['color' ], capsize = 3.0 , label = 'mean of trained' )
24182434 plt .errorbar (layers , cmsmean , yerr = errs_cmsmean , marker = 'D' , color = 'grey' , capsize = 3.0 , label = 'mean of controls' )
@@ -2427,8 +2443,11 @@ def plot_inic_am(layers, alltmdevmeans, allcmdevmeans, trainedmodel):
24272443 handles , _ = ax .get_legend_handles_labels ()
24282444 handles = np .array (handles )
24292445
2430- plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind control' , \
2431- 'mean of trained' , 'mean of controls' ])
2446+ #plt.legend(handles[[0,1,10,11]], ['ind trained', 'ind control', \
2447+ # 'mean of trained', 'mean of controls'])
2448+
2449+ plt .legend (handles [[0 ,1 ,10 ,11 ]], ['ind trained' , 'ind untrained' , \
2450+ 'mean of trained' , 'mean of untrained' ]) ##eLife
24322451
24332452 return figboth , df
24342453
@@ -2515,7 +2534,8 @@ def main(model, runinfo):
25152534 #if(not os.path.exists(runinfo.sharedanalysisfolder(model, 'kindiffs'))):
25162535 #if(True):
25172536 #if(runinfo.default_run):
2518- if (runinfo ['height' ] == 'all' ):
2537+ if (runinfo .default_run and runinfo ['height' ] == 'all' ):
2538+ #if(True and runinfo['height'] == 'all'):
25192539 print ('compiling dataframe for comparions...' )
25202540 df = compile_comparisons_df (model , runinfo )
25212541
@@ -2543,8 +2563,8 @@ def main(model, runinfo):
25432563
25442564 #if(not os.path.exists(runinfo.sharedanalysisfolder(model, 'kindiffs_plots'))):
25452565 #if(True):
2546- if (runinfo .default_run ):
2547- # if(runinfo['height'] == 'all'):
2566+ # if(runinfo.default_run):
2567+ if (runinfo . default_run and runinfo ['height' ] == 'all' ):
25482568 print ('running tcctrlcompplots for model %s ' % model ['name' ])
25492569 if df is None :
25502570 analysisfolder = runinfo .sharedanalysisfolder (model , 'kindiffs' )
@@ -2556,11 +2576,12 @@ def main(model, runinfo):
25562576 print ('kindiffs plots already made' )
25572577
25582578 #decoding kindiffs plots
2559- if (runinfo .default_run ):
2560- #if(runinfo['height'] == 'all'):
2579+ #if(runinfo.default_run):
2580+ #if(runinfo.default_run and runinfo['height'] == 'all'):
2581+ if (runinfo ['height' ] == 'all' ):
25612582 for alpha in alphas :
25622583 '''
2563- if decoding_df is None:
2584+ if decoding_df is None:W
25642585 analysisfolder = runinfo.sharedanalysisfolder(model, 'decoding_kindiffs')
25652586 #SWITCH FOR NORMALIZATION
25662587 #decoding_df = pd.read_csv(os.path.join(analysisfolder, model['base'] + '_decoding_comparisons_df_normalized.csv'),
@@ -2573,9 +2594,10 @@ def main(model, runinfo):
25732594 else :
25742595 print ('decoding kindiffs plots already made' )
25752596
2576- # if(runinfo.default_run):
2597+ if (runinfo .default_run ):
25772598 #if(not os.path.exists(runinfo.sharedanalysisfolder(model, 'pd_deviation'))):
2578- if (False ):
2599+ #if(False):
2600+ #if(True):
25792601 print ('computing deviation measure for PDs' )
25802602 pd_deviation (model , runinfo )
25812603 print ('df saved' )
@@ -2627,8 +2649,9 @@ def comparisons_tr_reg_main(taskmodel, regressionmodel, runinfo, alpha=None):
26272649 print ('skipping pairedt quantiles' )
26282650
26292651 #if(not os.path.exists(runinfo.sharedanalysisfolder(model, 'kindiffs_plots'))):
2630- #if(runinfo['height'] == 'all'):
2631- if (runinfo .default_run ):
2652+ if (runinfo ['height' ] == 'all' and runinfo .default_run ):
2653+ #if(runinfo['height'] == 'all' and True):
2654+ #if(runinfo.default_run):
26322655 if df is None :
26332656 analysisfolder = runinfo .sharedanalysisfolder (taskmodel , 'kindiffs_tr_reg' )
26342657 df = pd .read_csv (os .path .join (analysisfolder , taskmodel ['base' ] + '_comparisons_reg_tr_df.csv' ),
@@ -2641,8 +2664,8 @@ def comparisons_tr_reg_main(taskmodel, regressionmodel, runinfo, alpha=None):
26412664
26422665 #decoding kindiffs plots
26432666 #if(runinfo.default_run):
2644- if (False ):
2645- # if(runinfo['height'] == 'all'):
2667+ # if(False):
2668+ if (runinfo ['height' ] == 'all' ):
26462669 for alpha in alphas :
26472670 #if decoding_df is None:
26482671 decoding_df = compile_decoding_comparisons_tr_reg_df (taskmodel , regressionmodel , runinfo , alpha )
0 commit comments