Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02a8515

Browse files
authored
numpy v2 and wgpu v0.16.0 (#524)
1 parent 815e8b3 commit 02a8515

File tree

8 files changed

+13
-51
lines changed

8 files changed

+13
-51
lines changed

docs/source/user_guide/gpu.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You can get more detailed info on each adapter like this::
5959

6060
import pprint
6161
for a in fpl.enumerate_adapters():
62-
pprint.pprint(a.request_adapter_info())
62+
pprint.pprint(a.info)
6363

6464
General description of the fields:
6565
* vendor: GPU manufacturer
@@ -265,7 +265,9 @@ You can select an adapter by passing one of the ``wgpu.GPUAdapter`` instances re
265265
to ``fpl.select_adapter()``::
266266

267267
# get info or summary of all adapters to pick an adapter
268-
print([a.request_adapter_info() for a in fpl.enumerate_adapters()])
268+
import pprint
269+
for a in fpl.enumerate_adapters():
270+
pprint.pprint(a.info)
269271

270272
# example, pick adapter at index 2
271273
chosen_gpu = fpl.enumerate_adapters()[2]

examples/notebooks/linear_region_selector.ipynb

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -93,46 +93,6 @@
9393
"fig.show(maintain_aspect=False)"
9494
]
9595
},
96-
{
97-
"cell_type": "code",
98-
"execution_count": null,
99-
"id": "2f29e913-c4f8-44a6-8692-eb14436849a5",
100-
"metadata": {},
101-
"outputs": [],
102-
"source": [
103-
"sine_graphic_x.data[:, 1].ptp()"
104-
]
105-
},
106-
{
107-
"cell_type": "code",
108-
"execution_count": null,
109-
"id": "1947a477-5dd2-4df9-aecd-6967c6ab45fe",
110-
"metadata": {},
111-
"outputs": [],
112-
"source": [
113-
"np.clip(-0.1, 0, 10)"
114-
]
115-
},
116-
{
117-
"cell_type": "code",
118-
"execution_count": null,
119-
"id": "18e10277-6d5d-42fe-8715-1733efabefa0",
120-
"metadata": {},
121-
"outputs": [],
122-
"source": [
123-
"ls_y.selection"
124-
]
125-
},
126-
{
127-
"cell_type": "code",
128-
"execution_count": null,
129-
"id": "8e9c42b9-60d2-4544-96c5-c8c6832b79e3",
130-
"metadata": {},
131-
"outputs": [],
132-
"source": [
133-
"ls_y.get_selected_indices()"
134-
]
135-
},
13696
{
13797
"cell_type": "code",
13898
"execution_count": null,

examples/tests/testutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_wgpu_backend():
3030
"""
3131
Query the configured wgpu backend driver.
3232
"""
33-
code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.request_adapter_info(); print(info['adapter_type'], info['backend_type'])"
33+
code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.info; print(info['adapter_type'], info['backend_type'])"
3434
result = subprocess.run(
3535
[
3636
sys.executable,

fastplotlib/graphics/line_collection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def _get_linear_selector_init_args(self, axis, padding):
460460
bounds = (xmin, value_25p)
461461
limits = (xmin, xmax)
462462
# size from orthogonal axis
463-
size = bbox[:, 1].ptp() * 1.5
463+
size = np.ptp(bbox[:, 1]) * 1.5
464464
# center on orthogonal axis
465465
center = bbox[:, 1].mean()
466466

@@ -472,7 +472,7 @@ def _get_linear_selector_init_args(self, axis, padding):
472472
bounds = (xmin, value_25p)
473473
limits = (xmin, xmax)
474474

475-
size = bbox[:, 0].ptp() * 1.5
475+
size = np.ptp(bbox[:, 0]) * 1.5
476476
# center on orthogonal axis
477477
center = bbox[:, 0].mean()
478478

fastplotlib/legends/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def add_graphic(self, graphic: Graphic, label: str = None):
244244
# get width of widest LegendItem in previous column to add to x_pos offset for this column
245245
for item in prev_column_items:
246246
bbox = item.world_object.get_world_bounding_box()
247-
width, height, depth = bbox.ptp(axis=0)
247+
width, height, depth = np.ptp(bbox, axis=0)
248248
max_width = max(max_width, width)
249249

250250
# x position offset for this new column
@@ -278,7 +278,7 @@ def add_graphic(self, graphic: Graphic, label: str = None):
278278
def _reset_mesh_dims(self):
279279
bbox = self._legend_items_group.get_world_bounding_box()
280280

281-
width, height, _ = bbox.ptp(axis=0)
281+
width, height, _ = np.ptp(bbox, axis=0)
282282

283283
self._mesh.geometry.positions.data[mesh_masks.x_right] = width + 7
284284
self._mesh.geometry.positions.data[mesh_masks.x_left] = -5

fastplotlib/utils/gui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def _notebook_print_banner():
6060

6161
# print logo and adapter info
6262
adapters = [a for a in wgpu.gpu.enumerate_adapters()]
63-
adapters_info = [a.request_adapter_info() for a in adapters]
63+
adapters_info = [a.info for a in adapters]
6464

65-
default_adapter_info = wgpu.gpu.request_adapter().request_adapter_info()
65+
default_adapter_info = wgpu.gpu.request_adapter().info
6666
default_ix = adapters_info.index(default_adapter_info)
6767

6868
if len(adapters) > 0:

fastplotlib/widgets/histogram_lut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _calculate_histogram(self, data):
163163
# used if data ptp <= 10 because event things get weird
164164
# with tiny world objects due to floating point error
165165
# so if ptp <= 10, scale up by a factor
166-
self._scale_factor: int = max(1, 100 * int(10 / data_ss.ptp()))
166+
self._scale_factor: int = max(1, 100 * int(10 / np.ptp(data_ss)))
167167

168168
edges = edges * self._scale_factor
169169

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
install_requires = [
66
"numpy>=1.23.0",
7-
"wgpu>=0.15.1",
7+
"wgpu>=0.16.0",
88
"pygfx>=0.1.14",
99
]
1010

0 commit comments

Comments
 (0)