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

Graphic features refactor #511

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

Merged
merged 197 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from 195 commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
60e7f60
just a start
kushalkolar Apr 3, 2024
6eec7d5
pushing to continue on my desktop
kushalkolar May 17, 2024
0249125
progress on buffer manager cleanup_key
kushalkolar May 17, 2024
9d891ee
more progress, still lots to do
kushalkolar May 17, 2024
9635bc0
slicing working with PointsDataFeature, negative slices too, still ma…
kushalkolar May 18, 2024
9be017c
comitting stuff
kushalkolar May 18, 2024
0491f8c
_update_range() is pretty good now
kushalkolar May 18, 2024
97b7303
comment
kushalkolar May 18, 2024
4585be2
if statement
kushalkolar May 18, 2024
261a5a9
simply colors setting
kushalkolar May 20, 2024
5d40af8
type annotation
kushalkolar May 20, 2024
697d50e
simpler slice parsing
kushalkolar May 20, 2024
08fd17d
remove cleanup_key :D :D :D git status!
kushalkolar May 20, 2024
a45651d
all fancy and negative indexing working :D
kushalkolar May 20, 2024
9612d60
start tests
kushalkolar May 20, 2024
dda8396
exception message
kushalkolar May 20, 2024
e22fe7c
more on tests
kushalkolar May 20, 2024
9b4082f
refactor sizes, not tested yet
kushalkolar May 20, 2024
2a1869c
start parameterizing buffer tests
kushalkolar May 21, 2024
29a0a76
better buffer tests
kushalkolar May 21, 2024
054c836
more variants
kushalkolar May 21, 2024
f50614f
add array fancy indexing to same parameterization
kushalkolar May 21, 2024
9ed2bf6
parameterize tuple tests
kushalkolar May 21, 2024
5e1471e
remove repr
kushalkolar May 21, 2024
f59fb19
test offset and size
kushalkolar May 21, 2024
4d25daa
test offset and size
kushalkolar May 21, 2024
aa1949b
test create colors
kushalkolar May 21, 2024
c74d7b9
also test with direct truth indices in colors
kushalkolar May 21, 2024
cecb438
points tests, works
kushalkolar May 21, 2024
0a20008
remove imports
kushalkolar May 21, 2024
a1c8c87
sizes test working, other cleanup
kushalkolar May 21, 2024
db93f70
export sizes feature again
kushalkolar May 21, 2024
baca1fc
ideas for sharing and unsharing buffers between graphics
kushalkolar May 21, 2024
a177a7f
ideas for sharing and unsharing buffers between graphics, nto tested
kushalkolar May 21, 2024
c205b10
typing
kushalkolar May 21, 2024
f380b26
attach and detach buffers to a graphic, not tested
kushalkolar May 21, 2024
3585c9e
import
kushalkolar May 21, 2024
8d32134
more int point tests
kushalkolar May 21, 2024
deceeeb
Graphic.add_event_handler
kushalkolar May 21, 2024
66b5e6d
adding and removing data feature event works and tested
kushalkolar May 22, 2024
3a58feb
common features, WIP
kushalkolar May 22, 2024
adcc13f
regular features and refactor line and scatter into positions graphic
kushalkolar May 22, 2024
762fcbb
uniform sizes
kushalkolar May 22, 2024
3017b7e
implement sizes and uniform size for scatter
kushalkolar May 22, 2024
a45b3f9
VertexCmap feature, not yet tested
kushalkolar May 22, 2024
09ce4f5
start image features, not tested, add thickness, not tested
kushalkolar May 22, 2024
93e7a9d
better cmap parsing
kushalkolar May 23, 2024
2be22f6
cleanup
kushalkolar May 23, 2024
eedee8f
image features
kushalkolar May 23, 2024
67ad327
cleanup
kushalkolar May 23, 2024
b417190
start selection feature refactor
kushalkolar May 23, 2024
eb47408
more on selection features
kushalkolar May 23, 2024
ab80033
offset and rotation for base graphic
kushalkolar May 25, 2024
da433de
feature event table
kushalkolar May 25, 2024
d12d4fa
position feature event tables
kushalkolar May 25, 2024
570683a
rotation and offset features
kushalkolar May 25, 2024
ec6b2f4
work on selectors, WIP, linear region selector inits properly and mov…
kushalkolar May 25, 2024
db910d3
proper centering
kushalkolar May 25, 2024
a09386b
much simpliified and better linear region selector
kushalkolar May 26, 2024
49c2108
linear region selector works well on x axis with events and data sele…
kushalkolar May 26, 2024
1ec0f40
vertex cmap fix, delete synchronizer
kushalkolar May 26, 2024
5022753
linear selector works
kushalkolar May 26, 2024
f295356
cleanup
kushalkolar May 26, 2024
4d4d636
update graphic methods mixin
kushalkolar May 26, 2024
1d6adc6
update selector example nbs, still WIP
kushalkolar May 26, 2024
284a1db
type annotation in setter
kushalkolar May 29, 2024
b4fe957
add notes to tests comments
kushalkolar May 31, 2024
e6b9133
refactor image stuff
kushalkolar Jun 4, 2024
820772d
image selector tool
kushalkolar Jun 4, 2024
254f0ba
return selectors as proxies
kushalkolar Jun 4, 2024
2bf33fa
image stuff works
kushalkolar Jun 4, 2024
67404ca
fix offsets adding graphics, fix positions_graphic cmap bug, quicksta…
kushalkolar Jun 4, 2024
b1b297d
fix add_graphic args and mixin
kushalkolar Jun 4, 2024
74f8428
simpler graphic collection stuff
kushalkolar Jun 4, 2024
6eb5a1a
more line collection
kushalkolar Jun 4, 2024
f543e4a
remove old events system
clewis7 Jun 4, 2024
aa1e974
fix some examples
clewis7 Jun 4, 2024
aa324df
remove lingering older interaction stuff
kushalkolar Jun 4, 2024
00ba47f
cleanup
kushalkolar Jun 4, 2024
233dab7
fill color arg
kushalkolar Jun 4, 2024
4da827c
black
kushalkolar Jun 4, 2024
d785b92
update examples
clewis7 Jun 4, 2024
3a424d2
fix image tiling, better heatmap example
kushalkolar Jun 4, 2024
9157048
Merge branch 'graphic-features-refactor' of https://github.com/fastpl…
kushalkolar Jun 4, 2024
87c8d9d
update hm examples
kushalkolar Jun 4, 2024
d99a94b
fix hlut
clewis7 Jun 4, 2024
fb1dde6
refactor graphics base
kushalkolar Jun 4, 2024
428aab0
update line examples
kushalkolar Jun 4, 2024
a41432f
bug fixes
kushalkolar Jun 5, 2024
0eb6ad4
update text to use new gfeatures
kushalkolar Jun 6, 2024
739b47a
cleanup
kushalkolar Jun 6, 2024
ce8082d
implement iterator for TextureArray, much simpler now :D
kushalkolar Jun 6, 2024
f141d23
basic texture tests
kushalkolar Jun 6, 2024
1f76224
bugfix, cleanup
kushalkolar Jun 6, 2024
273962f
image graphic tests
kushalkolar Jun 6, 2024
61db941
type annot
kushalkolar Jun 6, 2024
aafa452
test stuff
kushalkolar Jun 6, 2024
fa4b2ac
tests for common and visible kwarg for Graphic
kushalkolar Jun 6, 2024
2c6843b
bugfix
kushalkolar Jun 6, 2024
9ca2c2a
test remove event hanlders common fea
kushalkolar Jun 7, 2024
72824eb
rename
kushalkolar Jun 7, 2024
105cd86
start test positions graphics
kushalkolar Jun 7, 2024
feabe7a
test progress
kushalkolar Jun 7, 2024
c82b90c
black
kushalkolar Jun 7, 2024
2810578
add __len__ to buffer managers, add __array_interface__ raises error
kushalkolar Jun 7, 2024
4d07e4f
TextureArray has len()
kushalkolar Jun 7, 2024
84c0be9
docstring
kushalkolar Jun 7, 2024
ed686dd
updates and tests
kushalkolar Jun 7, 2024
8d57c50
black
kushalkolar Jun 7, 2024
f01811a
uniform colors tests and bug fix
kushalkolar Jun 7, 2024
59b5550
black
kushalkolar Jun 7, 2024
cd40638
bugfix uniform color and sizes
kushalkolar Jun 7, 2024
10ba958
sizes and thickness tests
kushalkolar Jun 7, 2024
e99010e
tests update
kushalkolar Jun 7, 2024
3acabe3
lotta team work
clewis7 Jun 7, 2024
072fd91
docstring, small things
kushalkolar Jun 8, 2024
2972e84
rename UniformSizes -> UniformSize
kushalkolar Jun 8, 2024
e07cbe8
update graphic methods mixin
kushalkolar Jun 8, 2024
f3a8f95
update graphic methods mixin
kushalkolar Jun 8, 2024
06408a6
bugfix
kushalkolar Jun 8, 2024
a2f2e6f
test data slice for positiosn graphics
kushalkolar Jun 8, 2024
71c06e0
test colors property within buffer tests
kushalkolar Jun 8, 2024
b5e9f2c
cleanup
kushalkolar Jun 8, 2024
d12bf4d
emit user key not parsed key
kushalkolar Jun 8, 2024
3baaa95
rename cmap_values to transform
kushalkolar Jun 9, 2024
255183b
cmap_values -> cmap_transform in mixin
kushalkolar Jun 9, 2024
7392628
test graphics in vertex data buffer manager tests
kushalkolar Jun 9, 2024
612adc5
cmap transform tests
kushalkolar Jun 9, 2024
9a27cb7
make Graphic._features private, add Graphic.events property
kushalkolar Jun 9, 2024
fbfca0b
color events tests
kushalkolar Jun 9, 2024
7c3520f
move data slice test to just buffer tests
kushalkolar Jun 9, 2024
c127fe7
data events tests
kushalkolar Jun 9, 2024
18f7035
cleanup
kushalkolar Jun 9, 2024
96065b7
cleanup, remove old histogram graphic
kushalkolar Jun 9, 2024
444eed0
text changes and tests
kushalkolar Jun 9, 2024
44d7286
texture array tests with graphic
kushalkolar Jun 9, 2024
080d8ae
image graphic tests
kushalkolar Jun 9, 2024
51db9dd
update image features
kushalkolar Jun 9, 2024
1d3c111
black
kushalkolar Jun 9, 2024
252b8bb
append data and world xy for graphic pointer events
kushalkolar Jun 9, 2024
197a64f
black
kushalkolar Jun 9, 2024
b0d20f6
move constructor to top
kushalkolar Jun 9, 2024
9f92ab7
example tests for wide and square hm
kushalkolar Jun 9, 2024
613cc68
update ci
kushalkolar Jun 9, 2024
12a0060
fix message
kushalkolar Jun 9, 2024
49ffefd
update examples
kushalkolar Jun 9, 2024
01e0371
bugfix, docstrings
kushalkolar Jun 9, 2024
6ad1802
docstrings, exception messages
kushalkolar Jun 9, 2024
44fc961
update api docs
kushalkolar Jun 9, 2024
4f1f400
apparently we use __all__ in graphics to generate api docs
kushalkolar Jun 9, 2024
82ec4b4
remove nbsphinx
kushalkolar Jun 9, 2024
8f72fe5
bump version
kushalkolar Jun 9, 2024
183440a
docstring
kushalkolar Jun 9, 2024
bb6d6b5
finish up line collection
clewis7 Jun 10, 2024
9df7574
fix adding line selector to line collection
clewis7 Jun 10, 2024
04eeb10
finish line collection
kushalkolar Jun 11, 2024
72e54ee
update line collection examples
kushalkolar Jun 11, 2024
3ce055e
graphic collections are now iterables, add examples for setting prope…
kushalkolar Jun 11, 2024
acd743c
3d line stack example with animation
kushalkolar Jun 11, 2024
ce078c6
fix line collection cmap with additional args
kushalkolar Jun 11, 2024
4c69ab6
black
kushalkolar Jun 11, 2024
c2f647d
update kwargs for line collection because of mixin
kushalkolar Jun 11, 2024
6d9cf62
add numpy.integer check for buffermanager parse slice
kushalkolar Jun 11, 2024
7525209
rename
kushalkolar Jun 11, 2024
0380ea9
docstrings
kushalkolar Jun 11, 2024
43a9f8d
line linear selector init logic
kushalkolar Jun 11, 2024
cc2b92b
fix line collection init selectors
kushalkolar Jun 11, 2024
c8bf515
fix selector
kushalkolar Jun 11, 2024
67dfd00
add plot area hook for collections
kushalkolar Jun 11, 2024
ea3cb02
docstring
kushalkolar Jun 11, 2024
f8518ee
update selector nbs
kushalkolar Jun 11, 2024
b379282
update example nb
kushalkolar Jun 11, 2024
7eba849
update nb
kushalkolar Jun 11, 2024
7280cf1
cleanup
kushalkolar Jun 11, 2024
933a3e8
update nb
kushalkolar Jun 11, 2024
3a53ac4
update nbs
kushalkolar Jun 11, 2024
a634907
feature is private class attr
kushalkolar Jun 11, 2024
a8d350a
fix
kushalkolar Jun 11, 2024
b6665f8
remove anim example from screenshot tests
kushalkolar Jun 11, 2024
2e8e612
update screenshots
kushalkolar Jun 11, 2024
af6ab4f
update screenshot
kushalkolar Jun 11, 2024
47cecfa
update CONTRIBUTING
kushalkolar Jun 11, 2024
3079fa6
smaller hm data test for CI
kushalkolar Jun 11, 2024
d719ad6
exclude heatmap change data from tests, too large RAM usage probably
kushalkolar Jun 11, 2024
e63043c
black
kushalkolar Jun 11, 2024
06a489f
change dtype to save ram usage for CI
kushalkolar Jun 11, 2024
b524799
remove large square heatmap from screenshot tests
kushalkolar Jun 11, 2024
fc5160e
black
kushalkolar Jun 11, 2024
2c6d0ca
disable all but one hm test
kushalkolar Jun 11, 2024
3fd7734
fix gc
kushalkolar Jun 11, 2024
24b5d95
update screenshots
kushalkolar Jun 11, 2024
25876bf
replace one more test image
kushalkolar Jun 11, 2024
eb83cfd
fix docs
kushalkolar Jun 11, 2024
8696d32
update image screenshots
kushalkolar Jun 12, 2024
70ca7c7
fix docs
kushalkolar Jun 12, 2024
28e08b9
docstrings, Graphic.events -> Graphic.supported_events
kushalkolar Jun 13, 2024
d610690
update docs
kushalkolar Jun 16, 2024
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
16 changes: 14 additions & 2 deletions 16 .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
name: Lint

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
lint:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
src: "./fastplotlib"
src: "./fastplotlib"
1 change: 1 addition & 0 deletions 1 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
docs-build:
name: Docs
runs-on: bigmem
if: ${{ !github.event.pull_request.draft }}
strategy:
fail-fast: false
steps:
Expand Down
43 changes: 23 additions & 20 deletions 43 CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,37 @@ keeps a *private* global dictionary of all `WorldObject` instances and users are
This is due to garbage collection. This may be quite complicated for beginners, for more details see this PR: https://github.com/fastplotlib/fastplotlib/pull/160 .
If you are curious or have more questions on garbage collection in fastplotlib you're welcome to post an issue :D.

