Skip to content

Commit

Permalink
Fix wawrnings capture in IC50 calc
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Jan 24, 2019
1 parent a3020b4 commit 96a0c96
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions thunor/curve_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,13 @@ def ic(self, ic_num=50):

ic_frac = ic_num / 100.0

with warnings.filterwarnings(
'ignore',
'overflow encountered in double_scalars',
category=RuntimeWarning):
icN = self.ec50 * (ic_frac / (1 - ic_frac - (emax / e0))) ** (
1 / self.hill_slope)
warnings.filterwarnings(
'once',
'overflow encountered in double_scalars',
category=RuntimeWarning
)
icN = self.ec50 * (ic_frac / (1 - ic_frac - (emax / e0))) ** (
1 / self.hill_slope)

# Filtered overflow will lead to -inf, which we deal with here
if np.isnan(icN) or np.isinf(icN):
Expand Down

0 comments on commit 96a0c96

Please sign in to comment.