-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
it would be worth considering a systematic treatment of floating-point related warnings - division by zero and invalid operation pollute output too much - esp whenever obs/exp is involved - classification of float-point errors https://docs.oracle.com/cd/E19957-01/806-3568/ncg_handle.html
- consider using (on a per module basis ... or in
__init__
or wherever)
# set new err-stated, to hide division by zero warnings
_err_state = np.seterr(divide="ignore", over="raise", under="warn", invalid="ignore")
- or use a conext manager https://numpy.org/devdocs/reference/generated/numpy.errstate.html for every obs/exp (and other relevant operations) - not sure if there is a big performance penalty associated with it ...
with np.errstate(divide="ignore", invalid="ignore"):
snippet / e
- or use
np.divide
https://numpy.org/doc/stable/reference/generated/numpy.divide.html with thewhere
filter engaged - to pre-emptively fill thoseanything/0.0
withnp.nan
Metadata
Metadata
Assignees
Labels
No labels