figpack 0.1.2__py3-none-any.whl → 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of figpack might be problematic. Click here for more details.

Files changed (30) hide show
  1. figpack/__init__.py +3 -1
  2. figpack/cli.py +312 -0
  3. figpack/figpack-gui-dist/assets/{index-BA_v5Jep.css → index-BDa2iJW9.css} +1 -1
  4. figpack/figpack-gui-dist/assets/index-Dw14QqeQ.js +846 -0
  5. figpack/figpack-gui-dist/index.html +2 -2
  6. figpack/spike_sorting/__init__.py +5 -0
  7. figpack/spike_sorting/views/AutocorrelogramItem.py +41 -0
  8. figpack/spike_sorting/views/Autocorrelograms.py +76 -0
  9. figpack/spike_sorting/views/CrossCorrelogramItem.py +45 -0
  10. figpack/spike_sorting/views/CrossCorrelograms.py +82 -0
  11. figpack/spike_sorting/views/UnitSimilarityScore.py +40 -0
  12. figpack/spike_sorting/views/UnitsTable.py +68 -0
  13. figpack/spike_sorting/views/UnitsTableColumn.py +40 -0
  14. figpack/spike_sorting/views/UnitsTableRow.py +36 -0
  15. figpack/spike_sorting/views/__init__.py +23 -0
  16. figpack/views/Image.py +82 -0
  17. figpack/views/Markdown.py +34 -0
  18. figpack/views/MatplotlibFigure.py +65 -0
  19. figpack/views/PlotlyFigure.py +58 -0
  20. figpack/views/__init__.py +4 -0
  21. {figpack-0.1.2.dist-info → figpack-0.1.4.dist-info}/METADATA +23 -1
  22. figpack-0.1.4.dist-info/RECORD +38 -0
  23. figpack-0.1.4.dist-info/entry_points.txt +2 -0
  24. figpack-0.1.4.dist-info/top_level.txt +1 -0
  25. figpack/figpack-gui-dist/assets/index-CMzZutX1.js +0 -78
  26. figpack-0.1.2.dist-info/RECORD +0 -23
  27. figpack-0.1.2.dist-info/top_level.txt +0 -2
  28. figpack-gui/node_modules/flatted/python/flatted.py +0 -149
  29. {figpack-0.1.2.dist-info → figpack-0.1.4.dist-info}/WHEEL +0 -0
  30. {figpack-0.1.2.dist-info → figpack-0.1.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,58 @@
1
+ """
2
+ PlotlyFigure view for figpack - displays plotly figures
3
+ """
4
+
5
+ import zarr
6
+ import json
7
+ import numpy as np
8
+ from typing import Union, Any, Dict
9
+ from datetime import datetime, date
10
+ from ..core.figpack_view import FigpackView
11
+
12
+
13
+ class CustomJSONEncoder(json.JSONEncoder):
14
+ """Custom JSON encoder that handles numpy arrays and datetime objects"""
15
+
16
+ def default(self, obj):
17
+ if isinstance(obj, np.ndarray):
18
+ return obj.tolist()
19
+ elif isinstance(obj, (np.integer, np.floating)):
20
+ return obj.item()
21
+ elif isinstance(obj, (datetime, date)):
22
+ return obj.isoformat()
23
+ elif isinstance(obj, np.datetime64):
24
+ return str(obj)
25
+ elif hasattr(obj, "isoformat"): # Handle other datetime-like objects
26
+ return obj.isoformat()
27
+ return super().default(obj)
28
+
29
+
30
+ class PlotlyFigure(FigpackView):
31
+ """
32
+ A plotly figure visualization component
33
+ """
34
+
35
+ def __init__(self, fig):
36
+ """
37
+ Initialize a PlotlyFigure view
38
+
39
+ Args:
40
+ fig: The plotly figure object
41
+ """
42
+ self.fig = fig
43
+
44
+ def _write_to_zarr_group(self, group: zarr.Group) -> None:
45
+ """
46
+ Write the plotly figure data to a Zarr group
47
+
48
+ Args:
49
+ group: Zarr group to write data into
50
+ """
51
+ # Set the view type
52
+ group.attrs["view_type"] = "PlotlyFigure"
53
+
54
+ # Convert the plotly figure to a dictionary
55
+ fig_dict = self.fig.to_dict()
56
+
57
+ # Store the figure data as JSON string using custom encoder
58
+ group.attrs["figure_data"] = json.dumps(fig_dict, cls=CustomJSONEncoder)
figpack/views/__init__.py CHANGED
@@ -4,3 +4,7 @@ from .Splitter import Splitter
4
4
  from .TabLayout import TabLayout
5
5
  from .LayoutItem import LayoutItem
6
6
  from .TabLayoutItem import TabLayoutItem
7
+ from .Markdown import Markdown
8
+ from .PlotlyFigure import PlotlyFigure
9
+ from .MatplotlibFigure import MatplotlibFigure
10
+ from .Image import Image
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A Python package for creating shareable, interactive visualizations in the browser
5
5
  Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
6
6
  License: Apache-2.0
@@ -95,6 +95,28 @@ view.show(upload=True, open_in_browser=True)
95
95
 
96
96
  Set `_dev=True` in the call to show() to enable development mode, which allows for live updates and debugging with figpack-gui.
97
97
 
98
+ ## Command Line Interface
99
+
100
+ figpack includes a command-line interface for working with figures:
101
+
102
+ ### Download a Figure
103
+
104
+ ```bash
105
+ figpack download <figure-url> <dest.tar.gz>
106
+ ```
107
+
108
+ Download a figure from any figpack URL and save it as a local archive.
109
+
110
+ ### View a Figure Archive
111
+
112
+ ```bash
113
+ figpack view <figure.tar.gz>
114
+ ```
115
+
116
+ Extract and view a figure archive in your browser. The server will run locally until you press Enter.
117
+
118
+ Use `--port <number>` to specify a custom port.
119
+
98
120
  ## License
99
121
 
100
122
  Apache-2.0
@@ -0,0 +1,38 @@
1
+ figpack/__init__.py,sha256=GYDxM_sUjRSTm7zjVogansvTyzzGlvcrWAZNCE71WtM,228
2
+ figpack/cli.py,sha256=QCyYeehyWL_TgenCWM86du1bIAMquaCBeGS5AwYa2Fc,10294
3
+ figpack/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ figpack/core/_bundle_utils.py,sha256=9_-xsswlzweJtr5JqZd0KjsCwlQVGNww02Fk6sz0pU4,1911
5
+ figpack/core/_show_view.py,sha256=AZbo1o9xaTXOMijWaMs6gigaHnt9Lgh_ST7ZS7bvTIE,4269
6
+ figpack/core/_upload_bundle.py,sha256=mja1vDGHfgQjmAkJoAUeUxzeZKPRi43KbSmaYZYComM,15303
7
+ figpack/core/figpack_view.py,sha256=N6MO8LpAU8sZlunOE9Ql1SO0JRWrOKuTkeDEFHD2ZFk,2092
8
+ figpack/figpack-gui-dist/index.html,sha256=0lKBupNwgcZhTvxa2232rygvJPSBTb5I2ah3y4LQltY,486
9
+ figpack/figpack-gui-dist/assets/index-BDa2iJW9.css,sha256=9Zg_hJUZuEk-nNZZ7qun6pYlhUySqVDSal9YD8_2vHo,5499
10
+ figpack/figpack-gui-dist/assets/index-Dw14QqeQ.js,sha256=eK6BPG6AVVyOXRDwVnKktmFShuzdsZoWjdqzVwlZQKA,1458532
11
+ figpack/figpack-gui-dist/assets/neurosift-logo-CLsuwLMO.png,sha256=g5m-TwrGh5f6-9rXtWV-znH4B0nHgc__0GWclRDLUHs,9307
12
+ figpack/spike_sorting/__init__.py,sha256=09njqh-oFaCTdZUsc4HAOFTliUYV9DClddfZ0Q_dm0I,61
13
+ figpack/spike_sorting/views/AutocorrelogramItem.py,sha256=921ZB9Na3XCWTXNelrJwcDjFnuCggXmt84N1GQfy4CI,1036
14
+ figpack/spike_sorting/views/Autocorrelograms.py,sha256=SarNMJeduI2XpSXP8ksODCH776xLyqwNSon443WMfzo,2299
15
+ figpack/spike_sorting/views/CrossCorrelogramItem.py,sha256=Mp00VzW8190kNcYluxcEWDP8neMKc1hEYA3ButmkX5E,1226
16
+ figpack/spike_sorting/views/CrossCorrelograms.py,sha256=gnHjFAFKxr-1UNmfQvPKB18yYkgrkKcYbCryqv-QtA4,2715
17
+ figpack/spike_sorting/views/UnitSimilarityScore.py,sha256=cJA9MkETos9qHhV1tqgA7SfNEaPo-duXYCE76hSFGnA,948
18
+ figpack/spike_sorting/views/UnitsTable.py,sha256=bs6l6olgunMvqyXkXhh1ooBBlD4P70AajkDSyMsexFM,2171
19
+ figpack/spike_sorting/views/UnitsTableColumn.py,sha256=zBnuoeILTuiVLDvtcOxqa37E5WlbR12rlwNJUeWXxY4,847
20
+ figpack/spike_sorting/views/UnitsTableRow.py,sha256=s0UNar7bai3Uz7ufZi3XgAkhxPqW0i8H3F3-_HMBvwU,720
21
+ figpack/spike_sorting/views/__init__.py,sha256=L-r9JCTwPjiwPxKLurTFNecAXDfIXcAASUmy0FrHMr4,630
22
+ figpack/views/Box.py,sha256=6o39JWSls2UscnNFQZXWr_15hdIOCnhanOQgbqMWfVU,2005
23
+ figpack/views/Image.py,sha256=hDW-brx36SyxFTXjA0A_-BGJ0BTVsMg63wGGn37vM9Y,2718
24
+ figpack/views/LayoutItem.py,sha256=XOdvyF9S_Ij1IwxIYOqt4Wk9_wddWTSoM2x5W4kZqTQ,1594
25
+ figpack/views/Markdown.py,sha256=ytwfwygAIuvitV_v-S2IPIJqIFXKTCGHu6EwtRJ8CIU,768
26
+ figpack/views/MatplotlibFigure.py,sha256=hBONRqtfkyO7e47wgFBOo29GLPMk_6VgL6N0H-uQFiU,1937
27
+ figpack/views/PlotlyFigure.py,sha256=Kdn9mGqBO3E2nCta7j7Nohaob3xjOqIS6p-8XSW4vIc,1631
28
+ figpack/views/Splitter.py,sha256=E0mek7RgXtgxdGpFM0evCLtplGwAd70EMfmXX0pcd4o,2005
29
+ figpack/views/TabLayout.py,sha256=d2x2zWGKYdvukW14HOCiU-9C7-N1ED-a1HrRIpSM6Jg,1896
30
+ figpack/views/TabLayoutItem.py,sha256=dvNCdPcRDaDr8LDd8D3zfMudQFbkiAMF0Z7XVcpIhLM,879
31
+ figpack/views/TimeseriesGraph.py,sha256=de85xUz22CeQxslXds5tbTJaZ_tyJlXs5GPPEB-8Fh4,7468
32
+ figpack/views/__init__.py,sha256=fb3k4hiFMfhS5zNPIlQTZJhqFT_v-6bSuPlCpqIpuEk,348
33
+ figpack-0.1.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ figpack-0.1.4.dist-info/METADATA,sha256=FwqHbx9i1bBohTiiybMi8dQTeihJypg6mdplrtJfxts,3508
35
+ figpack-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ figpack-0.1.4.dist-info/entry_points.txt,sha256=l6d3siH2LxXa8qJGbjAqpIZtI5AkMSyDeoRDCzdrUto,45
37
+ figpack-0.1.4.dist-info/top_level.txt,sha256=lMKGaC5xWmAYBx9Ac1iMokm42KFnJFjmkP2ldyvOo-c,8
38
+ figpack-0.1.4.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ figpack = figpack.cli:main
@@ -0,0 +1 @@
1
+ figpack