Skip to content

Commit

Permalink
Minimizing the warnigns on create recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
tainagdcoleman committed Sep 10, 2024
1 parent 97df6fe commit 9d47f0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wfcommons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

import warnings
warnings.filterwarnings('ignore')

import json
import logging
import math
import pathlib
import scipy.stats
import warnings
import numpy as np
import operator as op

Expand Down Expand Up @@ -82,8 +84,6 @@ def best_fit_distribution(data: List[float], logger: Optional[Logger] = None) ->
for dist_name in distribution_names:
# Ignore warnings from data that can't be fit
with warnings.catch_warnings():
warnings.filterwarnings('ignore')

try:
distribution = getattr(scipy.stats, dist_name)
params = distribution.fit(y)
Expand All @@ -98,7 +98,7 @@ def best_fit_distribution(data: List[float], logger: Optional[Logger] = None) ->
best_params = params
best_sse = sse
except Exception as e:
print(f"WARNING: distribution \"{dist_name}\" failed ({e})")
logger.warning(f"WARNING: distribution \"{dist_name}\" failed ({e})")

logger.debug(f'Best distribution fit: {best_distribution}')
return best_distribution, best_params
Expand Down

0 comments on commit 9d47f0a

Please sign in to comment.