#### Graphic Features
#### Graphic properties

There is one important thing that `fastplotlib` uses which we call "graphic features".
Graphic properties are all evented, and internally we called these "graphic features". They are the various
aspects of a graphic that the user can change.
The "graphic features" subpackage can be found at `fastplotlib/graphics/_features`. As we can see this
is a private subpackage and never meant to be accessible to users. In `fastplotlib` "graphic features" are the various
aspects of a graphic that the user can change. Users can also run callbacks whenever a graphic feature changes.
is a private subpackage and never meant to be accessible to users..

##### LineGraphic

For example let's look at `LineGraphic` in `fastplotlib/graphics/line.py`. Every graphic has a class variable called
`feature_events` which is a set of all graphic features. It has the following graphic features: "data", "colors", "cmap", "thickness", "present".
`_features` which is a set of all graphic properties that are evented. It has the following evented properties:
`"data", "colors", "cmap", "thickness"` in addition to properties common to all graphics, such as `"name", "offset", "rotation", and "visible"`

Now look at the constructor for `LineGraphic`, it first creates an instance of `PointsDataFeature`. This is basically a
class that wraps the positions buffer, the vertex positions that define the line, and provides additional useful functionality.
For example, every time that the `data` is changed event handlers will be called (if any event handlers are registered).
Now look at the constructor for the `LineGraphic` base class `PositionsGraphic`, it first creates an instance of `VertexPositions`.
This is a class that manages vertex positions buffer. It defines the line, and provides additional useful functionality.
For example, every time that the `data` is changed, the new data will be marked for upload to the GPU before the next draw.
In addition, event handlers will be called if any event handlers are registered.

