Skip to content

Commit 28d8fd8

Browse files
committed
Fixed regressions / numpy.matrix deprecation mgt
1 parent a99fa85 commit 28d8fd8

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

plotpy/items/image/transform.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ def get_pixel_coordinates(self, xplot: float, yplot: float) -> tuple[float, floa
153153
Returns:
154154
Pixel coordinates
155155
"""
156-
v = self.tr @ colvector(xplot, yplot)
157-
xpixel, ypixel, _ = v[:, 0]
156+
xpixel, ypixel, _ = self.tr @ colvector(xplot, yplot)
158157
return xpixel, ypixel
159158

160159
def get_plot_coordinates(self, xpixel: float, ypixel: float) -> tuple[float, float]:
@@ -167,8 +166,7 @@ def get_plot_coordinates(self, xpixel: float, ypixel: float) -> tuple[float, flo
167166
Returns:
168167
Plot coordinates
169168
"""
170-
v0 = self.itr @ colvector(xpixel, ypixel)
171-
xplot, yplot, _ = v0[:, 0].ravel()
169+
xplot, yplot, _ = self.itr @ colvector(xpixel, ypixel)
172170
return xplot, yplot
173171

174172
def get_x_values(self, i0: int, i1: int) -> np.ndarray:
@@ -181,10 +179,8 @@ def get_x_values(self, i0: int, i1: int) -> np.ndarray:
181179
Returns:
182180
X values corresponding to the given pixel indexes
183181
"""
184-
v0 = self.itr @ colvector(i0, 0)
185-
x0, _y0, _ = v0[:, 0].ravel()
186-
v1 = self.itr @ colvector(i1, 0)
187-
x1, _y1, _ = v1[:, 0].ravel()
182+
x0, _y0, _ = self.itr @ colvector(i0, 0)
183+
x1, _y1, _ = self.itr @ colvector(i1, 0)
188184
return np.linspace(x0, x1, i1 - i0)
189185

190186
def get_y_values(self, j0: int, j1: int) -> np.ndarray:
@@ -197,10 +193,8 @@ def get_y_values(self, j0: int, j1: int) -> np.ndarray:
197193
Returns:
198194
Y values corresponding to the given pixel indexes
199195
"""
200-
v0 = self.itr @ colvector(0, j0)
201-
_x0, y0, _ = v0[:, 0].ravel()
202-
v1 = self.itr @ colvector(0, j1)
203-
_x1, y1, _ = v1[:, 0].ravel()
196+
_x0, y0, _ = self.itr @ colvector(0, j0)
197+
_x1, y1, _ = self.itr @ colvector(0, j1)
204198
return np.linspace(y0, y1, j1 - j0)
205199

206200
def get_r_values(self, i0, i1, j0, j1, flag_circle=False):
@@ -216,10 +210,8 @@ def get_r_values(self, i0, i1, j0, j1, flag_circle=False):
216210
Returns:
217211
Radial values corresponding to the given pixel indexes
218212
"""
219-
v0 = self.itr @ colvector(i0, j0)
220-
x0, y0, _ = v0[:, 0].ravel()
221-
v1 = self.itr @ colvector(i1, j1)
222-
x1, y1, _ = v1[:, 0].ravel()
213+
x0, y0, _ = self.itr @ colvector(i0, j0)
214+
x1, y1, _ = self.itr @ colvector(i1, j1)
223215
if flag_circle:
224216
r = abs(y1 - y0)
225217
else:
@@ -238,8 +230,7 @@ def get_closest_coordinates(self, x: float, y: float) -> tuple[float, float]:
238230
tuple[float, float]: Closest coordinates
239231
"""
240232
xi, yi = self.get_closest_indexes(x, y)
241-
v = self.itr @ colvector(xi, yi)
242-
x, y, _ = v[:, 0].ravel()
233+
x, y, _ = self.itr @ colvector(xi, yi)
243234
return x, y
244235

245236
def update_border(self) -> None:

0 commit comments

Comments
 (0)