@@ -722,18 +722,16 @@ def point_from_cartesian(
722722 return self ._coords_symmetric (points_sph )
723723
724724 def _vector_to_cartesian (
725- self , points : ArrayLike , components : ArrayLike , * , coords : CoordsType = "grid"
725+ self , points : ArrayLike , components : ArrayLike
726726 ) -> np .ndarray :
727727 """convert the vectors at given points into a Cartesian basis
728728
729729 Args:
730730 points (:class:`~numpy.ndarray`):
731- The coordinates of the point(s) where the vectors are specified.
731+ The coordinates of the point(s) where the vectors are specified. These
732+ need to be given in grid coordinates.
732733 components (:class:`~numpy.ndarray`):
733734 The components of the vectors at the given points
734- coords (str):
735- The coordinate system in which the point is specified. Valid values are
736- `cartesian`, `cell`, and `grid`; see :meth:`~pde.grids.base.GridBase.transform`.
737735
738736 Returns:
739737 The vectors specified at the same position but with components given in
@@ -1118,12 +1116,13 @@ def get_vector_data(self, data: np.ndarray, **kwargs) -> dict[str, Any]:
11181116 img_coord0 = self .get_image_data (data [0 ], ** kwargs )
11191117 img_coord1 = self .get_image_data (data [1 ], ** kwargs )
11201118
1119+ points_cart = np .stack ((img_coord0 ["xs" ], img_coord0 ["ys" ]), axis = - 1 )
1120+ points = self .c ._pos_from_cart (points_cart )
1121+
11211122 # convert vectors to cartesian coordinates
11221123 img_data = img_coord0
11231124 img_data ["data_x" ], img_data ["data_y" ] = self ._vector_to_cartesian (
1124- np .stack ((img_coord0 ["xs" ], img_coord0 ["ys" ]), axis = - 1 ),
1125- [img_coord0 ["data" ], img_coord1 ["data" ]],
1126- coords = "cartesian" ,
1125+ points , [img_coord0 ["data" ], img_coord1 ["data" ]]
11271126 )
11281127 img_data .pop ("data" )
11291128 return img_data
0 commit comments