Skip to content
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

Attempts to display interactive figures in the README.md #27

Merged
merged 19 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5ca7ace
attempt to display the html graphs in the README.md file
eddyfortier Aug 17, 2021
e87409a
Merge branch 'main' of github.com:eddyfortier/fortier_project into main
eddyfortier Aug 17, 2021
66de5b9
2nd attempt at html figure in README.md
eddyfortier Aug 17, 2021
f2d375d
3rd attempt at html figure in README.md
eddyfortier Aug 17, 2021
26f88a7
4th attempt at html figure in README.md
eddyfortier Aug 17, 2021
f11f3d6
5th attempt at html figure in README.md
eddyfortier Aug 17, 2021
482cd17
6th attempt at html figure in README.md
eddyfortier Aug 17, 2021
a14b283
added a placeholder html element in README.md to run tests to embed h…
eddyfortier Aug 17, 2021
44df3ce
7th attempt at html figure in README.md
eddyfortier Aug 17, 2021
76ff905
7.1th attempt at html figure in README.md
eddyfortier Aug 17, 2021
69f4918
attempt 7.2 at html figure in README.md
eddyfortier Aug 17, 2021
8785f6d
attempt 7.3 at html figure in README.md
eddyfortier Aug 17, 2021
e18edb6
attempt 7.4.0 at html figure in README.md
eddyfortier Aug 17, 2021
f071a11
attempt 7.5.0 at html figure in README.md
eddyfortier Aug 17, 2021
3d403d4
update of the 2 html display figures
eddyfortier Aug 17, 2021
d1988bf
removed the 2 html files from the images folder
eddyfortier Aug 17, 2021
955832b
removed the attempts to display the html figures
eddyfortier Aug 17, 2021
a7ebe3f
added a display = False parameter in plot_pta_subject and plot_mtx_su…
eddyfortier Aug 17, 2021
fa310a7
created 2 notebooks to display the html sample figures
eddyfortier Aug 17, 2021
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
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Some of those test data, such as the pure-tone audiometry test data, are more ea
But with these repeated test comes important amount of data to process.
A first task that could be interesting to do would be, in order to go through the data processing more efficiently, to build an automated pipeline to generate the graphs.

###### Exemple of audiogram
##### Exemple of audiogram

![P01-Baseline 2, Bilateral.png](images/P01-Baseline_2_Bilateral.png)

###### Exemple of Matrix test results graph
##### Exemple of Matrix test results graph

![P01-Matrix test FR, Condition 2 (may_2021).png](images/P01-Matrix_test_FR_Condition_2_(may_2021).png)

Expand Down Expand Up @@ -116,3 +116,27 @@ By the end of The BrainHack School, we aimed to have the following:
- Jupyter notebooks with code and explanations for the BIDS formatting task
- A [slideshow](https://docs.google.com/presentation/d/1TveZjzR9TDlGQA-XrLYjqPEb2E-x2vvl0kyfu43ljaQ/edit?usp=sharing) presentation showing the project results

## Results

#### Mr. Fortier's progress overview

A first iteration of functional python scripts to generation single test graphs and test overview graphs for each of the Projet Courtois NeuroMod participants is now available in the code folder of this repository.
These scripts were also linted using flake8 and passed all the generic requirements of this linter.

#### Tools and skills that were developped during this project

- **Python scripts**: It was a first attempt to code in python using scripts instead of the Jupyter Notebook controlled environment.
- **Python scripts**: It was also a first attempt at using multiple scripts for a single task and importing functions across them.
- **Git and Github**: This project is the first attempt at building a complete project from the start, using Git's functions and a Github repository.
- **Plot.ly's `graph_objects` tools**: This project was a first on many front regarding Plot.ly.
- It was a first attempt at doing interactive figures/graphs.
- It was a first contact with Plot.ly's library.
- It was a challenge to be able to build graphs that fully represent the particularities of the two different types of figure produced in this project: `plotly.express` might have been easier to use than `plotly.graph_objects`, but it was not as capable to fully build the vision planned for this project.
- It was an important challenge to navigate in the impressive documentation of the `plotly.graph_objects` library. It is a powerful, extensively customizable tool, but it is also very complex.
- **flake8 linter**: It was the first use of a linter to proof read the scripts' code format.

##### Exemple of interactive HTML audiogram



##### Exemple of Matrix test interactive HTML graph
1,139 changes: 1,139 additions & 0 deletions code/MTX_sample_figure_generator.ipynb

Large diffs are not rendered by default.

1,511 changes: 1,511 additions & 0 deletions code/PTA_sample_figure_generator.ipynb

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions code/other_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def plot_pta_R(df):
return False


def plot_pta_subject(df):
def plot_pta_subject(df, display = False):
"""
INPUTS
-df: pandas dataframe containing the data to plot
Expand Down Expand Up @@ -433,12 +433,15 @@ def plot_pta_subject(df):
hovertemplate="%{x:1.0f} Hz<br>" +
"%{y:1.0f} dB HL"))

completed = save_graph_PTA(fig, df, "All_runs")

if completed is True:
return True
if display is True:
fig.show()
else:
return False
completed = save_graph_PTA(fig, df, "All_runs")

if completed is True:
return True
else:
return False


def plot_mtx(df, run_ID):
Expand Down Expand Up @@ -493,7 +496,7 @@ def plot_mtx(df, run_ID):
return False


def plot_mtx_subject(df, run_ID):
def plot_mtx_subject(df, run_ID, display = False):
"""
INPUTS
-df: pandas dataframe containing the data to plot
Expand Down Expand Up @@ -544,9 +547,12 @@ def plot_mtx_subject(df, run_ID):
hovertemplate="%{x}<br>" +
"%{y:0.1f} dB"))

completed = save_graph_MTX(fig, df, language_ID_save)

if completed is True:
return True
if display is True:
fig.show()
else:
return False
completed = save_graph_MTX(fig, df, language_ID_save)

if completed is True:
return True
else:
return False
64 changes: 0 additions & 64 deletions images/Sub-01_MTX_L1_Francais_All_runs.html

This file was deleted.

64 changes: 0 additions & 64 deletions images/Sub-01_PTA_All_runs.html

This file was deleted.