Hi everyone!

I was wondering if it is a possible addition to numpy to have a function to
wrap values to an interval. Typically, it is desired to limit an angle to
[0, 2pi) or [-pi ,pi), either by letting it "overflow" or by "bouncing"
hence and forth.
The function which does this is actually really simple.
However, whenever I am facing this task I tend to work a while on this
until I get it correct.
I have a small and handy function (it is small because it just uses
np.divmod) at hand which does this, including also the left-open or closed
cases, and some tests.
In case this is of interest, I can contribute.

Best regards,
Thomas.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to