NumPy forms an essential basis for astropy, and astropy’s development has led to the identification of problems with some of numpy’s functionality. Often, these are corrected in later versions of numpy, but in order for astropy not to depend on these, work-arounds are made, usually in the code. If functions are used in more than one place, however, it can be more convenient to provide patched routines. Hence, astropy.utils.compat.numpy.
To ensure that patched code is only used when required, and that it will be easy to remove it if it is no longer needed for any supported version of NumPy, the following procedure should be used to add a patched routine:
For an example, see numpy/lib/stride_tricks.py and the corresponding numpy/tests/test_broadcast_arrays.py.
Note that patched routines will normally only be considered if they are part of NumPy. Thus, if the patch concerns a new bug discovered in numpy, a pull request should first be made to NumPy (which can of course form the basis of a pull request to astropy).
NumPy functions and classes needed for astropy but not available in all supported NumPy versions. See docs/utils/numpy.rst for details.
broadcast_arrays(*args, **kwargs) | Broadcast any number of arrays against each other. |