Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

beginning base logic for interactivity impl #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
further changes and ideas
  • Loading branch information
clewis7 committed Dec 12, 2022
commit 10aeca8934ee8b7c67066d82050c68003ed15731
10 changes: 9 additions & 1 deletion 10 fastplotlib/graphics/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from fastplotlib.utils import get_colors, map_labels_to_colors

from abc import ABC, abstractmethod

class Graphic:
def __init__(
Expand Down Expand Up @@ -68,28 +69,35 @@ def __repr__(self):
else:
return f"fastplotlib.{self.__class__.__name__} @ {hex(id(self))}"

class Interaction:
class Interaction(ABC):
# make them abstract properties
@property
@abstractmethod
def indices(self) -> Any:
pass

@indices.setter
@abstractmethod
def indices(self, indices: Any):
pass

@property
@abstractmethod
def features(self) -> List[str]:
pass

@abstractmethod
def _set_feature(self, name: str, new_data: Any, indices: Any):
pass

clewis7 marked this conversation as resolved.
Show resolved Hide resolved
@abstractmethod
def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, target_feature: Any, target_data: Any, indices_mapper: Any):
# event occurs, causes change in feature of current graphic to data indices from pick_info,
# also causes change in target graphic to target feature at target data with corresponding or mapped
# indices based on the indice_mapper function

# events can be feature changes, when feature changes want to trigger an event

# indice mapper takes in source features and maps to target features
pass

Expand Down
22 changes: 21 additions & 1 deletion 22 fastplotlib/graphics/heatmap.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import numpy as np
import pygfx
from typing import *

from fastplotlib.graphics._base import Graphic

from .image import ImageGraphic

from ..utils import quick_min_max, get_cmap_texture

from ._base import Interaction


default_selection_options = {
"mode": "single",
Expand Down Expand Up @@ -40,7 +45,22 @@ def __init__(
self.callbacks = callbacks


class HeatmapGraphic(ImageGraphic):
class HeatmapGraphic(ImageGraphic, Interaction):
@property
def indices(self) -> Any:
pass

@property
def features(self) -> List[str]:
pass

def _set_feature(self, name: str, new_data: Any, indices: Any):
pass

def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, target_feature: Any, target_data: Any,
indices_mapper: Any):
pass

def __init__(
self,
data: np.ndarray,
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.