Hi, it is my first contribution to the opensource 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. 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 anticlockwise 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://userimages.githubusercontent.com/60055574/13148381005012ab189714... )
On Tue, Aug 31, 2021 at 12:07 PM Yash Tewatia <yashbsr3@gmail.com> wrote:
Hi, it is my first contribution to the opensource 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 anticlockwise 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://userimages.githubusercontent.com/60055574/13148381005012ab189714... ) _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@python.org https://mail.python.org/mailman/listinfo/numpydiscussion
participants (2)

Ralf Gommers

Yash Tewatia