Skip to content

Commit 203e1c0

Browse files
committed
replace print statements with logging msgs for distribution funcs
1 parent 74f592f commit 203e1c0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pyhctsa/operations/distribution.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ def compare_ks_fit(x: ArrayLike, what_distn: str) -> dict:
7373
elif what_distn == 'exp':
7474
# Check positivity
7575
if np.any(x < 0):
76-
print("The data contains negative values, but Exponential is a positive-only distribution.")
76+
logging.warning("The data contains negative values, but Exponential is a positive-only distribution.")
7777
return np.nan
7878
# Check constant
7979
if np.all(x == x[0]):
80-
print("Data are a constant")
80+
logging.warning("Data are a constant.")
8181
return np.nan
8282
# Fit Exponential distribution (equivalent to expfit in MATLAB)
8383
_, lam = expon.fit(x, floc=0) # force support at 0
@@ -91,7 +91,7 @@ def compare_ks_fit(x: ArrayLike, what_distn: str) -> dict:
9191
elif what_distn == 'logn':
9292
# Check positivity
9393
if np.any(x <= 0):
94-
print("The data are not positive, but Log-Normal is a positive-only distribution.")
94+
logging.warning("The data are not positive, but Log-Normal is a positive-only distribution.")
9595
return np.nan
9696
# Fit log-normal distribution
9797
shape, loc, scale = lognorm.fit(x, floc=0) # sigma, 0, exp(mu)
@@ -107,7 +107,7 @@ def compare_ks_fit(x: ArrayLike, what_distn: str) -> dict:
107107
ffit_func = lambda xi: lognorm.pdf(xi, s=sigma, loc=0, scale=np.exp(mu))
108108

109109
else:
110-
raise ValueError(f"Unknown distribution: {what_distn}.")
110+
raise ValueError(f"Unknown distribution: {what_distn}.")
111111

112112
# ----------------------------
113113
# Estimate smoothed empirical distribution

0 commit comments

Comments
 (0)