From 5c12b366acd49e7df5d9c17475d07c04d3d49fe4 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Tue, 24 Dec 2024 23:35:32 -0500 Subject: [PATCH 01/15] use imageio[ffmpeg] instead of pyav (#686) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f4b5eb5db..a7533d47d 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ "tests-desktop": [ "pytest<8.0.0", "scipy", - "imageio[pyav]", + "imageio[ffmpeg]", "scikit-learn", "tqdm", "imgui-bundle", From 0937309ef124766fe01d170c34643b3029292516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Fache?= Date: Wed, 25 Dec 2024 05:37:42 +0100 Subject: [PATCH 02/15] fix typo in the requested limit name of the wgpu device (#679) * fix typo in the requested limit name of the wgpu device. * fix test config. * fix examples/test and docs * fix max-texture-dimension-2d limit name and replace underscore by hyphen for the other limits. * fix missing dependency (libxrandr) to compile GLFW during building wheel for imgui-bundle. * update CI timeout * update timeout in non-nb test job --------- Co-authored-by: Kushal Kolar --- .github/workflows/ci.yml | 8 +-- docs/source/conf.py | 2 +- docs/source/user_guide/gpu.rst | 64 ++++++++++++------------ examples/tests/test_examples.py | 2 +- fastplotlib/graphics/_features/_image.py | 2 +- tests/conftest.py | 2 +- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06272f0f4..1fe4a128b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: test-build-full: name: Test Linux, notebook + offscreen runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 30 if: ${{ !github.event.pull_request.draft }} strategy: fail-fast: false @@ -40,7 +40,7 @@ jobs: - name: Install llvmpipe and lavapipe for offscreen canvas run: | sudo apt-get update -y -qq - sudo apt-get install --no-install-recommends -y ffmpeg libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers + sudo apt-get install --no-install-recommends -y ffmpeg libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers xorg-dev - name: Install dev dependencies run: | python -m pip install --upgrade pip setuptools @@ -73,7 +73,7 @@ jobs: test-build-offscreen: name: Test Linux, only offscreen runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 30 if: ${{ !github.event.pull_request.draft }} strategy: fail-fast: false @@ -96,7 +96,7 @@ jobs: - name: Install llvmpipe and lavapipe for offscreen canvas run: | sudo apt-get update -y -qq - sudo apt-get install --no-install-recommends -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers + sudo apt-get install --no-install-recommends -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers xorg-dev - name: Install dev dependencies run: | python -m pip install --upgrade pip setuptools diff --git a/docs/source/conf.py b/docs/source/conf.py index f65713270..9f8e34ab1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ import imageio.v3 as iio MAX_TEXTURE_SIZE = 2048 -pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension2d": MAX_TEXTURE_SIZE}) +pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension-2d": MAX_TEXTURE_SIZE}) ROOT_DIR = Path(__file__).parents[1].parents[0] # repo root EXAMPLES_DIR = Path.joinpath(ROOT_DIR, "examples") diff --git a/docs/source/user_guide/gpu.rst b/docs/source/user_guide/gpu.rst index 392eb672b..428c8600b 100644 --- a/docs/source/user_guide/gpu.rst +++ b/docs/source/user_guide/gpu.rst @@ -235,38 +235,38 @@ Example output:: adapter device - max_bind_groups: 8 8 - max_bind_groups_plus_vertex_buffers: 0 0 - max_bindings_per_bind_group: 1.00K 1.00K - max_buffer_size: 2.14G 2.14G - max_color_attachment_bytes_per_sample: 0 0 - max_color_attachments: 0 0 - max_compute_invocations_per_workgroup: 1.02K 1.02K - max_compute_workgroup_size_x: 1.02K 1.02K - max_compute_workgroup_size_y: 1.02K 1.02K - max_compute_workgroup_size_z: 1.02K 1.02K - max_compute_workgroup_storage_size: 32.7K 32.7K - max_compute_workgroups_per_dimension: 65.5K 65.5K - max_dynamic_storage_buffers_per_pipeline_layout: 8 8 - max_dynamic_uniform_buffers_per_pipeline_layout: 16 16 - max_inter_stage_shader_components: 128 128 - max_inter_stage_shader_variables: 0 0 - max_sampled_textures_per_shader_stage: 8.38M 8.38M - max_samplers_per_shader_stage: 8.38M 8.38M - max_storage_buffer_binding_size: 2.14G 2.14G - max_storage_buffers_per_shader_stage: 8.38M 8.38M - max_storage_textures_per_shader_stage: 8.38M 8.38M - max_texture_array_layers: 2.04K 2.04K - max_texture_dimension1d: 16.3K 16.3K - max_texture_dimension2d: 16.3K 16.3K - max_texture_dimension3d: 2.04K 2.04K - max_uniform_buffer_binding_size: 2.14G 2.14G - max_uniform_buffers_per_shader_stage: 8.38M 8.38M - max_vertex_attributes: 32 32 - max_vertex_buffer_array_stride: 2.04K 2.04K - max_vertex_buffers: 16 16 - min_storage_buffer_offset_alignment: 32 32 - min_uniform_buffer_offset_alignment: 32 32 + max-bind-groups: 8 8 + max-bind-groups-plus-vertex-buffers: 0 0 + max-bindings-per-bind-group: 1.00K 1.00K + max-buffer-size: 2.14G 2.14G + max-color-attachment-bytes-per-sample: 0 0 + max-color-attachments: 0 0 + max-compute-invocations-per-workgroup: 1.02K 1.02K + max-compute-workgroup-size-x: 1.02K 1.02K + max-compute-workgroup-size-y: 1.02K 1.02K + max-compute-workgroup-size-z: 1.02K 1.02K + max-compute-workgroup-storage-size: 32.7K 32.7K + max-compute-workgroups-per-dimension: 65.5K 65.5K + max-dynamic-storage-buffers-per-pipeline-layout: 8 8 + max-dynamic-uniform-buffers-per-pipeline-layout: 16 16 + max-inter-stage-shader-components: 128 128 + max-inter-stage-shader-variables: 0 0 + max-sampled-textures-per-shader-stage: 8.38M 8.38M + max-samplers-per-shader-stage: 8.38M 8.38M + max-storage-buffer-binding-size: 2.14G 2.14G + max-storage-buffers-per-shader-stage: 8.38M 8.38M + max-storage-textures-per-shader-stage: 8.38M 8.38M + max-texture-array-layers: 2.04K 2.04K + max-texture-dimension-1d: 16.3K 16.3K + max-texture-dimension-2d: 16.3K 16.3K + max-texture-dimension-3d: 2.04K 2.04K + max-uniform-buffer-binding-size: 2.14G 2.14G + max-uniform-buffers-per-shader-stage: 8.38M 8.38M + max-vertex-attributes: 32 32 + max-vertex-buffer-array-stride: 2.04K 2.04K + max-vertex-buffers: 16 16 + min-storage-buffer-offset-alignment: 32 32 + min-uniform-buffer-offset-alignment: 32 32 ██ pygfx_caches: diff --git a/examples/tests/test_examples.py b/examples/tests/test_examples.py index 55a3fa84d..caa8e9dca 100644 --- a/examples/tests/test_examples.py +++ b/examples/tests/test_examples.py @@ -12,7 +12,7 @@ import pygfx MAX_TEXTURE_SIZE = 2048 -pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension2d": MAX_TEXTURE_SIZE}) +pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension-2d": MAX_TEXTURE_SIZE}) from .testutils import ( ROOT, diff --git a/fastplotlib/graphics/_features/_image.py b/fastplotlib/graphics/_features/_image.py index 53bcc5bc4..2369d7af0 100644 --- a/fastplotlib/graphics/_features/_image.py +++ b/fastplotlib/graphics/_features/_image.py @@ -21,7 +21,7 @@ def __init__(self, data, isolated_buffer: bool = True): data = self._fix_data(data) shared = pygfx.renderers.wgpu.get_shared() - self._texture_limit_2d = shared.device.limits["max-texture-dimension2d"] + self._texture_limit_2d = shared.device.limits["max-texture-dimension-2d"] if isolated_buffer: # useful if data is read-only, example: memmaps diff --git a/tests/conftest.py b/tests/conftest.py index ffc34d464..3f5414a71 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,4 +5,4 @@ def pytest_sessionstart(session): - pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension2d": MAX_TEXTURE_SIZE}) + pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension-2d": MAX_TEXTURE_SIZE}) From 298b76e1f8fcf8d1ea0b590cd75a040dc3e1fc2d Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Wed, 25 Dec 2024 06:22:43 -0500 Subject: [PATCH 03/15] update to use pygfx.TextureMap --- fastplotlib/graphics/_features/_image.py | 7 ++++--- fastplotlib/graphics/image.py | 21 +++++++++++---------- tests/test_image_graphic.py | 11 +++++++---- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/fastplotlib/graphics/_features/_image.py b/fastplotlib/graphics/_features/_image.py index 2369d7af0..b67bf1cd4 100644 --- a/fastplotlib/graphics/_features/_image.py +++ b/fastplotlib/graphics/_features/_image.py @@ -202,8 +202,8 @@ def value(self) -> str: def set_value(self, graphic, value: str): new_colors = make_colors(256, value) - graphic._material.map.data[:] = new_colors - graphic._material.map.update_range((0, 0, 0), size=(256, 1, 1)) + graphic._material.map.texture.data[:] = new_colors + graphic._material.map.texture.update_range((0, 0, 0), size=(256, 1, 1)) self._value = value event = FeatureEvent(type="cmap", info={"value": value}) @@ -258,7 +258,8 @@ def set_value(self, graphic, value: str): self._validate(value) # common material for all image tiles - graphic._material.map_interpolation = value + graphic._material.map.min_filter = value + graphic._material.map.mag_filter = value self._value = value event = FeatureEvent(type="cmap_interpolation", info={"value": value}) diff --git a/fastplotlib/graphics/image.py b/fastplotlib/graphics/image.py index 25a4741e0..8b937023b 100644 --- a/fastplotlib/graphics/image.py +++ b/fastplotlib/graphics/image.py @@ -132,27 +132,28 @@ def __init__( self._vmin = ImageVmin(vmin) self._vmax = ImageVmax(vmax) - # set cmap to None for RGB images + self._interpolation = ImageInterpolation(interpolation) + + # set map to None for RGB images if self._data.value.ndim > 2: self._cmap = None + _map = None else: + # use TextureMap for grayscale images self._cmap = ImageCmap(cmap) + self._cmap_interpolation = ImageCmapInterpolation(cmap_interpolation) - self._interpolation = ImageInterpolation(interpolation) - self._cmap_interpolation = ImageCmapInterpolation(cmap_interpolation) - - # use cmap if not RGB - if self._data.value.ndim == 2: - _map = self._cmap.texture - else: - _map = None + _map = pygfx.TextureMap( + self._cmap.texture, + filter=self._cmap_interpolation.value, + wrap="clamp-to-edge", + ) # one common material is used for every Texture chunk self._material = pygfx.ImageBasicMaterial( clim=(vmin, vmax), map=_map, interpolation=self._interpolation.value, - map_interpolation=self._cmap_interpolation.value, pick_write=True, ) diff --git a/tests/test_image_graphic.py b/tests/test_image_graphic.py index 541129079..0ea9979a6 100644 --- a/tests/test_image_graphic.py +++ b/tests/test_image_graphic.py @@ -92,14 +92,14 @@ def test_gray(): new_colors = make_colors(256, "viridis") for child in ig.world_object.children: - npt.assert_almost_equal(child.material.map.data, new_colors) + npt.assert_almost_equal(child.material.map.texture.data, new_colors) ig.cmap = "jet" assert ig.cmap == "jet" new_colors = make_colors(256, "jet") for child in ig.world_object.children: - npt.assert_almost_equal(child.material.map.data, new_colors) + npt.assert_almost_equal(child.material.map.texture.data, new_colors) assert ig.interpolation == "nearest" for child in ig.world_object.children: @@ -113,12 +113,15 @@ def test_gray(): assert ig.cmap_interpolation == "linear" for child in ig.world_object.children: - assert child.material.map_interpolation == "linear" + assert child.material.map.min_filter == "linear" + assert child.material.map.mag_filter == "linear" ig.cmap_interpolation = "nearest" assert ig.cmap_interpolation == "nearest" for child in ig.world_object.children: - assert child.material.map_interpolation == "nearest" + assert child.material.map.min_filter == "nearest" + assert child.material.map.mag_filter == "nearest" + check_event(graphic=ig, feature="cmap_interpolation", value="nearest") npt.assert_almost_equal(ig.vmin, GRAY_IMAGE.min()) From 84192fc59ba50562c9690a11c34fcf8920664092 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Wed, 25 Dec 2024 06:30:54 -0500 Subject: [PATCH 04/15] forgot to set imageio[ffmpeg] for all extras --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a7533d47d..a1c74d5e5 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "pandoc", "jupyterlab", "sidecar", - "imageio[pyav]", + "imageio[ffmpeg]", "matplotlib", "scikit-learn", "imgui-bundle", @@ -39,7 +39,7 @@ "nbmake", "black", "scipy", - "imageio[pyav]", + "imageio[ffmpeg]", "jupyterlab", "jupyter-rfb>=0.4.1", "ipywidgets>=8.0.0,<9", From df9b7fa9380171af9db3aae96969afca21ef94eb Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 03:57:28 -0500 Subject: [PATCH 05/15] migrate to RenderCanvas, remove event_filter stuff for imgui since that was fixed in pygfx --- fastplotlib/__init__.py | 2 +- fastplotlib/layouts/_figure.py | 34 ++++--------- fastplotlib/layouts/_imgui_figure.py | 6 +-- fastplotlib/layouts/_plot_area.py | 9 ++-- fastplotlib/layouts/_subplot.py | 10 ++-- fastplotlib/layouts/_utils.py | 50 ++++--------------- fastplotlib/ui/_base.py | 25 ---------- .../ui/right_click_menus/_colormap_picker.py | 5 -- .../ui/right_click_menus/_standard_menu.py | 5 -- fastplotlib/utils/__init__.py | 2 +- fastplotlib/utils/gui.py | 10 ++-- fastplotlib/widgets/image_widget/_widget.py | 16 +++--- 12 files changed, 50 insertions(+), 124 deletions(-) diff --git a/fastplotlib/__init__.py b/fastplotlib/__init__.py index 3cee71b28..b27c67150 100644 --- a/fastplotlib/__init__.py +++ b/fastplotlib/__init__.py @@ -1,7 +1,7 @@ from pathlib import Path # this must be the first import for auto-canvas detection -from .utils import run # noqa +from .utils import loop # noqa from .graphics import * from .graphics.selectors import * from .graphics.utils import pause_events diff --git a/fastplotlib/layouts/_figure.py b/fastplotlib/layouts/_figure.py index bba5d4aab..775d72dbf 100644 --- a/fastplotlib/layouts/_figure.py +++ b/fastplotlib/layouts/_figure.py @@ -11,7 +11,7 @@ import pygfx -from wgpu.gui import WgpuCanvasBase +from rendercanvas import BaseRenderCanvas from ._video_writer import VideoWriterAV from ._utils import make_canvas_and_renderer, create_controller, create_camera @@ -41,7 +41,7 @@ def __init__( | Iterable[Iterable[str]] ) = None, controllers: pygfx.Controller | Iterable[Iterable[pygfx.Controller]] = None, - canvas: str | WgpuCanvasBase | pygfx.Texture = None, + canvas: str | BaseRenderCanvas | pygfx.Texture = None, renderer: pygfx.WgpuRenderer = None, size: tuple[int, int] = (500, 300), names: list | np.ndarray = None, @@ -84,8 +84,8 @@ def __init__( plot/subplot. Other controller kwargs, i.e. ``controller_types`` and ``controller_ids`` are ignored if ``controllers`` are provided. - canvas: WgpuCanvas, optional - Canvas for drawing + canvas: str, BaseRenderCanvas, pygfx.Texture + Canvas to draw the figure onto, usually auto-selected based on running environment. renderer: pygfx.Renderer, optional pygfx renderer instance @@ -334,13 +334,13 @@ def shape(self) -> tuple[int, int]: return self._shape @property - def canvas(self) -> WgpuCanvasBase: - """The canvas associated to this Figure""" + def canvas(self) -> BaseRenderCanvas: + """The canvas this Figure is drawn onto""" return self._canvas @property def renderer(self) -> pygfx.WgpuRenderer: - """The renderer associated to this Figure""" + """The renderer that renders this Figure""" return self._renderer @property @@ -422,7 +422,7 @@ def show( Returns ------- - WgpuCanvasBase + BaseRenderCanvas In Qt or GLFW, the canvas window containing the Figure will be shown. In jupyter, it will display the plot in the output cell or sidecar. """ @@ -452,7 +452,7 @@ def show( subplot.auto_scale(maintain_aspect=maintain_aspect) # parse based on canvas type - if self.canvas.__class__.__name__ == "JupyterWgpuCanvas": + if self.canvas.__class__.__name__ == "JupyterRenderCanvas": if sidecar: from sidecar import Sidecar from IPython.display import display @@ -464,12 +464,12 @@ def show( self._output = self.canvas return self._output - elif self.canvas.__class__.__name__ == "QWgpuCanvas": + elif self.canvas.__class__.__name__ == "QRenderCanvas": self._output = self.canvas self._output.show() return self.canvas - elif self.canvas.__class__.__name__ == "WgpuManualOffscreenCanvas": + elif self.canvas.__class__.__name__ == "OffscreenRenderCanvas": # for test and docs gallery screenshots for subplot in self: subplot.set_viewport_rect() @@ -494,18 +494,6 @@ def close(self): if self._sidecar: self._sidecar.close() - def get_pygfx_render_area(self, *args) -> tuple[int, int, int, int]: - """ - Get rect for the portion of the canvas that the pygfx renderer draws to - - Returns - ------- - tuple[int, int, int, int] - x_pos, y_pos, width, height - - """ - return 0, 0, *self.canvas.get_logical_size() - def _call_animate_functions(self, funcs: list[callable]): for fn in funcs: try: diff --git a/fastplotlib/layouts/_imgui_figure.py b/fastplotlib/layouts/_imgui_figure.py index 3396c3d27..8621f4464 100644 --- a/fastplotlib/layouts/_imgui_figure.py +++ b/fastplotlib/layouts/_imgui_figure.py @@ -7,7 +7,7 @@ from imgui_bundle import imgui, icons_fontawesome_6 as fa from wgpu.utils.imgui import ImguiRenderer -from wgpu.gui import WgpuCanvasBase +from rendercanvas import BaseRenderCanvas import pygfx @@ -38,7 +38,7 @@ def __init__( | Iterable[Iterable[str]] ) = None, controllers: pygfx.Controller | Iterable[Iterable[pygfx.Controller]] = None, - canvas: str | WgpuCanvasBase | pygfx.Texture = None, + canvas: str | BaseRenderCanvas | pygfx.Texture = None, renderer: pygfx.WgpuRenderer = None, size: tuple[int, int] = (500, 300), names: list | np.ndarray = None, @@ -198,7 +198,7 @@ def get_pygfx_render_area(self, *args) -> tuple[int, int, int, int]: else: ypos = 0 - return xpos, ypos, width, height + return xpos, ypos, max(1, width), max(1, height) def _reset_viewports(self): # TODO: think about moving this to Figure later, diff --git a/fastplotlib/layouts/_plot_area.py b/fastplotlib/layouts/_plot_area.py index 76a956876..e096a7f21 100644 --- a/fastplotlib/layouts/_plot_area.py +++ b/fastplotlib/layouts/_plot_area.py @@ -6,7 +6,7 @@ import pygfx from pylinalg import vec_transform, vec_unproject -from wgpu.gui import WgpuCanvasBase +from rendercanvas import BaseRenderCanvas from ._utils import create_controller from ..graphics._base import Graphic @@ -32,9 +32,8 @@ def __init__( camera: pygfx.PerspectiveCamera, controller: pygfx.Controller, scene: pygfx.Scene, - canvas: WgpuCanvasBase, + canvas: BaseRenderCanvas, renderer: pygfx.WgpuRenderer, - extra_renderers: dict = None, name: str = None, ): """ @@ -59,7 +58,7 @@ def __init__( scene: pygfx.Scene represents the root of a scene graph, will be viewed by the given ``camera`` - canvas: WgpuCanvas + canvas: BaseRenderCanvas provides surface on which a scene will be rendered renderer: pygfx.WgpuRenderer @@ -153,7 +152,7 @@ def scene(self) -> pygfx.Scene: return self._scene @property - def canvas(self) -> WgpuCanvasBase: + def canvas(self) -> BaseRenderCanvas: """Canvas associated to the plot area""" return self._canvas diff --git a/fastplotlib/layouts/_subplot.py b/fastplotlib/layouts/_subplot.py index 9c3b174a9..7d52ebab2 100644 --- a/fastplotlib/layouts/_subplot.py +++ b/fastplotlib/layouts/_subplot.py @@ -4,7 +4,7 @@ import pygfx -from wgpu.gui import WgpuCanvasBase +from rendercanvas import BaseRenderCanvas from ..graphics import TextGraphic from ._utils import create_camera, create_controller @@ -25,7 +25,7 @@ def __init__( parent_dims: tuple[int, int], camera: Literal["2d", "3d"] | pygfx.PerspectiveCamera, controller: pygfx.Controller, - canvas: WgpuCanvasBase | pygfx.Texture, + canvas: BaseRenderCanvas | pygfx.Texture, renderer: pygfx.WgpuRenderer = None, name: str = None, ): @@ -56,7 +56,7 @@ def __init__( | if ``str``, must be one of: `"panzoom", "fly", "trackball", or "orbit"`. | also accepts a pygfx.Controller instance - canvas: WgpuCanvas, or a pygfx.Texture + canvas: BaseRenderCanvas, or a pygfx.Texture Provides surface on which a scene will be rendered. renderer: WgpuRenderer @@ -219,7 +219,9 @@ def get_rect(self) -> np.ndarray: # leave space for imgui toolbar height_subplot -= IMGUI_TOOLBAR_HEIGHT - rect = np.array([x_pos, y_pos, width_subplot, height_subplot]) + # clip so that min values are always 1, otherwise JupyterRenderCanvas causes issues because it + # initializes with a width of (0, 0) + rect = np.array([x_pos, y_pos, width_subplot, height_subplot]).clip(1) for dv in self.docks.values(): rect = rect + dv.get_parent_rect_adjust() diff --git a/fastplotlib/layouts/_utils.py b/fastplotlib/layouts/_utils.py index ea44f6950..973acaa35 100644 --- a/fastplotlib/layouts/_utils.py +++ b/fastplotlib/layouts/_utils.py @@ -2,43 +2,12 @@ import pygfx from pygfx import WgpuRenderer, Texture, Renderer -from pygfx.renderers.wgpu.engine.renderer import ( - EVENT_TYPE_MAP, - PointerEvent, - WheelEvent, -) -from wgpu.gui import WgpuCanvasBase - -from ..utils import gui - - -# temporary until https://github.com/pygfx/pygfx/issues/495 -class WgpuRendererWithEventFilters(WgpuRenderer): - def __init__(self, target, *args, **kwargs): - super().__init__(target, *args, **kwargs) - self._event_filters = {} - - def convert_event(self, event: dict): - event_type = event["event_type"] - - if EVENT_TYPE_MAP[event_type] in [PointerEvent, WheelEvent]: - for filt in self.event_filters.values(): - if ( - filt[0, 0] < event["x"] < filt[1, 0] - and filt[0, 1] < event["y"] < filt[1, 1] - ): - return - - super().convert_event(event) - - @property - def event_filters(self) -> dict: - return self._event_filters +from ..utils.gui import BaseRenderCanvas, RenderCanvas def make_canvas_and_renderer( - canvas: str | WgpuCanvasBase | Texture | None, + canvas: str | BaseRenderCanvas | Texture | None, renderer: Renderer | None, canvas_kwargs: dict, ): @@ -48,18 +17,19 @@ def make_canvas_and_renderer( """ if canvas is None: - canvas = gui.WgpuCanvas(max_fps=60, **canvas_kwargs) + canvas = RenderCanvas(max_fps=60, **canvas_kwargs) elif isinstance(canvas, str): - m = importlib.import_module("wgpu.gui." + canvas) - canvas = m.WgpuCanvas(max_fps=60, **canvas_kwargs) - elif not isinstance(canvas, (WgpuCanvasBase, Texture)): + import rendercanvas + m = importlib.import_module("rendercanvas." + canvas) + canvas = m.RenderCanvas(max_fps=60, **canvas_kwargs) + elif not isinstance(canvas, (BaseRenderCanvas, Texture)): raise TypeError( - f"canvas option must either be a valid WgpuCanvas implementation, a pygfx Texture" - f" or a str with the wgpu gui backend name." + f"canvas option must either be a valid BaseRenderCanvas implementation, a pygfx Texture" + f" or a str with the gui backend name, valid str are: 'qt', 'glfw', 'jupyter', 'wx', and 'offscreen'" ) if renderer is None: - renderer = WgpuRendererWithEventFilters(canvas) + renderer = WgpuRenderer(canvas) elif not isinstance(renderer, Renderer): raise TypeError( f"renderer option must be a pygfx.Renderer instance such as pygfx.WgpuRenderer" diff --git a/fastplotlib/ui/_base.py b/fastplotlib/ui/_base.py index 4ca9fbeca..0abc81e88 100644 --- a/fastplotlib/ui/_base.py +++ b/fastplotlib/ui/_base.py @@ -252,31 +252,6 @@ def __init__(self, figure: Figure, *args, **kwargs): self.is_open = False - def set_event_filter(self, name: str): - """Filter out events under the popup from being handled by pygfx renderer""" - # get popup window position & size - x1, y1 = imgui.get_window_pos() - width, height = imgui.get_window_size() - x2, y2 = x1 + width, y1 + height - - # add or modify event filter - if name not in self._figure.renderer.event_filters.keys(): - self._figure.renderer.event_filters[name] = np.array( - [[x1 - 1, y1 - 1], [x2 + 4, y2 + 4]] - ) - else: - self._figure.renderer.event_filters[name][:] = [x1 - 1, y1 - 1], [ - x2 + 4, - y2 + 4, - ] - - self._event_filter_names.add(name) - - def clear_event_filters(self): - """clear event filters when the popup is not shown""" - for name in self._event_filter_names: - self._figure.renderer.event_filters[name][:] = [-1, -1], [-1, -1] - def open(self, pos: tuple[int, int], *args, **kwargs): """implement in subclass""" raise NotImplementedError diff --git a/fastplotlib/ui/right_click_menus/_colormap_picker.py b/fastplotlib/ui/right_click_menus/_colormap_picker.py index 5a14705c7..03176f673 100644 --- a/fastplotlib/ui/right_click_menus/_colormap_picker.py +++ b/fastplotlib/ui/right_click_menus/_colormap_picker.py @@ -120,8 +120,6 @@ def close(self): self.is_open = False - self.clear_event_filters() - def _add_cmap_menu_item(self, cmap_name: str): texture_id = self._texture_ids[cmap_name] imgui.image( @@ -149,9 +147,6 @@ def update(self): if imgui.begin_popup("cmap-picker"): self.is_open = True - # event filter so click events in the menu aren't propagated down to pygfx - self.set_event_filter("cmap-picker-filter") - # make the cmap image height the same as the text height self._texture_height = ( self.imgui_renderer.backend.io.font_global_scale diff --git a/fastplotlib/ui/right_click_menus/_standard_menu.py b/fastplotlib/ui/right_click_menus/_standard_menu.py index 71e8df632..cb1763d6d 100644 --- a/fastplotlib/ui/right_click_menus/_standard_menu.py +++ b/fastplotlib/ui/right_click_menus/_standard_menu.py @@ -42,7 +42,6 @@ def get_subplot(self) -> PlotArea | bool: def cleanup(self): """called when the popup disappears""" - self.clear_event_filters() self.is_open = False def update(self): @@ -65,9 +64,6 @@ def update(self): self.cleanup() if imgui.begin_popup(f"right-click-menu"): - # set event filter so event in the popup region are not handled by pygfx.WgpuRenderer - self.set_event_filter("right-click-menu") - if not self.get_subplot(): # for some reason it will still trigger at certain locations # despite open_popup() only being called when an actual @@ -143,7 +139,6 @@ def update(self): # controller options if imgui.begin_menu("Controller"): - self.set_event_filter("controller-menu") _, enabled = imgui.menu_item( "Enabled", None, self.get_subplot().controller.enabled ) diff --git a/fastplotlib/utils/__init__.py b/fastplotlib/utils/__init__.py index 276397e88..dce4d96f9 100644 --- a/fastplotlib/utils/__init__.py +++ b/fastplotlib/utils/__init__.py @@ -1,7 +1,7 @@ from dataclasses import dataclass # this MUST be imported as early as possible in fpl.__init__ before any other wgpu stuff -from .gui import run +from .gui import loop from .functions import * from .gpu import enumerate_adapters, select_adapter, print_wgpu_report from ._plot_helpers import * diff --git a/fastplotlib/utils/gui.py b/fastplotlib/utils/gui.py index c9b2ad011..a8a79920f 100644 --- a/fastplotlib/utils/gui.py +++ b/fastplotlib/utils/gui.py @@ -33,10 +33,11 @@ # Let wgpu do the auto gui selection -from wgpu.gui.auto import WgpuCanvas, run +from rendercanvas import BaseRenderCanvas +from rendercanvas.auto import RenderCanvas, loop # Get the name of the backend ('qt', 'glfw', 'jupyter') -GUI_BACKEND = WgpuCanvas.__module__.split(".")[-1] +GUI_BACKEND = RenderCanvas.__module__.split(".")[-1] IS_JUPYTER = GUI_BACKEND == "jupyter" @@ -123,10 +124,7 @@ def _notebook_print_banner(): _notebook_print_banner() elif GUI_BACKEND == "qt": - from wgpu.gui.qt import get_app, libname - - # create and store ref to qt app - _qt_app = get_app() + from rendercanvas.qt import libname # Import submodules of PySide6/PyQt6/PySid2/PyQt5 # For the way that fpl uses Qt, the supported Qt libs seems compatible enough. diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index 413038c15..f49027d45 100644 --- a/fastplotlib/widgets/image_widget/_widget.py +++ b/fastplotlib/widgets/image_widget/_widget.py @@ -3,7 +3,7 @@ import numpy as np -from wgpu.gui import WgpuCanvasBase +from rendercanvas import BaseRenderCanvas from ... import Figure from ...graphics import ImageGraphic @@ -940,21 +940,25 @@ def set_data( self.current_index = self.current_index def show( - self, toolbar: bool = True, sidecar: bool = False, sidecar_kwargs: dict = None + self, **kwargs ): """ Show the widget. + Parameters + kwargs: Any + passed to `Figure.show()` + Returns ------- - WgpuCanvasBase - canvas used by the Figure + BaseRenderCanvas + In Qt or GLFW, the canvas window containing the Figure will be shown. + In jupyter, it will display the plot in the output cell or sidecar. """ return self.figure.show( - sidecar=sidecar, - sidecar_kwargs=sidecar_kwargs, + **kwargs ) def close(self): From 17a92332b15d3eab9f4ace46106afc9509c4b097 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:12:27 -0500 Subject: [PATCH 06/15] remove very old irrelevant example --- examples/misc-dev/large_img.py | 35 ---------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 examples/misc-dev/large_img.py diff --git a/examples/misc-dev/large_img.py b/examples/misc-dev/large_img.py deleted file mode 100644 index 021bbd6f6..000000000 --- a/examples/misc-dev/large_img.py +++ /dev/null @@ -1,35 +0,0 @@ -from fastplotlib import Plot, run -import numpy as np - -temporal = np.load("./array_10-000x108-000.npy") - -from PIL import Image - -Image.MAX_IMAGE_PIXELS = None - -img = Image.open("/home/kushal/Downloads/gigahour_stitched_0042_bbs.png") - -a = np.array(img) - -r = np.random.randint(0, 50, a.size, dtype=np.uint8).reshape(a.shape) - -plot = Plot(renderer_kwargs={"show_fps": True}) -plot.add_heatmap(r) -# plot.camera.scale.y = 0.2 -plot.show() - -r = np.random.randint(0, 50, a.size, dtype=np.uint8).reshape(a.shape) -r2 = np.random.randint(0, 50, a.size, dtype=np.uint8).reshape(a.shape) -r3 = np.random.randint(0, 50, a.size, dtype=np.uint8).reshape(a.shape) - -rs = [r, r2, r3] -i = 0 - -def update_frame(p): - global i - p.graphics[0].data[:] = rs[i % 3] - i +=1 - -plot.add_animations(update_frame) - -run() From 15764c9f6cfeba491eb469047ebad6df1d4d974e Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:24:19 -0500 Subject: [PATCH 07/15] fix docstring --- fastplotlib/widgets/image_widget/_widget.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index f49027d45..1a34e9f33 100644 --- a/fastplotlib/widgets/image_widget/_widget.py +++ b/fastplotlib/widgets/image_widget/_widget.py @@ -946,6 +946,8 @@ def show( Show the widget. Parameters + ---------- + kwargs: Any passed to `Figure.show()` From dad91b995e405c75e94ca18e25773a20c7b7baaf Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:34:16 -0500 Subject: [PATCH 08/15] update examples to use fpl.loop.run() --- examples/gridplot/gridplot.py | 2 +- examples/gridplot/gridplot_non_square.py | 2 +- examples/gridplot/multigraphic_gridplot.py | 2 +- examples/guis/image_widget_imgui.py | 2 +- examples/guis/imgui_basic.py | 2 +- examples/heatmap/heatmap.py | 2 +- examples/image/image_cmap.py | 2 +- examples/image/image_rgb.py | 2 +- examples/image/image_rgbvminvmax.py | 2 +- examples/image/image_simple.py | 2 +- examples/image/image_small.py | 2 +- examples/image/image_vminvmax.py | 2 +- examples/image_widget/image_widget.py | 4 ++-- examples/image_widget/image_widget_grid.py | 2 +- examples/image_widget/image_widget_single_video.py | 2 +- examples/image_widget/image_widget_videos.py | 2 +- examples/line/line.py | 2 +- examples/line/line_cmap.py | 2 +- examples/line/line_cmap_more.py | 2 +- examples/line/line_colorslice.py | 2 +- examples/line/line_dataslice.py | 2 +- examples/line_collection/line_collection.py | 2 +- examples/line_collection/line_collection_cmap_values.py | 2 +- .../line_collection_cmap_values_qualitative.py | 2 +- examples/line_collection/line_collection_colors.py | 2 +- examples/line_collection/line_collection_slicing.py | 2 +- examples/line_collection/line_stack.py | 2 +- examples/line_collection/line_stack_3d.py | 2 +- examples/machine_learning/covariance.py | 2 +- examples/misc/cycle_animation.py | 2 +- examples/misc/em_wave_animation.py | 2 +- examples/misc/image_animation.py | 2 +- examples/misc/line3d_animation.py | 2 +- examples/misc/line_animation.py | 2 +- examples/misc/lorenz_animation.py | 2 +- examples/misc/multiplot_animation.py | 2 +- examples/misc/scatter_animation.py | 2 +- examples/misc/scatter_sizes_animation.py | 2 +- examples/misc/simple_event.py | 2 +- examples/qt/embed.py | 4 ++-- examples/qt/imagewidget.py | 4 ++-- examples/qt/minimal.py | 2 +- examples/scatter/scatter.py | 4 ++-- examples/scatter/scatter_cmap.py | 6 +++--- examples/scatter/scatter_cmap_iris.py | 2 +- examples/scatter/scatter_colorslice.py | 4 ++-- examples/scatter/scatter_colorslice_iris.py | 2 +- examples/scatter/scatter_dataslice.py | 2 +- examples/scatter/scatter_dataslice_iris.py | 2 +- examples/scatter/scatter_iris.py | 2 +- examples/scatter/scatter_size.py | 2 +- examples/selection_tools/linear_region_line_collection.py | 2 +- examples/selection_tools/linear_region_selector.py | 2 +- .../linear_region_selectors_match_offsets.py | 2 +- examples/selection_tools/linear_selector.py | 2 +- examples/selection_tools/linear_selector_image.py | 2 +- examples/selection_tools/rectangle_selector.py | 2 +- examples/selection_tools/rectangle_selector_zoom.py | 2 +- 58 files changed, 65 insertions(+), 65 deletions(-) diff --git a/examples/gridplot/gridplot.py b/examples/gridplot/gridplot.py index a77cb7872..5c38d6d43 100644 --- a/examples/gridplot/gridplot.py +++ b/examples/gridplot/gridplot.py @@ -30,4 +30,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/gridplot/gridplot_non_square.py b/examples/gridplot/gridplot_non_square.py index a7874319e..0277bcccd 100644 --- a/examples/gridplot/gridplot_non_square.py +++ b/examples/gridplot/gridplot_non_square.py @@ -28,4 +28,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/gridplot/multigraphic_gridplot.py b/examples/gridplot/multigraphic_gridplot.py index eec0d06fa..1bed60b31 100644 --- a/examples/gridplot/multigraphic_gridplot.py +++ b/examples/gridplot/multigraphic_gridplot.py @@ -114,5 +114,5 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/guis/image_widget_imgui.py b/examples/guis/image_widget_imgui.py index 38a5c72e1..13d41af20 100644 --- a/examples/guis/image_widget_imgui.py +++ b/examples/guis/image_widget_imgui.py @@ -79,4 +79,4 @@ def process_image(self): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/guis/imgui_basic.py b/examples/guis/imgui_basic.py index 456375950..eac39121c 100644 --- a/examples/guis/imgui_basic.py +++ b/examples/guis/imgui_basic.py @@ -120,4 +120,4 @@ def _set_data(self): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/heatmap/heatmap.py b/examples/heatmap/heatmap.py index 11d5559c4..39d76ae4e 100644 --- a/examples/heatmap/heatmap.py +++ b/examples/heatmap/heatmap.py @@ -30,4 +30,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_cmap.py b/examples/image/image_cmap.py index 4aad934b2..99a3c1969 100644 --- a/examples/image/image_cmap.py +++ b/examples/image/image_cmap.py @@ -26,4 +26,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_rgb.py b/examples/image/image_rgb.py index e89f3d192..5af8cee0d 100644 --- a/examples/image/image_rgb.py +++ b/examples/image/image_rgb.py @@ -25,4 +25,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_rgbvminvmax.py b/examples/image/image_rgbvminvmax.py index 2263f1307..08c01a36e 100644 --- a/examples/image/image_rgbvminvmax.py +++ b/examples/image/image_rgbvminvmax.py @@ -27,4 +27,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_simple.py b/examples/image/image_simple.py index cec8e3313..31803f2f8 100644 --- a/examples/image/image_simple.py +++ b/examples/image/image_simple.py @@ -25,4 +25,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_small.py b/examples/image/image_small.py index 937411ab1..eebc49797 100644 --- a/examples/image/image_small.py +++ b/examples/image/image_small.py @@ -27,4 +27,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image/image_vminvmax.py b/examples/image/image_vminvmax.py index 0503c5ff2..6cf13834d 100644 --- a/examples/image/image_vminvmax.py +++ b/examples/image/image_vminvmax.py @@ -27,4 +27,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image_widget/image_widget.py b/examples/image_widget/image_widget.py index 78b54b8ef..b500720d5 100644 --- a/examples/image_widget/image_widget.py +++ b/examples/image_widget/image_widget.py @@ -10,7 +10,7 @@ # test_example = true # sphinx_gallery_pygfx_docs = 'screenshot' - +import glfw import fastplotlib as fpl import imageio.v3 as iio # not a fastplotlib dependency, only used for examples @@ -31,4 +31,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image_widget/image_widget_grid.py b/examples/image_widget/image_widget_grid.py index 48b31caa7..f52f38bc5 100644 --- a/examples/image_widget/image_widget_grid.py +++ b/examples/image_widget/image_widget_grid.py @@ -38,4 +38,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image_widget/image_widget_single_video.py b/examples/image_widget/image_widget_single_video.py index 30073a935..3a0e94fca 100644 --- a/examples/image_widget/image_widget_single_video.py +++ b/examples/image_widget/image_widget_single_video.py @@ -44,4 +44,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/image_widget/image_widget_videos.py b/examples/image_widget/image_widget_videos.py index 6e5c35c50..1e367f0ad 100644 --- a/examples/image_widget/image_widget_videos.py +++ b/examples/image_widget/image_widget_videos.py @@ -40,4 +40,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line/line.py b/examples/line/line.py index eb1afbe60..c460c84ac 100644 --- a/examples/line/line.py +++ b/examples/line/line.py @@ -44,4 +44,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line/line_cmap.py b/examples/line/line_cmap.py index 81895e17b..b2fb39779 100644 --- a/examples/line/line_cmap.py +++ b/examples/line/line_cmap.py @@ -46,4 +46,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line/line_cmap_more.py b/examples/line/line_cmap_more.py index c05f36797..37fd68cdb 100644 --- a/examples/line/line_cmap_more.py +++ b/examples/line/line_cmap_more.py @@ -53,4 +53,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line/line_colorslice.py b/examples/line/line_colorslice.py index 0b71efc3d..788aa342d 100644 --- a/examples/line/line_colorslice.py +++ b/examples/line/line_colorslice.py @@ -87,4 +87,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line/line_dataslice.py b/examples/line/line_dataslice.py index 83a9ae34a..92f33a109 100644 --- a/examples/line/line_dataslice.py +++ b/examples/line/line_dataslice.py @@ -51,4 +51,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_collection.py b/examples/line_collection/line_collection.py index 67f3834d3..75b56e61e 100644 --- a/examples/line_collection/line_collection.py +++ b/examples/line_collection/line_collection.py @@ -43,4 +43,4 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_collection_cmap_values.py b/examples/line_collection/line_collection_cmap_values.py index e0b6f2507..c577609f9 100644 --- a/examples/line_collection/line_collection_cmap_values.py +++ b/examples/line_collection/line_collection_cmap_values.py @@ -50,4 +50,4 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_collection_cmap_values_qualitative.py b/examples/line_collection/line_collection_cmap_values_qualitative.py index bbb463c2f..7b1c0a419 100644 --- a/examples/line_collection/line_collection_cmap_values_qualitative.py +++ b/examples/line_collection/line_collection_cmap_values_qualitative.py @@ -60,4 +60,4 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_collection_colors.py b/examples/line_collection/line_collection_colors.py index 23ca25b25..1d9eff45d 100644 --- a/examples/line_collection/line_collection_colors.py +++ b/examples/line_collection/line_collection_colors.py @@ -47,4 +47,4 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_collection_slicing.py b/examples/line_collection/line_collection_slicing.py index fbeab53c2..f829a53c6 100644 --- a/examples/line_collection/line_collection_slicing.py +++ b/examples/line_collection/line_collection_slicing.py @@ -75,4 +75,4 @@ if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_stack.py b/examples/line_collection/line_stack.py index 9ca2a937e..95b681b76 100644 --- a/examples/line_collection/line_stack.py +++ b/examples/line_collection/line_stack.py @@ -35,4 +35,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/line_collection/line_stack_3d.py b/examples/line_collection/line_stack_3d.py index 46a24ef75..35fe48ca9 100644 --- a/examples/line_collection/line_stack_3d.py +++ b/examples/line_collection/line_stack_3d.py @@ -105,4 +105,4 @@ def animate_colors(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/machine_learning/covariance.py b/examples/machine_learning/covariance.py index 111a7bd22..84c5bf531 100644 --- a/examples/machine_learning/covariance.py +++ b/examples/machine_learning/covariance.py @@ -91,4 +91,4 @@ def animate(): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/cycle_animation.py b/examples/misc/cycle_animation.py index f866434a1..e369b957c 100644 --- a/examples/misc/cycle_animation.py +++ b/examples/misc/cycle_animation.py @@ -58,4 +58,4 @@ def cycle_colors(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/em_wave_animation.py b/examples/misc/em_wave_animation.py index bfccedf5f..06c60ccaf 100644 --- a/examples/misc/em_wave_animation.py +++ b/examples/misc/em_wave_animation.py @@ -112,4 +112,4 @@ def tick(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/image_animation.py b/examples/misc/image_animation.py index 8c323f464..bc5f83957 100644 --- a/examples/misc/image_animation.py +++ b/examples/misc/image_animation.py @@ -34,4 +34,4 @@ def update_data(figure_instance): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/line3d_animation.py b/examples/misc/line3d_animation.py index 4f2f089e6..b26bfd3a0 100644 --- a/examples/misc/line3d_animation.py +++ b/examples/misc/line3d_animation.py @@ -58,4 +58,4 @@ def move_marker(): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/line_animation.py b/examples/misc/line_animation.py index a602a6e7d..07c6a7d94 100644 --- a/examples/misc/line_animation.py +++ b/examples/misc/line_animation.py @@ -47,4 +47,4 @@ def update_line(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/lorenz_animation.py b/examples/misc/lorenz_animation.py index af577d5a2..4d4c5129f 100644 --- a/examples/misc/lorenz_animation.py +++ b/examples/misc/lorenz_animation.py @@ -90,4 +90,4 @@ def animate(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/multiplot_animation.py b/examples/misc/multiplot_animation.py index b0a942d0a..18512add1 100644 --- a/examples/misc/multiplot_animation.py +++ b/examples/misc/multiplot_animation.py @@ -45,4 +45,4 @@ def update_data(f): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/scatter_animation.py b/examples/misc/scatter_animation.py index de57292a5..d85a33e6a 100644 --- a/examples/misc/scatter_animation.py +++ b/examples/misc/scatter_animation.py @@ -55,4 +55,4 @@ def update_points(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/scatter_sizes_animation.py b/examples/misc/scatter_sizes_animation.py index aeb0466b0..45782564d 100644 --- a/examples/misc/scatter_sizes_animation.py +++ b/examples/misc/scatter_sizes_animation.py @@ -44,4 +44,4 @@ def update_sizes(subplot): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/misc/simple_event.py b/examples/misc/simple_event.py index 574b8ea5e..e382f04b5 100644 --- a/examples/misc/simple_event.py +++ b/examples/misc/simple_event.py @@ -51,4 +51,4 @@ def click_event(event_data): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/qt/embed.py b/examples/qt/embed.py index 535c08e5f..ba20c5084 100644 --- a/examples/qt/embed.py +++ b/examples/qt/embed.py @@ -60,7 +60,7 @@ def update_frame(ix): main_window.show() # execute Qt app -fpl.run() +fpl.loop.run() # You can also use Qt interactively/in a non-blocking manner in notebooks and ipython -# by using %gui qt and NOT calling `fpl.run()`, see the user guide for more details +# by using %gui qt and NOT calling `fpl.loop.run()`, see the user guide for more details diff --git a/examples/qt/imagewidget.py b/examples/qt/imagewidget.py index d18ae9b15..8a5b8937c 100644 --- a/examples/qt/imagewidget.py +++ b/examples/qt/imagewidget.py @@ -36,7 +36,7 @@ iw_rgb = fpl.ImageWidget(rgb_video, rgb=[True], figure_kwargs={"size": (800, 500)}) iw_rgb.show() -fpl.run() +fpl.loop.run() # You can also use Qt interactively/in a non-blocking manner in notebooks and ipython -# by using %gui qt and NOT calling `fpl.run()`, see the user guide for more details +# by using %gui qt and NOT calling `fpl.loop.run()`, see the user guide for more details diff --git a/examples/qt/minimal.py b/examples/qt/minimal.py index 01b5de352..0424df403 100644 --- a/examples/qt/minimal.py +++ b/examples/qt/minimal.py @@ -30,7 +30,7 @@ # execute Qt app # if this is part of a larger Qt QApplication, you can also call app.exec() where app is the QApplication instance -fpl.run() +fpl.loop.run() # You can also use Qt interactively/in a non-blocking manner in notebooks and ipython # by using %gui qt and NOT calling `fpl.run()`, see the user guide for more details diff --git a/examples/scatter/scatter.py b/examples/scatter/scatter.py index fe1f6ce6d..afb0a0b81 100644 --- a/examples/scatter/scatter.py +++ b/examples/scatter/scatter.py @@ -36,7 +36,7 @@ colors = ["yellow"] * n_points + ["cyan"] * n_points + ["magenta"] * n_points # use an alpha value since this will be a lot of points -figure[0,0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) +figure[0, 0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) figure.show() @@ -45,4 +45,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_cmap.py b/examples/scatter/scatter_cmap.py index 42ff572d8..8810e3d7b 100644 --- a/examples/scatter/scatter_cmap.py +++ b/examples/scatter/scatter_cmap.py @@ -36,15 +36,15 @@ colors = ["yellow"] * n_points + ["cyan"] * n_points + ["magenta"] * n_points # use an alpha value since this will be a lot of points -figure[0,0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) +figure[0, 0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) figure.show() -figure[0,0].graphics[0].cmap = "viridis" +figure[0, 0].graphics[0].cmap = "viridis" # NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_cmap_iris.py b/examples/scatter/scatter_cmap_iris.py index b25369c60..139554dae 100644 --- a/examples/scatter/scatter_cmap_iris.py +++ b/examples/scatter/scatter_cmap_iris.py @@ -35,4 +35,4 @@ if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_colorslice.py b/examples/scatter/scatter_colorslice.py index 839df3826..cf7472361 100644 --- a/examples/scatter/scatter_colorslice.py +++ b/examples/scatter/scatter_colorslice.py @@ -36,7 +36,7 @@ colors = ["yellow"] * n_points + ["cyan"] * n_points + ["magenta"] * n_points # use an alpha value since this will be a lot of points -figure[0,0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) +figure[0, 0].add_scatter(data=cloud, sizes=3, colors=colors, alpha=0.6) figure.show() @@ -50,4 +50,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_colorslice_iris.py b/examples/scatter/scatter_colorslice_iris.py index 92df1f66c..725374ef7 100644 --- a/examples/scatter/scatter_colorslice_iris.py +++ b/examples/scatter/scatter_colorslice_iris.py @@ -35,4 +35,4 @@ if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_dataslice.py b/examples/scatter/scatter_dataslice.py index 715959e06..840553237 100644 --- a/examples/scatter/scatter_dataslice.py +++ b/examples/scatter/scatter_dataslice.py @@ -36,4 +36,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_dataslice_iris.py b/examples/scatter/scatter_dataslice_iris.py index 04ac4b85f..cc688eeb4 100644 --- a/examples/scatter/scatter_dataslice_iris.py +++ b/examples/scatter/scatter_dataslice_iris.py @@ -34,4 +34,4 @@ if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_iris.py b/examples/scatter/scatter_iris.py index 6937ffe4b..e000d5a0a 100644 --- a/examples/scatter/scatter_iris.py +++ b/examples/scatter/scatter_iris.py @@ -32,4 +32,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/scatter/scatter_size.py b/examples/scatter/scatter_size.py index 0cecb6dad..73be31f62 100644 --- a/examples/scatter/scatter_size.py +++ b/examples/scatter/scatter_size.py @@ -44,4 +44,4 @@ # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/linear_region_line_collection.py b/examples/selection_tools/linear_region_line_collection.py index 493062026..76739d784 100644 --- a/examples/selection_tools/linear_region_line_collection.py +++ b/examples/selection_tools/linear_region_line_collection.py @@ -78,4 +78,4 @@ def update_zoomed_subplots(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/linear_region_selector.py b/examples/selection_tools/linear_region_selector.py index 026da2522..6fa17db38 100644 --- a/examples/selection_tools/linear_region_selector.py +++ b/examples/selection_tools/linear_region_selector.py @@ -111,4 +111,4 @@ def set_zoom_y(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/linear_region_selectors_match_offsets.py b/examples/selection_tools/linear_region_selectors_match_offsets.py index c5d58c9be..b48e30f28 100644 --- a/examples/selection_tools/linear_region_selectors_match_offsets.py +++ b/examples/selection_tools/linear_region_selectors_match_offsets.py @@ -106,4 +106,4 @@ def set_zoom_y(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/linear_selector.py b/examples/selection_tools/linear_selector.py index d724ccf5d..1edf6345c 100644 --- a/examples/selection_tools/linear_selector.py +++ b/examples/selection_tools/linear_selector.py @@ -119,4 +119,4 @@ def line_stack_selector_changed(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/linear_selector_image.py b/examples/selection_tools/linear_selector_image.py index 540c7645a..00484aba7 100644 --- a/examples/selection_tools/linear_selector_image.py +++ b/examples/selection_tools/linear_selector_image.py @@ -70,4 +70,4 @@ def image_col_selector_changed(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/rectangle_selector.py b/examples/selection_tools/rectangle_selector.py index 48e8647ac..850937f7a 100644 --- a/examples/selection_tools/rectangle_selector.py +++ b/examples/selection_tools/rectangle_selector.py @@ -63,4 +63,4 @@ def color_indices(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() diff --git a/examples/selection_tools/rectangle_selector_zoom.py b/examples/selection_tools/rectangle_selector_zoom.py index 45633c42b..33ba2ae2a 100644 --- a/examples/selection_tools/rectangle_selector_zoom.py +++ b/examples/selection_tools/rectangle_selector_zoom.py @@ -50,4 +50,4 @@ def update_data(ev): # please see our docs for using fastplotlib interactively in ipython and jupyter if __name__ == "__main__": print(__doc__) - fpl.run() + fpl.loop.run() From 62e909767bcb1fbaf9785b14b3da7b3ee6151395 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:37:08 -0500 Subject: [PATCH 09/15] update API docs --- docs/source/api/fastplotlib.rst | 4 +++- docs/source/api/ui/Popup.rst | 2 -- docs/source/generate_api.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/source/api/fastplotlib.rst b/docs/source/api/fastplotlib.rst index 74349156f..34dc89049 100644 --- a/docs/source/api/fastplotlib.rst +++ b/docs/source/api/fastplotlib.rst @@ -11,4 +11,6 @@ fastplotlib .. autofunction:: fastplotlib.print_wgpu_report -.. autofunction:: fastplotlib.run +fastplotlib.loop +------------------ +See the rendercanvas docs: https://rendercanvas.readthedocs.io/stable/api.html#rendercanvas.BaseLoop \ No newline at end of file diff --git a/docs/source/api/ui/Popup.rst b/docs/source/api/ui/Popup.rst index a154e9ce9..5e924db94 100644 --- a/docs/source/api/ui/Popup.rst +++ b/docs/source/api/ui/Popup.rst @@ -26,8 +26,6 @@ Methods .. autosummary:: :toctree: Popup_api - Popup.clear_event_filters Popup.open - Popup.set_event_filter Popup.update diff --git a/docs/source/generate_api.py b/docs/source/generate_api.py index 488b28466..6887566cb 100644 --- a/docs/source/generate_api.py +++ b/docs/source/generate_api.py @@ -51,7 +51,9 @@ ".. autofunction:: fastplotlib.print_wgpu_report\n\n" - ".. autofunction:: fastplotlib.run\n" + "fastplotlib.loop\n" + "------------------\n" + "See the rendercanvas docs: https://rendercanvas.readthedocs.io/stable/api.html#rendercanvas.BaseLoop " ) with open(API_DIR.joinpath("utils.rst"), "w") as f: From 82b061446534146c4ba76029a09e1c82d1f92a45 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:39:28 -0500 Subject: [PATCH 10/15] black --- fastplotlib/layouts/_utils.py | 1 + fastplotlib/widgets/image_widget/_widget.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fastplotlib/layouts/_utils.py b/fastplotlib/layouts/_utils.py index 973acaa35..b42971570 100644 --- a/fastplotlib/layouts/_utils.py +++ b/fastplotlib/layouts/_utils.py @@ -20,6 +20,7 @@ def make_canvas_and_renderer( canvas = RenderCanvas(max_fps=60, **canvas_kwargs) elif isinstance(canvas, str): import rendercanvas + m = importlib.import_module("rendercanvas." + canvas) canvas = m.RenderCanvas(max_fps=60, **canvas_kwargs) elif not isinstance(canvas, (BaseRenderCanvas, Texture)): diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index 1a34e9f33..c52f026db 100644 --- a/fastplotlib/widgets/image_widget/_widget.py +++ b/fastplotlib/widgets/image_widget/_widget.py @@ -939,9 +939,7 @@ def set_data( # force graphics to update self.current_index = self.current_index - def show( - self, **kwargs - ): + def show(self, **kwargs): """ Show the widget. @@ -959,9 +957,7 @@ def show( """ - return self.figure.show( - **kwargs - ) + return self.figure.show(**kwargs) def close(self): """Close Widget""" From 4daa293d4027ace3fadaae61db76129978f88b92 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 04:47:18 -0500 Subject: [PATCH 11/15] import ImageWidget only if imgui is installed --- fastplotlib/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastplotlib/__init__.py b/fastplotlib/__init__.py index b27c67150..2f3c35a1a 100644 --- a/fastplotlib/__init__.py +++ b/fastplotlib/__init__.py @@ -13,10 +13,10 @@ if IMGUI: # default to imgui figure if imgui_bundle is installed from .layouts import ImguiFigure as Figure + from .widgets import ImageWidget else: from .layouts import Figure -from .widgets import ImageWidget from .utils import config, enumerate_adapters, select_adapter, print_wgpu_report From c8e97caa7376bdf7630efda6768dae9ea2efb84c Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 05:02:26 -0500 Subject: [PATCH 12/15] enumerate_adapters() -> enumerate_adapters_sync() --- fastplotlib/utils/gpu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastplotlib/utils/gpu.py b/fastplotlib/utils/gpu.py index 72d303d23..912cf0935 100644 --- a/fastplotlib/utils/gpu.py +++ b/fastplotlib/utils/gpu.py @@ -4,10 +4,10 @@ def enumerate_adapters() -> list[wgpu.GPUAdapter]: - return wgpu.gpu.enumerate_adapters() + return wgpu.gpu.enumerate_adapters_sync() -enumerate_adapters.__doc__ = wgpu.gpu.enumerate_adapters.__doc__ +enumerate_adapters.__doc__ = wgpu.gpu.enumerate_adapters_async.__doc__ def select_adapter(adapter: wgpu.GPUAdapter): From 5b2e3e82e148f97f01a778c6badb968ce3116bae Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 26 Dec 2024 05:16:54 -0500 Subject: [PATCH 13/15] remove annoying warnings from cmap --- fastplotlib/utils/functions.py | 88 +++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/fastplotlib/utils/functions.py b/fastplotlib/utils/functions.py index d93f09da3..13bff310d 100644 --- a/fastplotlib/utils/functions.py +++ b/fastplotlib/utils/functions.py @@ -9,7 +9,93 @@ cmap_catalog = cmap_lib.Catalog() -COLORMAPS = cmap_catalog.short_keys() +COLORMAPS = sorted([ + "viridis", + "plasma", + "inferno", + "magma", + "cividis", + "Greys", + "Purples", + "Blues", + "Greens", + "Oranges", + "Reds", + "tol:YlOrBr", + "YlOrRd", + "OrRd", + "PuRd", + "RdPu", + "BuPu", + "GnBu", + "PuBu", + "YlGnBu", + "PuBuGn", + "BuGn", + "YlGn", + "binary", + "gist_yarg", + "gist_gray", + "gray", + "bone", + "pink", + "spring", + "summer", + "autumn", + "winter", + "cool", + "Wistia", + "hot", + "afmhot", + "gist_heat", + "copper", + "PiYG", + "tol:PRGn", + "BrBG", + "PuOr", + "RdGy", + "vispy:RdBu", + "RdYlBu", + "RdYlGn", + "Spectral", + "coolwarm", + "bwr", + "seismic", + "berlin", + "vanimo", + "twilight", + "twilight_shifted", + "hsv", + "Pastel1", + "Pastel2", + "Paired", + "Accent", + "Dark2", + "Set1", + "Set2", + "Set3", + "tab10", + "tab20", + "tab20b", + "tab20c", + "flag", + "prism", + "ocean", + "gist_earth", + "terrain", + "gist_stern", + "gnuplot", + "gnuplot2", + "CMRmap", + "cubehelix", + "brg", + "gist_rainbow", + "yorick:rainbow", + "jet", + "turbo", + "nipy_spectral", + "gist_ncar", +]) SEQUENTIAL_CMAPS = list() QUALITATIVE_CMAPS = list() From a7216ea33046a9b8ccf2518a997f5e2dc6b692a3 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 2 Jan 2025 12:40:42 -0500 Subject: [PATCH 14/15] remove more cmap warnings --- fastplotlib/utils/functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastplotlib/utils/functions.py b/fastplotlib/utils/functions.py index 13bff310d..9edfea32a 100644 --- a/fastplotlib/utils/functions.py +++ b/fastplotlib/utils/functions.py @@ -48,7 +48,7 @@ "hot", "afmhot", "gist_heat", - "copper", + "matlab:copper", "PiYG", "tol:PRGn", "BrBG", @@ -80,7 +80,7 @@ "tab20c", "flag", "prism", - "ocean", + "gnuplot:ocean", "gist_earth", "terrain", "gist_stern", From 705d94ca40240a290bb08638246fff1c93f0eade Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Thu, 2 Jan 2025 12:43:58 -0500 Subject: [PATCH 15/15] black --- fastplotlib/utils/functions.py | 176 +++++++++++++++++---------------- 1 file changed, 89 insertions(+), 87 deletions(-) diff --git a/fastplotlib/utils/functions.py b/fastplotlib/utils/functions.py index 9edfea32a..02dcd0572 100644 --- a/fastplotlib/utils/functions.py +++ b/fastplotlib/utils/functions.py @@ -9,93 +9,95 @@ cmap_catalog = cmap_lib.Catalog() -COLORMAPS = sorted([ - "viridis", - "plasma", - "inferno", - "magma", - "cividis", - "Greys", - "Purples", - "Blues", - "Greens", - "Oranges", - "Reds", - "tol:YlOrBr", - "YlOrRd", - "OrRd", - "PuRd", - "RdPu", - "BuPu", - "GnBu", - "PuBu", - "YlGnBu", - "PuBuGn", - "BuGn", - "YlGn", - "binary", - "gist_yarg", - "gist_gray", - "gray", - "bone", - "pink", - "spring", - "summer", - "autumn", - "winter", - "cool", - "Wistia", - "hot", - "afmhot", - "gist_heat", - "matlab:copper", - "PiYG", - "tol:PRGn", - "BrBG", - "PuOr", - "RdGy", - "vispy:RdBu", - "RdYlBu", - "RdYlGn", - "Spectral", - "coolwarm", - "bwr", - "seismic", - "berlin", - "vanimo", - "twilight", - "twilight_shifted", - "hsv", - "Pastel1", - "Pastel2", - "Paired", - "Accent", - "Dark2", - "Set1", - "Set2", - "Set3", - "tab10", - "tab20", - "tab20b", - "tab20c", - "flag", - "prism", - "gnuplot:ocean", - "gist_earth", - "terrain", - "gist_stern", - "gnuplot", - "gnuplot2", - "CMRmap", - "cubehelix", - "brg", - "gist_rainbow", - "yorick:rainbow", - "jet", - "turbo", - "nipy_spectral", - "gist_ncar", -]) +COLORMAPS = sorted( + [ + "viridis", + "plasma", + "inferno", + "magma", + "cividis", + "Greys", + "Purples", + "Blues", + "Greens", + "Oranges", + "Reds", + "tol:YlOrBr", + "YlOrRd", + "OrRd", + "PuRd", + "RdPu", + "BuPu", + "GnBu", + "PuBu", + "YlGnBu", + "PuBuGn", + "BuGn", + "YlGn", + "binary", + "gist_yarg", + "gist_gray", + "gray", + "bone", + "pink", + "spring", + "summer", + "autumn", + "winter", + "cool", + "Wistia", + "hot", + "afmhot", + "gist_heat", + "matlab:copper", + "PiYG", + "tol:PRGn", + "BrBG", + "PuOr", + "RdGy", + "vispy:RdBu", + "RdYlBu", + "RdYlGn", + "Spectral", + "coolwarm", + "bwr", + "seismic", + "berlin", + "vanimo", + "twilight", + "twilight_shifted", + "hsv", + "Pastel1", + "Pastel2", + "Paired", + "Accent", + "Dark2", + "Set1", + "Set2", + "Set3", + "tab10", + "tab20", + "tab20b", + "tab20c", + "flag", + "prism", + "gnuplot:ocean", + "gist_earth", + "terrain", + "gist_stern", + "gnuplot", + "gnuplot2", + "CMRmap", + "cubehelix", + "brg", + "gist_rainbow", + "yorick:rainbow", + "jet", + "turbo", + "nipy_spectral", + "gist_ncar", + ] +) SEQUENTIAL_CMAPS = list() QUALITATIVE_CMAPS = list() 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