figpack 0.1.1__py3-none-any.whl → 0.1.3__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 (37) hide show
  1. figpack/__init__.py +3 -1
  2. figpack/cli.py +312 -0
  3. figpack/core/_bundle_utils.py +11 -1
  4. figpack/core/_show_view.py +34 -8
  5. figpack/core/{_upload_view.py → _upload_bundle.py} +140 -49
  6. figpack/core/figpack_view.py +32 -24
  7. figpack/figpack-gui-dist/assets/index-BDa2iJW9.css +1 -0
  8. figpack/figpack-gui-dist/assets/index-ByLxmrzp.js +846 -0
  9. figpack/figpack-gui-dist/assets/neurosift-logo-CLsuwLMO.png +0 -0
  10. figpack/figpack-gui-dist/index.html +4 -4
  11. figpack/spike_sorting/__init__.py +5 -0
  12. figpack/spike_sorting/views/AutocorrelogramItem.py +41 -0
  13. figpack/spike_sorting/views/Autocorrelograms.py +76 -0
  14. figpack/spike_sorting/views/CrossCorrelogramItem.py +45 -0
  15. figpack/spike_sorting/views/CrossCorrelograms.py +82 -0
  16. figpack/spike_sorting/views/UnitSimilarityScore.py +40 -0
  17. figpack/spike_sorting/views/UnitsTable.py +68 -0
  18. figpack/spike_sorting/views/UnitsTableColumn.py +40 -0
  19. figpack/spike_sorting/views/UnitsTableRow.py +36 -0
  20. figpack/spike_sorting/views/__init__.py +23 -0
  21. figpack/views/Image.py +82 -0
  22. figpack/views/Markdown.py +34 -0
  23. figpack/views/MatplotlibFigure.py +65 -0
  24. figpack/views/PlotlyFigure.py +58 -0
  25. figpack/views/__init__.py +4 -0
  26. figpack-0.1.3.dist-info/METADATA +126 -0
  27. figpack-0.1.3.dist-info/RECORD +38 -0
  28. figpack-0.1.3.dist-info/entry_points.txt +2 -0
  29. figpack-0.1.3.dist-info/top_level.txt +1 -0
  30. figpack/figpack-gui-dist/assets/index-BW-ONVCL.js +0 -65
  31. figpack/figpack-gui-dist/assets/index-CeWL3OeJ.css +0 -1
  32. figpack-0.1.1.dist-info/METADATA +0 -33
  33. figpack-0.1.1.dist-info/RECORD +0 -22
  34. figpack-0.1.1.dist-info/top_level.txt +0 -2
  35. figpack-gui/node_modules/flatted/python/flatted.py +0 -149
  36. {figpack-0.1.1.dist-info → figpack-0.1.3.dist-info}/WHEEL +0 -0
  37. {figpack-0.1.1.dist-info → figpack-0.1.3.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
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: figpack
3
+ Version: 0.1.3
4
+ Summary: A Python package for creating shareable, interactive visualizations in the browser
5
+ Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/magland/figpack
8
+ Project-URL: Repository, https://github.com/magland/figpack
9
+ Project-URL: Documentation, https://github.com/magland/figpack#readme
10
+ Project-URL: Bug Tracker, https://github.com/magland/figpack/issues
11
+ Keywords: visualization,plotting,timeseries,interactive
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering :: Visualization
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy
28
+ Requires-Dist: zarr
29
+ Requires-Dist: requests
30
+ Dynamic: license-file
31
+
32
+ # figpack
33
+
34
+ A Python package for creating shareable, interactive visualizations in the browser.
35
+
36
+ ## Overview
37
+
38
+ figpack enables you to create interactive data visualizations that can be displayed in a web browser and optionally shared online. The package focuses on timeseries data visualization with support for complex, nested layouts.
39
+
40
+ ### Key Features
41
+
42
+ - **Interactive timeseries graphs** with line series, markers, and interval plots
43
+ - **Flexible layout system** with boxes, splitters, and tab layouts
44
+ - **Web-based rendering** that works in any modern browser
45
+ - **Shareable visualizations** that can be uploaded and shared via URLs
46
+ - **Zarr-based data storage** for efficient handling of large datasets
47
+
48
+ ## Installation
49
+
50
+ Install figpack using pip:
51
+
52
+ ```bash
53
+ pip install figpack
54
+ ```
55
+
56
+ ## Quick Start
57
+
58
+ ```python
59
+ import numpy as np
60
+ import figpack.views as vv
61
+
62
+ # Create a timeseries graph
63
+ graph = vv.TimeseriesGraph(y_label="Signal")
64
+
65
+ # Add some data
66
+ t = np.linspace(0, 10, 1000)
67
+ y = np.sin(2 * np.pi * t)
68
+ graph.add_line_series(name="sine wave", t=t, y=y, color="blue")
69
+
70
+ # Display the visualization
71
+ graph.show(open_in_browser=True)
72
+ ```
73
+
74
+ ## Examples
75
+
76
+ See the `examples/` directory.
77
+
78
+ ## Usage Modes
79
+
80
+ ### Local Development
81
+
82
+ ```python
83
+ view.show(open_in_browser=True)
84
+ ```
85
+
86
+ ### Sharing Online
87
+
88
+ Set the `FIGPACK_UPLOAD_PASSCODE` environment variable and use:
89
+
90
+ ```python
91
+ view.show(upload=True, open_in_browser=True)
92
+ ```
93
+
94
+ ### Development Mode
95
+
96
+ Set `_dev=True` in the call to show() to enable development mode, which allows for live updates and debugging with figpack-gui.
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
+
120
+ ## License
121
+
122
+ Apache-2.0
123
+
124
+ ## Contributing
125
+
126
+ Visit the [GitHub repository](https://github.com/magland/figpack) for issues, contributions, and the latest updates.
@@ -0,0 +1,38 @@
1
+ figpack/__init__.py,sha256=-4qSEkw4VgfVncJfihv21PT13mZzoJFiU3Ou0Uoh3yo,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=qtQT4-zp172Zww9NhcSEKp14gKp_GjDqmNJmw9BB3Z8,486
9
+ figpack/figpack-gui-dist/assets/index-BDa2iJW9.css,sha256=9Zg_hJUZuEk-nNZZ7qun6pYlhUySqVDSal9YD8_2vHo,5499
10
+ figpack/figpack-gui-dist/assets/index-ByLxmrzp.js,sha256=ZCtm_eJW4Ahxf4I1BhCHkD3y85qTy_YKBwe8iphKFEM,1471141
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.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ figpack-0.1.3.dist-info/METADATA,sha256=ZxV-oO8uQRBNa5vyPtpEdvQOr-evnD86bb51mkVRWek,3508
35
+ figpack-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ figpack-0.1.3.dist-info/entry_points.txt,sha256=l6d3siH2LxXa8qJGbjAqpIZtI5AkMSyDeoRDCzdrUto,45
37
+ figpack-0.1.3.dist-info/top_level.txt,sha256=lMKGaC5xWmAYBx9Ac1iMokm42KFnJFjmkP2ldyvOo-c,8
38
+ figpack-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ figpack = figpack.cli:main
@@ -0,0 +1 @@
1
+ figpack