From 57702ac398e61f58a86f4cfd2965ed48a7f9ab95 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 17 Jun 2024 20:48:38 -0400 Subject: [PATCH 1/4] ndarray.ptp -> np.ptp for numpy v2 --- fastplotlib/widgets/histogram_lut.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastplotlib/widgets/histogram_lut.py b/fastplotlib/widgets/histogram_lut.py index a3edffcbd..02c21aa38 100644 --- a/fastplotlib/widgets/histogram_lut.py +++ b/fastplotlib/widgets/histogram_lut.py @@ -163,7 +163,7 @@ def _calculate_histogram(self, data): # used if data ptp <= 10 because event things get weird # with tiny world objects due to floating point error # so if ptp <= 10, scale up by a factor - self._scale_factor: int = max(1, 100 * int(10 / data_ss.ptp())) + self._scale_factor: int = max(1, 100 * int(10 / np.ptp(data_ss))) edges = edges * self._scale_factor From 374667e5fdb68ccccddb24e1c4ce8e59a2db6ad1 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 17 Jun 2024 21:06:15 -0400 Subject: [PATCH 2/4] update docs with wgpu changes --- docs/source/user_guide/gpu.rst | 6 ++++-- examples/tests/testutils.py | 2 +- fastplotlib/utils/gui.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/source/user_guide/gpu.rst b/docs/source/user_guide/gpu.rst index 3f4ff4bb4..f4ef89a0c 100644 --- a/docs/source/user_guide/gpu.rst +++ b/docs/source/user_guide/gpu.rst @@ -59,7 +59,7 @@ You can get more detailed info on each adapter like this:: import pprint for a in fpl.enumerate_adapters(): - pprint.pprint(a.request_adapter_info()) + pprint.pprint(a.info) General description of the fields: * vendor: GPU manufacturer @@ -265,7 +265,9 @@ You can select an adapter by passing one of the ``wgpu.GPUAdapter`` instances re to ``fpl.select_adapter()``:: # get info or summary of all adapters to pick an adapter - print([a.request_adapter_info() for a in fpl.enumerate_adapters()]) + import pprint + for a in fpl.enumerate_adapters(): + pprint.pprint(a.info) # example, pick adapter at index 2 chosen_gpu = fpl.enumerate_adapters()[2] diff --git a/examples/tests/testutils.py b/examples/tests/testutils.py index f62ae7602..1a95e249f 100644 --- a/examples/tests/testutils.py +++ b/examples/tests/testutils.py @@ -30,7 +30,7 @@ def get_wgpu_backend(): """ Query the configured wgpu backend driver. """ - code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.request_adapter_info(); print(info['adapter_type'], info['backend_type'])" + code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.info; print(info['adapter_type'], info['backend_type'])" result = subprocess.run( [ sys.executable, diff --git a/fastplotlib/utils/gui.py b/fastplotlib/utils/gui.py index 1941674ee..1f13c1406 100644 --- a/fastplotlib/utils/gui.py +++ b/fastplotlib/utils/gui.py @@ -60,9 +60,9 @@ def _notebook_print_banner(): # print logo and adapter info adapters = [a for a in wgpu.gpu.enumerate_adapters()] - adapters_info = [a.request_adapter_info() for a in adapters] + adapters_info = [a.info for a in adapters] - default_adapter_info = wgpu.gpu.request_adapter().request_adapter_info() + default_adapter_info = wgpu.gpu.request_adapter().info default_ix = adapters_info.index(default_adapter_info) if len(adapters) > 0: From 4bf3a661ae845521e1d215c628f5344d0d099bee Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 17 Jun 2024 21:22:12 -0400 Subject: [PATCH 3/4] fix more ptp --- .../notebooks/linear_region_selector.ipynb | 40 ------------------- setup.py | 2 +- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/examples/notebooks/linear_region_selector.ipynb b/examples/notebooks/linear_region_selector.ipynb index 57a72bdec..74b304a35 100644 --- a/examples/notebooks/linear_region_selector.ipynb +++ b/examples/notebooks/linear_region_selector.ipynb @@ -93,46 +93,6 @@ "fig.show(maintain_aspect=False)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "2f29e913-c4f8-44a6-8692-eb14436849a5", - "metadata": {}, - "outputs": [], - "source": [ - "sine_graphic_x.data[:, 1].ptp()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1947a477-5dd2-4df9-aecd-6967c6ab45fe", - "metadata": {}, - "outputs": [], - "source": [ - "np.clip(-0.1, 0, 10)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "18e10277-6d5d-42fe-8715-1733efabefa0", - "metadata": {}, - "outputs": [], - "source": [ - "ls_y.selection" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8e9c42b9-60d2-4544-96c5-c8c6832b79e3", - "metadata": {}, - "outputs": [], - "source": [ - "ls_y.get_selected_indices()" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/setup.py b/setup.py index 3ba77201d..d75edf956 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ install_requires = [ "numpy>=1.23.0", - "wgpu>=0.15.1", + "wgpu>=0.16.0", "pygfx>=0.1.14", ] From 3a5adfe0608adbe74ebe8c8e23bf50a93a91f10e Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 17 Jun 2024 21:24:14 -0400 Subject: [PATCH 4/4] fix more ptp --- fastplotlib/graphics/line_collection.py | 4 ++-- fastplotlib/legends/legend.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fastplotlib/graphics/line_collection.py b/fastplotlib/graphics/line_collection.py index 92aad56b2..4a55c1fb3 100644 --- a/fastplotlib/graphics/line_collection.py +++ b/fastplotlib/graphics/line_collection.py @@ -460,7 +460,7 @@ def _get_linear_selector_init_args(self, axis, padding): bounds = (xmin, value_25p) limits = (xmin, xmax) # size from orthogonal axis - size = bbox[:, 1].ptp() * 1.5 + size = np.ptp(bbox[:, 1]) * 1.5 # center on orthogonal axis center = bbox[:, 1].mean() @@ -472,7 +472,7 @@ def _get_linear_selector_init_args(self, axis, padding): bounds = (xmin, value_25p) limits = (xmin, xmax) - size = bbox[:, 0].ptp() * 1.5 + size = np.ptp(bbox[:, 0]) * 1.5 # center on orthogonal axis center = bbox[:, 0].mean() diff --git a/fastplotlib/legends/legend.py b/fastplotlib/legends/legend.py index b7e55f321..8ab3ddedb 100644 --- a/fastplotlib/legends/legend.py +++ b/fastplotlib/legends/legend.py @@ -244,7 +244,7 @@ def add_graphic(self, graphic: Graphic, label: str = None): # get width of widest LegendItem in previous column to add to x_pos offset for this column for item in prev_column_items: bbox = item.world_object.get_world_bounding_box() - width, height, depth = bbox.ptp(axis=0) + width, height, depth = np.ptp(bbox, axis=0) max_width = max(max_width, width) # x position offset for this new column @@ -278,7 +278,7 @@ def add_graphic(self, graphic: Graphic, label: str = None): def _reset_mesh_dims(self): bbox = self._legend_items_group.get_world_bounding_box() - width, height, _ = bbox.ptp(axis=0) + width, height, _ = np.ptp(bbox, axis=0) self._mesh.geometry.positions.data[mesh_masks.x_right] = width + 7 self._mesh.geometry.positions.data[mesh_masks.x_left] = -5 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy