@@ -502,7 +502,7 @@ def population_fit(df_pop, n_components = 2, period = 24, lin_comp= False, model
502502
503503
504504 #results, statistics, rhythm_params, X_test, Y_test, model = fit_me(x, y, n_components = n_components, period = period, lin_comp=lin_comp, model_type = model_type, alpha=alpha, plot = False, return_model = True)
505- results , statistics , rhythm_params , X_test , Y_test , model = fit_me (x , y , n_components = n_components , period = period , plot = False , return_model = True , ** kwargs )
505+ results , statistics , rhythm_params , X_test , _ , model = fit_me (x , y , n_components = n_components , period = period , plot = False , return_model = True , ** kwargs )
506506 if type (params ) == int :
507507 params = results .params
508508 else :
@@ -577,7 +577,7 @@ def population_fit(df_pop, n_components = 2, period = 24, lin_comp= False, model
577577
578578
579579 if plot_on and plot_margins and model_type == 'lin' :
580- sdev , lower , upper = wls_prediction_std (results , exog = X_fit_eval_params , alpha = 0.05 )
580+ _ , lower , upper = wls_prediction_std (results , exog = X_fit_eval_params , alpha = 0.05 )
581581 plt .fill_between (X_test , lower , upper , color = '#888888' , alpha = 0.1 )
582582
583583 if plot_measurements :
@@ -634,7 +634,7 @@ def generate_permutations(n_pop1, n_pop2, N):
634634"""
635635def generate_permutations_all (pop1 , pop2 ):
636636 n_pop1 = len (pop1 )
637- n_pop2 = len (pop2 )
637+ # n_pop2 = len(pop2)
638638
639639 permutations = set ()
640640
@@ -696,13 +696,10 @@ def permutation_test_population(df, pairs, period = 24, n_components = 2, lin_co
696696
697697 tests1 = list (df_pop1 .test .unique ())
698698 tests2 = list (df_pop2 .test .unique ())
699- n_pop1 = len (tests1 )
700- n_pop2 = len (tests2 )
699+ # n_pop1 = len(tests1)
700+ # n_pop2 = len(tests2)
701701
702- #print(tests1)
703- #print(tests2)
704-
705- tests = np .array (tests1 + tests2 )
702+ #tests = np.array(tests1 + tests2)
706703
707704 """
708705 if not permutations:
@@ -881,7 +878,7 @@ def fit_me(X, Y, n_components = 2, period = 24, lin_comp = False, model_type = '
881878 if plot :
882879 if plot_margins :
883880 if model_type == 'lin' :
884- sdev , lower , upper = wls_prediction_std (results , exog = X_fit_test , alpha = 0.05 )
881+ _ , lower , upper = wls_prediction_std (results , exog = X_fit_test , alpha = 0.05 )
885882 if color :
886883 plt .fill_between (X_test , lower , upper , color = color , alpha = 0.1 )
887884 else :
@@ -1019,7 +1016,7 @@ def fit_me(X, Y, n_components = 2, period = 24, lin_comp = False, model_type = '
10191016 plt .show ()
10201017 if plot_residuals :
10211018 resid = results .resid
1022- fig = sm .qqplot (resid )
1019+ sm .qqplot (resid )
10231020 plt .title (name )
10241021 if save_to :
10251022 plt .savefig (save_to + '_resid.pdf' , bbox_inches = 'tight' )
@@ -1076,7 +1073,7 @@ def plot_phases(acrs, amps, tests, period=24, colors = ("black", "red", "green",
10761073 ax .set_theta_direction (- 1 )
10771074 lines = []
10781075
1079- for i , (acr , amp , test , color ) in enumerate (zip (acrs , amps , tests , colors )):
1076+ for i , (acr , amp , _ , color ) in enumerate (zip (acrs , amps , tests , colors )):
10801077
10811078 """
10821079 if "LDL" in test:
@@ -1336,7 +1333,7 @@ def compare_pairs(df, pairs, n_components = 3, period = 24, folder = "", prefix
13361333 save_to = ''
13371334
13381335 #pvalues, params, results = compare_pair_df_extended(df, test1, test2, n_components = n_comps, period = per, lin_comp = lin_comp, model_type = model_type, alpha=alpha, save_to = save_to, plot_measurements=plot_measurements)
1339- pvalues , params , results = compare_pair_df_extended (df , test1 , test2 , n_components = n_comps , period = per , save_to = save_to , ** kwargs )
1336+ pvalues , params , _ = compare_pair_df_extended (df , test1 , test2 , n_components = n_comps , period = per , save_to = save_to , ** kwargs )
13401337
13411338 d = {}
13421339 d ['test' ] = test1 + ' vs. ' + test2
@@ -1370,11 +1367,6 @@ def compare_pairs(df, pairs, n_components = 3, period = 24, folder = "", prefix
13701367
13711368 #return multi.multipletests(P, method = 'fdr_bh')[1]
13721369
1373-
1374-
1375-
1376-
1377-
13781370#def compare_pairs_best_models(df, df_best_models, pairs, lin_comp = False, model_type = 'lin', alpha = 0, folder = '', prefix = '', plot_measurements=True):
13791371def compare_pairs_best_models (df , df_best_models , pairs , folder = "" , prefix = "" , ** kwargs ):
13801372 df_results = pd .DataFrame ()
@@ -1402,7 +1394,7 @@ def compare_pairs_best_models(df, df_best_models, pairs, folder = "", prefix = "
14021394 save_to = ''
14031395
14041396 #pvalues, params, results = compare_pair_df_extended(df, test1, test2, n_components = n_components1, period = period1, n_components2 = n_components2, period2 = period2, lin_comp = lin_comp, model_type = model_type, alpha=alpha, save_to = save_to, plot_measurements=plot_measurements)
1405- pvalues , params , results = compare_pair_df_extended (df , test1 , test2 , n_components = n_components1 , period = period1 , n_components2 = n_components2 , period2 = period2 , ** kwargs )
1397+ pvalues , params , _ = compare_pair_df_extended (df , test1 , test2 , n_components = n_components1 , period = period1 , n_components2 = n_components2 , period2 = period2 , save_to = save_to , ** kwargs )
14061398
14071399 d = {}
14081400 d ['test' ] = test1 + ' vs. ' + test2
@@ -1633,9 +1625,9 @@ def compare_pair_df_extended(df, test1, test2, n_components = 3, period = 24, n_
16331625 plt .plot (X_full , Y_fit_full2 , 'r' , label = test2 )
16341626
16351627 if model_type == 'lin' and plot_margins :
1636- sdev , lower , upper = wls_prediction_std (results , exog = X_fit_full [locs ], alpha = 0.05 )
1628+ _ , lower , upper = wls_prediction_std (results , exog = X_fit_full [locs ], alpha = 0.05 )
16371629 plt .fill_between (X_full , lower , upper , color = 'black' , alpha = 0.1 )
1638- sdev , lower , upper = wls_prediction_std (results , exog = X_fit_full [~ locs ], alpha = 0.05 )
1630+ _ , lower , upper = wls_prediction_std (results , exog = X_fit_full [~ locs ], alpha = 0.05 )
16391631 plt .fill_between (X_full , lower , upper , color = 'red' , alpha = 0.1 )
16401632
16411633
@@ -1662,7 +1654,7 @@ def compare_pair_df_extended(df, test1, test2, n_components = 3, period = 24, n_
16621654 if plot_residuals :
16631655
16641656 resid = results .resid
1665- fig = sm .qqplot (resid )
1657+ sm .qqplot (resid )
16661658 plt .title (test1 + ' vs. ' + test2 )
16671659 save_to_resid = save_to .split ("." )[0 ] + '_resid' + save_to .split ("." )[1 ]
16681660 if save_to :
@@ -1852,7 +1844,7 @@ def compare_pair(X1, Y1, X2, Y2, test1 = '', test2 = '', n_components = 3, perio
18521844 if plot_residuals :
18531845
18541846 resid = results .resid
1855- fig = sm .qqplot (resid )
1847+ sm .qqplot (resid )
18561848 plt .title (test1 + ' vs. ' + test2 )
18571849 save_to_resid = save_to .split ("." )[0 ] + '_resid' + save_to .split ("." )[1 ]
18581850 if save_to :
@@ -2086,7 +2078,7 @@ def compare_pair_extended(X1, Y1, X2, Y2, test1 = '', test2 = '', n_components1
20862078 if plot_residuals :
20872079
20882080 resid = results .resid
2089- fig = sm .qqplot (resid )
2081+ sm .qqplot (resid )
20902082 plt .title (test1 + ' vs. ' + test2 )
20912083 save_to_resid = save_to .split ("." )[0 ] + '_resid' + save_to .split ("." )[1 ]
20922084 if save_to :
@@ -2519,8 +2511,8 @@ def compare_nonlinear(X1, Y1, X2, Y2, test1 = '', test2 = '', min_per = 18, max_
25192511 plt .plot (X1 , Y1 , 'ko' , markersize = 1 , label = test1 )
25202512 plt .plot (X2 , Y2 , 'ro' , markersize = 1 , label = test2 )
25212513
2522- Y_fit1 = Y_fit [H == 0 ]
2523- Y_fit2 = Y_fit [H == 1 ]
2514+ # Y_fit1 = Y_fit[H == 0]
2515+ # Y_fit2 = Y_fit[H == 1]
25242516
25252517 plt .plot (X_full , Y1_full , 'k' , label = 'fit ' + test1 )
25262518 plt .plot (X_full , Y2_full , 'r' , label = 'fit ' + test2 )
@@ -2542,7 +2534,7 @@ def compare_nonlinear(X1, Y1, X2, Y2, test1 = '', test2 = '', min_per = 18, max_
25422534 if plot_residuals :
25432535
25442536 resid = Y - Y_fit
2545- fig = sm .qqplot (resid )
2537+ sm .qqplot (resid )
25462538 plt .title (test1 + ' vs. ' + test2 )
25472539 save_to_resid = save_to + '_resid'
25482540 if save_to :
0 commit comments