`ColorFeature`behaves similarly, but it can perform additional parsing that can create the colors buffer from different forms of user input. For example if a user runs:
`line_graphic.colors = "blue"`, then `ColorFeature.__setitem__()` will create a buffer that corresponds to what `pygfx.Color` thinks is "blue".
Users can also take advantage of fancy indexing, ex: `line_graphics.colors[bool_array] = "red"` :smile:
`VertexColors`behaves similarly, but it can perform additional parsing that can create the colors buffer from different
forms of user input. For example if a user runs: `line_graphic.colors = "blue"`, then `VertexColors.__setitem__()` will
create a buffer that corresponds to what `pygfx.Color` thinks is "blue". Users can also take advantage of fancy indexing,
ex: `line_graphics.colors[bool_array] = "red"` :smile:

`LineGraphic` also has a `CmapFeature`, this is a subclass of `ColorFeature` which can parse colormaps, for example:
`LineGraphic` also has a `VertexCmap`, this manages the line `VertexColors` instance to parse colormaps, for example:
`line_graphic.cmap = "jet"` or even `line_graphic.cmap[50:] = "viridis"`.

`LineGraphic` also has `ThicknessFeature` which is pretty simple, `PresentFeature` which indicates if a graphic is
currently in the scene, and `DeletedFeature` which is useful if you need callbacks to indicate that the graphic has been
deleted (for example, removing references to a graphic from a legend).
`LineGraphic` also has a `thickness` property which is pretty simple, and `DeletedFeature` which is useful if you need
callbacks to indicate that the graphic has been deleted (for example, removing references to a graphic from a legend).

