Skip to content

Commit

Permalink
add warning catch
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallowa07 committed Nov 6, 2024
1 parent 9bc578a commit bd75e60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phippery/zscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def compute_zscore(
null_means = means_df.loc[ibin].to_numpy()
null_stds = stds_df.loc[ibin].to_numpy()
# TODO This line throws warnings about invalid values, and divide by zero
# Compute zs, avoiding division by zero
# zs = np.where(null_stds != 0, (data - null_means) / null_stds, 0)
zs = (data - null_means) / null_stds
# Compute zs, avoiding division by zero? for now, catch annoying warning
with np.errstate(divide="ignore", invalid="ignore"):
zs = (data - null_means) / null_stds
zscore_df.loc[pid] = zs

# Convert Infs and NaNs to zero
Expand Down

0 comments on commit bd75e60

Please sign in to comment.