emg-gui 0.0.5__tar.gz

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.
Files changed (39) hide show
  1. emg_gui-0.0.5/LICENSE.md +24 -0
  2. emg_gui-0.0.5/PKG-INFO +206 -0
  3. emg_gui-0.0.5/README.md +174 -0
  4. emg_gui-0.0.5/pyproject.toml +48 -0
  5. emg_gui-0.0.5/src/emg_gui/__init__.py +0 -0
  6. emg_gui-0.0.5/src/emg_gui/acquisition/__init__.py +0 -0
  7. emg_gui-0.0.5/src/emg_gui/acquisition/data_source.py +384 -0
  8. emg_gui-0.0.5/src/emg_gui/acquisition/dataset_files.py +20 -0
  9. emg_gui-0.0.5/src/emg_gui/acquisition/sensor_worker.py +108 -0
  10. emg_gui-0.0.5/src/emg_gui/app.py +21 -0
  11. emg_gui-0.0.5/src/emg_gui/config/Roboto-Black.ttf +0 -0
  12. emg_gui-0.0.5/src/emg_gui/config/__init__.py +0 -0
  13. emg_gui-0.0.5/src/emg_gui/config/constants.py +17 -0
  14. emg_gui-0.0.5/src/emg_gui/core/__init__.py +0 -0
  15. emg_gui-0.0.5/src/emg_gui/core/enums.py +28 -0
  16. emg_gui-0.0.5/src/emg_gui/core/logger.py +50 -0
  17. emg_gui-0.0.5/src/emg_gui/core/types.py +5 -0
  18. emg_gui-0.0.5/src/emg_gui/processing/__init__.py +0 -0
  19. emg_gui-0.0.5/src/emg_gui/processing/filter.py +44 -0
  20. emg_gui-0.0.5/src/emg_gui/processing/window_functions.py +16 -0
  21. emg_gui-0.0.5/src/emg_gui/ui/__init__.py +0 -0
  22. emg_gui-0.0.5/src/emg_gui/ui/control_panel.py +84 -0
  23. emg_gui-0.0.5/src/emg_gui/ui/window.py +95 -0
  24. emg_gui-0.0.5/src/emg_gui/visualizer/__init__.py +0 -0
  25. emg_gui-0.0.5/src/emg_gui/visualizer/open_gl_widget.py +139 -0
  26. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/__init__.py +0 -0
  27. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/shader_loader.py +26 -0
  28. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/spec/fragment.glsl +9 -0
  29. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/spec/vertex.glsl +13 -0
  30. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/text/fragment.glsl +13 -0
  31. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/text/vertex.glsl +13 -0
  32. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/ticks/fragment.glsl +8 -0
  33. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/ticks/vertex.glsl +9 -0
  34. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/time_series/fragment.glsl +8 -0
  35. emg_gui-0.0.5/src/emg_gui/visualizer/shaders/time_series/vertex.glsl +8 -0
  36. emg_gui-0.0.5/src/emg_gui/visualizer/spectrogram_renderer.py +175 -0
  37. emg_gui-0.0.5/src/emg_gui/visualizer/text_renderer.py +172 -0
  38. emg_gui-0.0.5/src/emg_gui/visualizer/ticks_renderer.py +77 -0
  39. emg_gui-0.0.5/src/emg_gui/visualizer/time_series_renderer.py +144 -0
