Skip to content

Commit

Permalink
Update functionally report + example
Browse files Browse the repository at this point in the history
- Update readme text with more figures
- add solved todos
- add example based on emotions (with non accurate data)
  • Loading branch information
Timozen committed Nov 3, 2023
1 parent a422115 commit 50e616b
Show file tree
Hide file tree
Showing 7 changed files with 293 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ MANIFEST

#jupyter
.ipynb_checkpoints
*.ipynb

# app/data
temp_results
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# electromyogram

<!-- Create a teaser plot figure here -->
![Teaser](files/teaser.jpg)

This Python package provides a convenient way to create an Electromyogram (EMG) Intensity plot specifically designed for facial muscles with facial structure. With this tool, you can visualize and analyze the intensity of EMG data collected from various facial muscles.

A small demo is hosted [here](www.semg.inf-cv.uni-jena.de), together with the tool [face-projection](https://github.com/cvjena/face-projection) for a projection onto the face.
A small demo is hosted [here](https://semg.inf-cv.uni-jena.de/), together with the tool [face-projection](https://github.com/cvjena/face-projection) for a projection onto the face.

## Why use EMG Intensity Plot?
## Why use sEMG Intensity Plot?

- **Easy to use**: The package provides a straightforward interface, making it accessible for users of all levels of expertise.
- **Visualize muscle activity**: The EMG Intensity plot allows you to visualize the intensity of muscle activity over the face, providing insights into patterns and variations.
Expand Down Expand Up @@ -39,6 +39,8 @@ We assume that the data is given in a dictionary (or pandas table) and the keys

Then, the correct physical interpolation between the sensors is done, and the result is a 2D array of the interpolated values on the canonical face model.
You can then apply different color maps to the interpolation to create the final plot.
Detailed examples with test data can be found in `examples/`.


```python
import electromyogram as emg
Expand All @@ -52,12 +54,13 @@ powermap = emg.interpolate(scheme, data_values, shape=(1024, 1024))
powermap = emg.colorize(powermap, cmap='viridis')
```

For the colorization, the users can use any color map from [matplotlib](https://matplotlib.org/stable/tutorials/colors/colormaps.html) or [pallettable](https://jiffyclub.github.io/palettable/) (e.g., `pallettable.`scientific.sequential.Imola20`)
For the colorization, the users can use any color map from [matplotlib](https://matplotlib.org/stable/tutorials/colors/colormaps.html) or [pallettable](https://jiffyclub.github.io/palettable/) (e.g., `pallettable.scientific.sequential.Imola_20`)
![Colors](files/colorization.jpg)

## Surface EMG Schematics

We currently support the two following schematics for acquiring the EMG data.
If you want to have your own, please open an issue or create a pull request, and we will be happy to add it.

| [Fridlund and Cappacio, 1986](https://pubmed.ncbi.nlm.nih.gov/3809364/) | [Kuramoto et al., 2019](https://onlinelibrary.wiley.com/doi/10.1002/npr2.12059) |
|---|---|
Expand All @@ -69,10 +72,10 @@ Then use it in the `interpolate` function, and you are good to go.
## Todos

- [ ] Handle if not all values are given for a better schematic
- [ ] Add result images
- [ ] Add a function to draw triangulation onto the 2D canvas
- [X] Add result images
- [X] Add a function to draw triangulation onto the 2D canvas
- [ ] Add a function to draw sensor locations onto the 2D canvas
- [ ] Add the option to remove the area outside the canonical face model
- [X] Add the option to remove the area outside the canonical face model
- [ ] Make a better interface for the channel names
- [ ] Add function to create the according colorbar for matplotlib in the correct size

Expand Down
7 changes: 7 additions & 0 deletions examples/data/fridlund.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
,DAO li ,OrbOr li ,Ment li ,Mass li ,Zyg li ,Llsup li ,OrbOc li ,lat Front li ,med Front li ,Corr li ,Deprsup li ,DAO re ,OrbOr re ,Ment re ,Mass re ,Zyg re ,Llsup re ,OrbOc re ,lat Front re ,med Front re ,Corr re ,Deprsup re
angry , 9.87 , 21.85 , 16.80 , 1.41 , 1.10 , 0.00 , 6.89 , 1.31 , 0.93 , 2.44 , 2.74 , 0.00 , 39.11 , 17.33 , 2.04 , 1.63 , 0.00 , 9.51 , 0.71 , 0.82 , 2.27 , 2.07
suprised , 0.85 , 0.79 , 1.21 , 0.46 , 0.45 , 0.61 , 1.56 , 4.71 , 3.51 , 2.26 , 2.93 , 0.73 , 0.80 , 1.12 , 0.51 , 0.52 , 0.92 , 3.01 , 1.67 , 3.95 , 2.65 , 2.46
sad , 0.98 , 1.23 , 28.19 , 0.63 , 0.72 , 3.49 , 2.22 , 3.09 , 6.00 , 7.91 , 7.16 , 1.00 , 1.47 , 28.97 , 0.76 , 0.80 , 2.51 , 3.41 , 1.08 , 6.72 , 8.42 , 7.04
fearful , 8.68 , 0.00 , 11.20 , 0.86 , 0.92 , 1.83 , 1.58 , 0.00 , 5.65 , 3.11 , 2.99 , 4.60 , 11.33 , 6.70 , 1.11 , 0.96 , 2.05 , 4.13 , 1.60 , 6.46 , 3.68 , 3.85
happy , 3.14 , 18.30 , 8.37 , 0.70 , 0.00 , 3.71 , 6.05 , 0.72 , 0.65 , 0.52 , 0.33 , 0.00 , 15.04 , 10.23 , 0.92 , 0.00 , 3.31 , 7.41 , 0.60 , 0.62 , 0.58 , 0.55
distugusted , 2.46 , 8.31 , 4.05 , 0.77 , 0.95 , 1.79 , 7.78 , 3.65 , 2.55 , 10.57 , 8.50 , 1.90 , 6.01 , 3.92 , 0.72 , 0.81 , 1.83 , 8.97 , 0.97 , 2.39 , 10.00 , 8.13
8 changes: 8 additions & 0 deletions examples/data/kuramoto.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

,E1,E3,E5,E7,E9,E13,E15,E17,E2,E4,E6,E8,E10,E14,E16,E18,E19,E20,E24
angry,4.10,6.05,5.98,4.73,11.44,2.57,2.98,2.76,3.81,4.21,12.49,5.63,10.74,4.04,3.59,3.46,7.97,0.00,5.99
suprised,6.94,6.13,3.45,3.64,5.18,3.27,3.39,3.70,6.29,5.71,3.20,3.41,4.47,3.38,3.36,3.80,4.53,3.75,3.48
sad,5.17,8.45,3.97,4.33,17.21,0.00,4.33,4.54,4.74,5.57,3.67,4.62,17.74,9.39,3.76,4.14,7.13,4.90,5.83
fearful,9.13,9.07,3.77,4.78,0.00,6.87,4.24,6.63,10.26,7.80,3.38,4.67,24.93,6.23,3.90,5.92,5.19,5.09,3.10
happy,1.82,2.55,3.28,3.35,0.00,3.77,3.16,6.41,1.66,2.12,4.39,3.32,0.00,3.07,4.48,7.58,2.25,4.30,2.27
distugusted,8.89,8.90,6.04,5.28,6.39,6.53,4.20,3.76,10.34,7.18,12.29,5.84,5.65,10.30,5.06,4.10,10.73,5.75,9.14
267 changes: 267 additions & 0 deletions examples/emotions.ipynb

Large diffs are not rendered by default.

Binary file added files/teaser.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install_requires =
scipy>=1.8,<2
palettable>3.3
matplotlib>=3.5,<4

h5py>=3.10
[options.packages.find]
where = src
exclude =
Expand Down

0 comments on commit 50e616b

Please sign in to comment.