Skip to content

Commit

Permalink
Python 3.11 support #227. Warning hunt.
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinecarme committed Mar 8, 2023
1 parent 0cb441d commit 9c705fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyaf/TS/Perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def compute_LnQ(self, signal , estimator):

def compute_KS_Kendall_MWU_AUC(self, signal , estimator):
from scipy.stats import mannwhitneyu, kendalltau, kstest
lKSTest = kstest(signal, estimator)
lKSTest = kstest(signal, estimator, method='asymp')
self.mKS = lKSTest.statistic
self.mKS = round( self.mKS , 4 )
lKendallTau_Result = kendalltau(signal, estimator)
Expand Down
11 changes: 9 additions & 2 deletions pyaf/TS/Plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ def quantiles_plot_internal(df, time, signal, estimator, iQuantiles, name = None
if(name is not None):
plt.switch_backend('Agg')
lMin, lMax = df1[lQuantileNames].values.min(), df1[lQuantileNames].values.max()

# Avoid a warning from matplotlib.
lEps = 0.01
if((lMax - lMin) < lEps):
lMin, lMax = lMin - lEps, lMax + lEps

# Forecast Quantiles Plots can be improved #225
# Use a more meaningful color map (gradient, Blue = Low, Green = Normal, Red = High) for synchronized histograms.
# Blue/Red for lower/higher quartile, decreasing alpha towards ther median.
Expand All @@ -192,7 +196,10 @@ def quantiles_plot_internal(df, time, signal, estimator, iQuantiles, name = None
lIdx = df1.index[h]
lTime = df1.loc[lIdx, time]
q_values = df1.loc[lIdx, lQuantileNames].tolist()
_, bins1, patches = axs[h].hist(q_values, bins = q_values, weights=[1]*len(lQuantileNames), density = True)
if((max(q_values) - min(q_values)) < lEps):
# Avoid a warning from matplotlib for a constant signal.
q_values = [min(q_values) - lEps] + [max(q_values) + lEps]
_, bins1, patches = axs[h].hist(q_values, bins = q_values, weights=[1]*len(q_values), density = True)
for i, p in enumerate(patches):
j = (bins1[i] - lMin) / (lMax - lMin)
plt.setp(p, 'facecolor', cm(j))
Expand Down

0 comments on commit 9c705fb

Please sign in to comment.