Other graphics have graphic features that are relevant to them, for example `ImageGraphic` has a `cmap` feature which is
unique to images or heatmaps.
Other graphics have properties that are relevant to them, for example `ImageGraphic` has `cmap`, `vmin`, `vmax`,
properties unique to images.

#### Selectors

Expand Down Expand Up @@ -192,9 +194,10 @@ the subplots. All subplots within a `Figure` share the same canvas and use diffe

## Tests in detail

The CI pipeline for a plotting library that is supposed to produce things that "look visually correct". Each example
within the `examples` dir is run and an image of the canvas is taken and compared with a ground-truth
screenshot that we have manually inspected. Ground-truth image are stored using `git-lfs`.
Backend tests are in `tests/`, in addition as a plotting library CI pipeline produces things that
"look visually correct". Each example within the `examples` dir is run and an image of the canvas
is taken and compared with a ground-truth screenshot that we have manually inspected.
Ground-truth image are stored using `git-lfs`.

The ground-truth images are in:

Expand Down
7 changes: 4 additions & 3 deletions 7 docs/source/api/gpu.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fastplotlib.utils
*****************
fastplotlib.utils.gpu
*********************

.. automodule:: fastplotlib.utils.gpu
.. currentmodule:: fastplotlib.utils.gpu
.. automodule:: fastplotlib
:members:
36 changes: 0 additions & 36 deletions 36 docs/source/api/graphic_features/CmapFeature.rst

