Address warnings due to truth testing and overflows
We are getting warnings due to:
-
Naked if
statements -
Deprecation of numpy
class properties (inligo.skymap
) -
Overflow in division when handling sky maps (in ligo.skymap
)
See the following warnings during testing:
=============================== warnings summary ===============================
../../../usr/local/lib/python3.11/site-packages/ligo/skymap/util/numpy.py:45: 12 warnings
/usr/local/lib/python3.11/site-packages/ligo/skymap/util/numpy.py:45: DeprecationWarning: _add_newdoc_ufunc is deprecated. Use `ufunc.__doc__ = newdoc` instead.
_add_newdoc_ufunc(func, doc)
ligo/followup_advocate/test/test_circular_text.py: 10 warnings
ligo/followup_advocate/test/test_tool.py: 11 warnings
/builds/brandon.piotrzkowski/ligo-followup-advocate/ligo/followup_advocate/__init__.py:125: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
search_for_cgmi_file = em_brights and not update_alert and \
ligo/followup_advocate/test/test_circular_text.py: 10 warnings
ligo/followup_advocate/test/test_tool.py: 11 warnings
/builds/brandon.piotrzkowski/ligo-followup-advocate/ligo/followup_advocate/__init__.py:129: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if p_astros or search_for_cgmi_file:
ligo/followup_advocate/test/test_circular_text.py: 10 warnings
ligo/followup_advocate/test/test_tool.py: 11 warnings
/builds/brandon.piotrzkowski/ligo-followup-advocate/ligo/followup_advocate/__init__.py:132: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if p_astros:
ligo/followup_advocate/test/test_circular_text.py: 10 warnings
ligo/followup_advocate/test/test_tool.py: 11 warnings
/builds/brandon.piotrzkowski/ligo-followup-advocate/ligo/followup_advocate/__init__.py:150: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if em_brights:
ligo/followup_advocate/test/test_circular_text.py::test_skymap_update
ligo/followup_advocate/test/test_circular_text.py::test_raven_update
ligo/followup_advocate/test/test_circular_text.py::test_general_update
ligo/followup_advocate/test/test_circular_text.py::test_classification_update
ligo/followup_advocate/test/test_tool.py::test_skymap_update
ligo/followup_advocate/test/test_tool.py::test_raven_update
ligo/followup_advocate/test/test_tool.py::test_general_update
ligo/followup_advocate/test/test_tool.py::test_classification_update
ligo/followup_advocate/test/test_tool.py::test_raven_without_initial_circular
/usr/local/lib/python3.11/site-packages/ligo/skymap/extern/numpy/quantile.py:253: RuntimeWarning: overflow encountered in divide
ws_sorted[nonzero_w_inds] / ws_sorted[nonzero_w_inds].min()
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
Edited by Brandon Piotrzkowski