File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88# the Free Software Foundation, either version 3 of the License, or
99# (at your option) any later version.
1010
11+ import warnings
12+ warnings .filterwarnings ('ignore' )
13+
1114import json
1215import logging
1316import math
1417import pathlib
1518import scipy .stats
16- import warnings
1719import numpy as np
1820import operator as op
1921
@@ -82,8 +84,6 @@ def best_fit_distribution(data: List[float], logger: Optional[Logger] = None) ->
8284 for dist_name in distribution_names :
8385 # Ignore warnings from data that can't be fit
8486 with warnings .catch_warnings ():
85- warnings .filterwarnings ('ignore' )
86-
8787 try :
8888 distribution = getattr (scipy .stats , dist_name )
8989 params = distribution .fit (y )
@@ -98,7 +98,7 @@ def best_fit_distribution(data: List[float], logger: Optional[Logger] = None) ->
9898 best_params = params
9999 best_sse = sse
100100 except Exception as e :
101- print (f"WARNING: distribution \" { dist_name } \" failed ({ e } )" )
101+ logger . warning (f"WARNING: distribution \" { dist_name } \" failed ({ e } )" )
102102
103103 logger .debug (f'Best distribution fit: { best_distribution } ' )
104104 return best_distribution , best_params
You can’t perform that action at this time.
0 commit comments