@@ -0,0 +1,24 @@
1
+ # License
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2026 Nikhil Pareek
6
+ Contact: [nikhilpareek149@gmail.com](mailto:nikhilpareek149@gmail.com)
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
emg_gui-0.0.5/PKG-INFO ADDED
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: emg-gui
3
+ Version: 0.0.5
4
+ Summary:
5
+ License-File: LICENSE.md
6
+ Author: Nikhil Pareek
7
+ Author-email: nikhilpareek149@gmail.com
8
+ Maintainer: Nikhil Pareek
9
+ Maintainer-email: nikhilpareek149@gmail.com
10
+ Requires-Python: ==3.12.10
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Dist: PyQt5 (==5.15.11)
13
+ Requires-Dist: PyQt5-Qt5 (==5.15.19) ; sys_platform != "win32"
14
+ Requires-Dist: PyQt5-Qt5 (==5.15.2) ; sys_platform == "win32"
15
+ Requires-Dist: PyQt5-sip (==12.17.1)
16
+ Requires-Dist: brainflow (==5.16.0)
17
+ Requires-Dist: dvg-ringbuffer (==1.1.0)
18
+ Requires-Dist: freetype-py (==2.5.1)
19
+ Requires-Dist: librosa (==0.11.0)
20
+ Requires-Dist: matplotlib (==3.9.4)
21
+ Requires-Dist: moderngl (==5.12.0)
22
+ Requires-Dist: numpy (==1.26.4)
23
+ Requires-Dist: pyrr (==0.10.3)
24
+ Requires-Dist: pyserial (==3.5)
25
+ Requires-Dist: setuptools (==80.10.2)
26
+ Requires-Dist: typing-extensions (==4.16.0)
27
+ Project-URL: Documentation, https://pareeknikhil.github.io/
28
+ Project-URL: Homepage, https://github.com/pareeknikhil/emg-gui
29
+ Project-URL: Issues, https://github.com/pareeknikhil/emg-gui/issues
30
+ Description-Content-Type: text/markdown
31
+
32
+ # <img src="docs/diagrams/Ability_Logomark.svg" alt="Ability logomark" width="48" align="absmiddle"> emg-gui
33
+
34
+ ## 1. Overview
35
+
36
+ ### 1.1 Introduction
37
+
38
+ A real-time visual engine for acquiring, recording, and exploring raw and filtered EMG signals.
39
+
40
+ ### 1.2 Installation
41
+
42
+ EMG-GUI can be installed from pypi using pip:
43
+
44
+ ```bash
45
+ pip install emg-gui
46
+ ```
47
+
48
+ ### 1.3 How to Run
49
+
50
+ TODO
51
+
52
+ ---
53
+
54
+ ## 2. Architecture and Project Structure
55
+
56
+ ### 2.1 Architecture
57
+
58
+ The application separates sensor acquisition, interface controls, signal
59
+ processing, and GPU rendering. Sensor polling and board stream control run on a
60
+ dedicated thread, while Qt interface updates, filtering, and ModernGL rendering
61
+ currently run on the main thread.
62
+
63
+ ```text
64
+ EMG GUI
65
+ ├── app.py
66
+ ├── Acquisition
67
+ │ ├── DataSource
68
+ │ └── SensorWorker
69
+ │ └── RingBuffer
70
+ ├── UI
71
+ │ ├── EMGVisualizerWindow
72
+ │ └── EMGControlPanel
73
+ ├── Processing
74
+ │ ├── EMG filtering
75
+ │ └── Window functions
76
+ └── Visualization
77
+ ├── EMGOpenGLWidget
78
+ ├── TimeSeriesRenderer
79
+ ├── SpectrogramRenderer
80
+ ├── TicksRenderer
81
+ └── TextRenderer
82
+ ```
83
+
84
+ The `DataSource` provides hardware-independent acquisition from either an
85
+ OpenBCI board or a playback recording. The current application entry point uses
86
+ `OpenBCIBoard` by default, with playback available as an alternate source.
87
+ `SensorWorker` reads EMG samples into a fixed-size ring buffer, and
88
+ `EMGOpenGLWidget` owns duplicate-snapshot checks, snapshot filtering, and
89
+ ModernGL rendering. `TimeSeriesRenderer` and `SpectrogramRenderer` are connected
90
+ to the live rendering path. Channel counts come from the selected data source,
91
+ so synthetic and real boards can expose different numbers of EMG channels. The
92
+ display window is sample-based, while the rendered layout is derived from the
93
+ OpenGL widget size and the selected EMG channel count.
94
+
95
+ See the [architecture guide](docs/architecture.md) for the detailed component
96
+ hierarchy, data flow, and thread interaction sequences.
97
+
98
+ ### 2.2 Directory Layout
99
+
100
+ Inside this project, you'll see the following folders and files:
101
+
102
+ ```text
103
+ /
104
+ ├── docs/
105
+ │ ├── diagrams/
106
+ │ │ ├── Ability_Logo.svg
107
+ │ │ └── interface-contracts.svg
108
+ │ └── architecture.md
109
+ ├── src/
110
+ │ └── emg_gui/
111
+ │ ├── app.py
112
+ │ ├── acquisition/
113
+ │ │ ├── data_source.py
114
+ │ │ ├── dataset_files.py
115
+ │ │ └── sensor_worker.py
116
+ │ ├── config/
117
+ │ │ ├── constants.py
118
+ │ │ └── Roboto-Black.ttf
119
+ │ ├── core/
120
+ │ │ ├── enums.py
121
+ │ │ ├── logger.py
122
+ │ │ └── types.py
123
+ │ ├── processing/
124
+ │ │ ├── filter.py
125
+ │ │ └── window_functions.py
126
+ │ ├── ui/
127
+ │ │ ├── control_panel.py
128
+ │ │ └── window.py
129
+ │ └── visualizer/
130
+ │ ├── shaders/
131
+ │ │ ├── shader_loader.py
132
+ │ │ ├── spec/
133
+ │ │ │ ├── vertex.glsl
134
+ │ │ │ └── fragment.glsl
135
+ │ │ ├── text/
136
+ │ │ │ ├── vertex.glsl
137
+ │ │ │ └── fragment.glsl
138
+ │ │ ├── ticks/
139
+ │ │ │ ├── vertex.glsl
140
+ │ │ │ └── fragment.glsl
141
+ │ │ └── time_series/
142
+ │ │ ├── vertex.glsl
143
+ │ │ └── fragment.glsl
144
+ │ ├── open_gl_widget.py
145
+ │ ├── spectrogram_renderer.py
146
+ │ ├── text_renderer.py
147
+ │ ├── ticks_renderer.py
148
+ │ └── time_series_renderer.py
149
+ ├── tests/
150
+ ├── CONTRIBUTING.md
151
+ ├── pyproject.toml
152
+ └── README.md
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 3. Contributing
158
+
159
+ Contributions are welcome. See the [contributing guide](CONTRIBUTING.md) for
160
+ development and linting guidelines.
161
+
162
+ ---
163
+
164
+ ## 4. Acknowledgements
165
+
166
+ ### 4.1 BrainFlow
167
+
168
+ This project uses [BrainFlow](https://brainflow.readthedocs.io/en/stable/) for
169
+ biosignal acquisition and hardware integration. BrainFlow provides a uniform
170
+ API for acquiring, parsing, and analyzing EEG, EMG, ECG, and other biosensor
171
+ data across a wide range of supported boards, including OpenBCI devices.
172
+ BrainFlow is distributed under the
173
+ [MIT License](https://github.com/brainflow-dev/brainflow/blob/master/LICENSE).
174
+
175
+ ### 4.2 ModernGL Spectrogram
176
+
177
+ This project uses
178
+ [nickcercone/spectrogram](https://github.com/nickcercone/spectrogram) as a
179
+ reference for parts of its ModernGL spectrogram rendering implementation. The
180
+ referenced project demonstrates real-time audio spectrogram visualization
181
+ using ModernGL and is distributed under the
182
+ [MIT License](https://github.com/nickcercone/spectrogram/blob/main/LICENCE).
183
+
184
+ ### 4.3 Text Rendering
185
+
186
+ This project adapts the code in
187
+ [How to render text with PyOpenGL?](https://stackoverflow.com/questions/63836707/how-to-render-text-with-pyopengl)
188
+ by exiled (question) and Rabbid76 (answer) for its ModernGL text renderer.
189
+ The referenced contributions demonstrate text rendering with PyOpenGL and are
190
+ distributed under the
191
+ [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
192
+
193
+ ---
194
+
195
+ ## 5. Tech Debt
196
+
197
+ 1. Add setup and installation instructions to this readme.
198
+ 2. Create new repo-emg-ability (create import and remove run.sh).
199
+ 3. Folder portability use [EMGFlow](https://github.com/WiIIson/EMGFlow-Python-Package/tree/main) & [system path](https://www.youtube.com/watch?v=v6tALyc4C10&t=3s) reference.
200
+ 4. Add legends for raw and filtered emg in timeseries renderer.
201
+ 5. Processing latency in the performance metrics.
202
+ 6. Improve the GUI toggle controls and expose their options in the left sidebar.
203
+ 7. Add timer and countdown visualizations.
204
+ 8. Move signal processing from the GUI thread to a dedicated processing thread.
205
+ 9. Move the complete data-source lifecycle into the sensor thread, including initialization, streaming, recording, stopping, and release.
206
+
@@ -0,0 +1,174 @@
1
+ # <img src="docs/diagrams/Ability_Logomark.svg" alt="Ability logomark" width="48" align="absmiddle"> emg-gui
2
+
3
+ ## 1. Overview
4
+
5
+ ### 1.1 Introduction
6
+
7
+ A real-time visual engine for acquiring, recording, and exploring raw and filtered EMG signals.
8
+
9
+ ### 1.2 Installation
10
+
11
+ EMG-GUI can be installed from pypi using pip:
12
+
13
+ ```bash
14
+ pip install emg-gui
15
+ ```
16
+
17
+ ### 1.3 How to Run
18
+
19
+ TODO
20
+
21
+ ---
22
+
23
+ ## 2. Architecture and Project Structure
24
+
25
+ ### 2.1 Architecture
26
+
27
+ The application separates sensor acquisition, interface controls, signal
28
+ processing, and GPU rendering. Sensor polling and board stream control run on a
29
+ dedicated thread, while Qt interface updates, filtering, and ModernGL rendering
30
+ currently run on the main thread.
31
+
32
+ ```text
33
+ EMG GUI
34
+ ├── app.py
35
+ ├── Acquisition
36
+ │ ├── DataSource
37
+ │ └── SensorWorker
38
+ │ └── RingBuffer
39
+ ├── UI
40
+ │ ├── EMGVisualizerWindow
41
+ │ └── EMGControlPanel
42
+ ├── Processing
43
+ │ ├── EMG filtering
44
+ │ └── Window functions
45
+ └── Visualization
46
+ ├── EMGOpenGLWidget
47
+ ├── TimeSeriesRenderer
48
+ ├── SpectrogramRenderer
49
+ ├── TicksRenderer
50
+ └── TextRenderer
51
+ ```
52
+
53
+ The `DataSource` provides hardware-independent acquisition from either an
54
+ OpenBCI board or a playback recording. The current application entry point uses
55
+ `OpenBCIBoard` by default, with playback available as an alternate source.
56
+ `SensorWorker` reads EMG samples into a fixed-size ring buffer, and
57
+ `EMGOpenGLWidget` owns duplicate-snapshot checks, snapshot filtering, and
58
+ ModernGL rendering. `TimeSeriesRenderer` and `SpectrogramRenderer` are connected
59
+ to the live rendering path. Channel counts come from the selected data source,
60
+ so synthetic and real boards can expose different numbers of EMG channels. The
61
+ display window is sample-based, while the rendered layout is derived from the
62
+ OpenGL widget size and the selected EMG channel count.
63
+
64
+ See the [architecture guide](docs/architecture.md) for the detailed component
65
+ hierarchy, data flow, and thread interaction sequences.
66
+
67
+ ### 2.2 Directory Layout
68
+
69
+ Inside this project, you'll see the following folders and files:
70
+
71
+ ```text
72
+ /
73
+ ├── docs/
74
+ │ ├── diagrams/
75
+ │ │ ├── Ability_Logo.svg
76
+ │ │ └── interface-contracts.svg
77
+ │ └── architecture.md
78
+ ├── src/
79
+ │ └── emg_gui/
80
+ │ ├── app.py
81
+ │ ├── acquisition/
82
+ │ │ ├── data_source.py
83
+ │ │ ├── dataset_files.py
84
+ │ │ └── sensor_worker.py
85
+ │ ├── config/
86
+ │ │ ├── constants.py
87
+ │ │ └── Roboto-Black.ttf
88
+ │ ├── core/
89
+ │ │ ├── enums.py
90
+ │ │ ├── logger.py
91
+ │ │ └── types.py
92
+ │ ├── processing/
93
+ │ │ ├── filter.py
94
+ │ │ └── window_functions.py
95
+ │ ├── ui/
96
+ │ │ ├── control_panel.py
97
+ │ │ └── window.py
98
+ │ └── visualizer/
99
+ │ ├── shaders/
100
+ │ │ ├── shader_loader.py
101
+ │ │ ├── spec/
102
+ │ │ │ ├── vertex.glsl
103
+ │ │ │ └── fragment.glsl
104
+ │ │ ├── text/
105
+ │ │ │ ├── vertex.glsl
106
+ │ │ │ └── fragment.glsl
107
+ │ │ ├── ticks/
108
+ │ │ │ ├── vertex.glsl
109
+ │ │ │ └── fragment.glsl
110
+ │ │ └── time_series/
111
+ │ │ ├── vertex.glsl
112
+ │ │ └── fragment.glsl
113
+ │ ├── open_gl_widget.py
114
+ │ ├── spectrogram_renderer.py
115
+ │ ├── text_renderer.py
116
+ │ ├── ticks_renderer.py
117
+ │ └── time_series_renderer.py
118
+ ├── tests/
119
+ ├── CONTRIBUTING.md
120
+ ├── pyproject.toml
121
+ └── README.md
122
+ ```
123
+
124
+ ---
125
+
126
+ ## 3. Contributing
127
+
128
+ Contributions are welcome. See the [contributing guide](CONTRIBUTING.md) for
129
+ development and linting guidelines.
130
+
131
+ ---
132
+
133
+ ## 4. Acknowledgements
134
+
135
+ ### 4.1 BrainFlow
136
+
137
+ This project uses [BrainFlow](https://brainflow.readthedocs.io/en/stable/) for
138
+ biosignal acquisition and hardware integration. BrainFlow provides a uniform
139
+ API for acquiring, parsing, and analyzing EEG, EMG, ECG, and other biosensor
140
+ data across a wide range of supported boards, including OpenBCI devices.
141
+ BrainFlow is distributed under the
142
+ [MIT License](https://github.com/brainflow-dev/brainflow/blob/master/LICENSE).
143
+
144
+ ### 4.2 ModernGL Spectrogram
145
+
146
+ This project uses
147
+ [nickcercone/spectrogram](https://github.com/nickcercone/spectrogram) as a
148
+ reference for parts of its ModernGL spectrogram rendering implementation. The
149
+ referenced project demonstrates real-time audio spectrogram visualization
150
+ using ModernGL and is distributed under the
151
+ [MIT License](https://github.com/nickcercone/spectrogram/blob/main/LICENCE).
152
+
153
+ ### 4.3 Text Rendering
154
+
155
+ This project adapts the code in
156
+ [How to render text with PyOpenGL?](https://stackoverflow.com/questions/63836707/how-to-render-text-with-pyopengl)
157
+ by exiled (question) and Rabbid76 (answer) for its ModernGL text renderer.
158
+ The referenced contributions demonstrate text rendering with PyOpenGL and are
159
+ distributed under the
160
+ [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
161
+
162
+ ---
163
+
164
+ ## 5. Tech Debt
165
+
166
+ 1. Add setup and installation instructions to this readme.
167
+ 2. Create new repo-emg-ability (create import and remove run.sh).
168
+ 3. Folder portability use [EMGFlow](https://github.com/WiIIson/EMGFlow-Python-Package/tree/main) & [system path](https://www.youtube.com/watch?v=v6tALyc4C10&t=3s) reference.
169
+ 4. Add legends for raw and filtered emg in timeseries renderer.
170
+ 5. Processing latency in the performance metrics.
171
+ 6. Improve the GUI toggle controls and expose their options in the left sidebar.
172
+ 7. Add timer and countdown visualizations.
173
+ 8. Move signal processing from the GUI thread to a dedicated processing thread.
174
+ 9. Move the complete data-source lifecycle into the sensor thread, including initialization, streaming, recording, stopping, and release.
@@ -0,0 +1,48 @@
1
+ [project]
2
+ name = "emg-gui"
3
+ version = "0.0.5"
4
+ description = ""
5
+ authors = [
6
+ {name = "Nikhil Pareek", email = "nikhilpareek149@gmail.com"}
7
+ ]
8
+ maintainers = [
9
+ {name = "Nikhil Pareek", email = "nikhilpareek149@gmail.com"}
10
+ ]
11
+ readme = "README.md"
12
+ requires-python = "==3.12.10"
13
+ dependencies = [
14
+ "brainflow==5.16.0",
15
+ "dvg-ringbuffer==1.1.0",
16
+ "freetype-py==2.5.1",
17
+ "librosa==0.11.0",
18
+ "matplotlib==3.9.4",
19
+ "moderngl==5.12.0",
20
+ "numpy==1.26.4",
21
+ "PyQt5==5.15.11",
22
+ "PyQt5-Qt5==5.15.2; sys_platform == 'win32'",
23
+ "PyQt5-Qt5==5.15.19; sys_platform != 'win32'",
24
+ "PyQt5-sip==12.17.1",
25
+ "pyrr==0.10.3",
26
+ "pyserial==3.5",
27
+ "setuptools==80.10.2",
28
+ "typing-extensions==4.16.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/pareeknikhil/emg-gui"
33
+ Documentation = "https://pareeknikhil.github.io/"
34
+ Issues = "https://github.com/pareeknikhil/emg-gui/issues"
35
+
36
+ [build-system]
37
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
38
+ build-backend = "poetry.core.masonry.api"
39
+
40
+ [project.scripts]
41
+ emg-gui = "emg_gui.app:main"
42
+
43
+ [tool.poetry]
44
+ packages = [{ include = "emg_gui", from = "src" }]
45
+ include = [
46
+ { path = "src/emg_gui/visualizer/shaders/**/*.glsl", format = ["sdist", "wheel"] },
47
+ { path = "src/emg_gui/config/*.ttf", format = ["sdist", "wheel"] },
48
+ ]
File without changes
File without changes