Numpy Utilities (ligo.skymap.util.numpy)

ligo.skymap.util.numpy.add_newdoc_ufunc(func, doc)[source] [edit on github]

Set the docstring for a Numpy ufunc.

The function numpy.core.umath._add_newdoc_ufunc() can only change a ufunc’s docstring if it is NULL. This workaround avoids an exception when the user tries to reload() this module.

Notes

numpy.core.umath._add_newdoc_ufunc() is not part of Numpy’s public API, but according to upstream developers it is unlikely to go away any time soon.

See https://github.com/numpy/numpy/issues/26233.

ligo.skymap.util.numpy.require_contiguous_aligned(func)[source] [edit on github]

Wrap a Numpy ufunc to guarantee that all of its inputs are C-contiguous arrays.