Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warnings library must be imported directly #66

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pyreduce/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import logging
import os
import warnings
from itertools import product

import matplotlib.pyplot as plt
Expand Down Expand Up @@ -317,8 +318,8 @@ def gaussfit2(x, y):

i = np.argmax(y * weights)
p0 = [y[i], x[i], 1]
with np.warnings.catch_warnings():
np.warnings.simplefilter("ignore")
with warnings.catch_warnings():
warnings.simplefilter("ignore")
res = least_squares(
lambda c: gauss(x, *c, np.ma.min(y)) - y,
p0,
Expand Down Expand Up @@ -355,8 +356,8 @@ def gaussfit3(x, y):
i = np.argmax(y[len(y) // 4 : len(y) * 3 // 4]) + len(y) // 4
p0 = [y[i], x[i], 1, np.min(y)]

with np.warnings.catch_warnings():
np.warnings.simplefilter("ignore")
with warnings.catch_warnings():
warnings.simplefilter("ignore")
popt, _ = curve_fit(gauss, x, y, p0=p0)

return popt
Expand Down Expand Up @@ -386,8 +387,8 @@ def gaussfit4(x, y):
i = np.argmax(y)
p0 = [y[i], x[i], 1, np.min(y)]

with np.warnings.catch_warnings():
np.warnings.simplefilter("ignore")
with warnings.catch_warnings():
warnings.simplefilter("ignore")
popt, _ = curve_fit(gauss, x, y, p0=p0)

return popt
Expand Down
Loading