This file was deleted.

34 changes: 0 additions & 34 deletions 34 docs/source/api/graphic_features/ColorFeature.rst

This file was deleted.

2 changes: 2 additions & 0 deletions 2 docs/source/api/graphic_features/Deleted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Properties
.. autosummary::
:toctree: Deleted_api

Deleted.value

Methods
~~~~~~~
Expand All @@ -30,4 +31,5 @@ Methods
Deleted.block_events
Deleted.clear_event_handlers
Deleted.remove_event_handler
Deleted.set_value

29 changes: 0 additions & 29 deletions 29 docs/source/api/graphic_features/FeatureEvent.rst

This file was deleted.

35 changes: 35 additions & 0 deletions 35 docs/source/api/graphic_features/FontSize.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. _api.FontSize:

FontSize
********

========
FontSize
========
.. currentmodule:: fastplotlib.graphics._features

Constructor
~~~~~~~~~~~
.. autosummary::
:toctree: FontSize_api

FontSize

Properties
~~~~~~~~~~
.. autosummary::
:toctree: FontSize_api

FontSize.value

Methods
~~~~~~~
.. autosummary::
:toctree: FontSize_api

FontSize.add_event_handler
FontSize.block_events
FontSize.clear_event_handlers
FontSize.remove_event_handler
FontSize.set_value

33 changes: 0 additions & 33 deletions 33 docs/source/api/graphic_features/GraphicFeature.rst

This file was deleted.

34 changes: 0 additions & 34 deletions 34 docs/source/api/graphic_features/GraphicFeatureIndexable.rst

This file was deleted.

37 changes: 0 additions & 37 deletions 37 docs/source/api/graphic_features/HeatmapCmapFeature.rst

This file was deleted.

Loading
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.