On Tue, Aug 31, 2021 at 12:07 PM Yash Tewatia <yashb...@gmail.com> wrote:
> Hi, it is my first contribution to the open-source community, I have tried > to fix issue #19315, which is to add a new feature of rotating mesh grid in > NumPy. It would be great if I get improvements and suggestions for it. > Hi Yash, welcome! That issue is a feature request that did not get a response yet. It seems to me like we should reject it, because rotating a grid is a fairly easy thing to do, as the Stack Overflow discussion linked from https://github.com/numpy/numpy/issues/19315 shows. Cheers, Ralf > Added functionality of rotating mesh grid which fixes #19315 issue, adds a > feature which works as follows > Parameters > ----------- > xspan : Input_array > range of values of x in the unrotated matrix. > yspan : Input_array > range of values of y in the unrotated matrix. > angle : float or int > Angle of rotation, positive for clockwise rotation, negative for > anti-clockwise rotation. > boolRad : bool > True if the given angle is in Radians, False if given angle is > in Degrees. > Returns > -------- > out : ndarray > A new nested array is generated by Einstein Summation after > rotation is applied. > > Examples > ---------- > >>> xspan = np.linspace(-2*np.pi, 2*np.pi, 3) > >>> yspan = np.linspace(-2*np.pi, 2*np.pi, 3) > >>> arr = np.rotateMeshgrid(xspan,yspan,0.4) > >>> arr > array([[[-6.32689674, -0.04386455, 6.23916764], > [-6.28303219, 0. , 6.28303219], > [-6.23916764, 0.04386455, 6.32689674]], > > [[-6.23916764, -6.28303219, -6.32689674], > [ 0.04386455, 0. , -0.04386455], > [ 6.32689674, 6.28303219, 6.23916764]]]) > > >>> arr = np.rotateMeshgrid(xspan,yspan,80,False) > >>> arr > array([[[ 6.9383701 , 6.24478659, 5.55120308], > [ 0.69358351, 0. , -0.69358351], > [-5.55120308, -6.24478659, -6.9383701 ]], > > [[-5.55120308, 0.69358351, 6.9383701 ], > [-6.24478659, 0. , 6.24478659], > [-6.9383701 , -0.69358351, 5.55120308]]]) > > Code snippet: > ( > https://user-images.githubusercontent.com/60055574/131483810-05012ab1-8971-4a94-8b1c-8f11d13b7c02.png > ) > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion