Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuGG committed Jul 30, 2024
1 parent 8e793f4 commit 33fe7fb
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 27 deletions.
50 changes: 24 additions & 26 deletions DualTaskEffect.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -29,7 +29,7 @@
"# Set this to True if you want to save on report for all participants\n",
"saveAllTogether = True\n",
"# Set this to True if you want to save on report per participants\n",
"saveIndependent = False\n",
"saveIndependent = True\n",
"\n",
"# Set this to True if you want to save the final plot\n",
"savePlot = True\n",
Expand Down Expand Up @@ -64,14 +64,14 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No missing values in /Users/mgg/Documents/GitHub/DualTaskEffect/sample/data.csv\n",
"No missing values in /Users/mgg/Documents/GitHub/DualTaskEffect/DualTaskEffect/sample/data.csv\n",
"1 .csv file imported from data.csv - OK\n"
]
}
Expand Down Expand Up @@ -133,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -185,7 +185,7 @@
"0 21.138984 17.903505 "
]
},
"execution_count": 53,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -206,17 +206,17 @@
"$$\n",
"and caracterise it according to Plummer et al, 2013 ([DOI: 10.1155/2014/538602](https://onlinelibrary.wiley.com/doi/10.1155/2014/538602)) \n",
"\n",
"![Figure Plummer et al. 2013](/Users/mgg/Documents/GitHub/DualTaskEffect/images/DTE.jpg)\n"
"![Figure Plummer et al. 2013](/Users/mgg/Documents/GitHub/DualTaskEffect/DualTaskEffect/images/DTE.jpg)\n"
]
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"# Creating the functions, with automatic task (Cognitive, Motor) detection\n",
"# Dual Task Effect\n",
"# Dual Task Effect (DTE) scores\n",
"def calculate_dual_task_effect(df, task_type):\n",
" single_task_col = f\"Single Task - {task_type} performance\"\n",
" dual_task_col = f\"Dual Task - {task_type} performance\"\n",
Expand All @@ -233,7 +233,6 @@
" \n",
" return df\n",
"\n",
"\n",
"# Determine the DTE category (initial and final)\n",
"def determine_effect_category(cognitive_effect, motor_effect):\n",
" if cognitive_effect > 0 and motor_effect == 0:\n",
Expand Down Expand Up @@ -282,14 +281,15 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Saved concatenated CSV file as /Users/mgg/Documents/GitHub/DualTaskEffect/results/concatenated_data.csv\n"
"Saved 10 independent CSV files in /Users/mgg/Documents/GitHub/DualTaskEffect/DualTaskEffect/results\n",
"Saved concatenated CSV file as /Users/mgg/Documents/GitHub/DualTaskEffect/DualTaskEffect/results/concatenated_data.csv\n"
]
}
],
Expand All @@ -314,7 +314,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -438,7 +438,7 @@
"4 Cognitive priority tradeoff "
]
},
"execution_count": 56,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -453,12 +453,12 @@
"metadata": {},
"source": [
"## Graphical representation\n",
"It's now time to represent every participants' DTP as a vector on the same plot, and to print the starting and stoping point according to Plummer et al., 2013. "
"It's now time to represent every participants' DTE as a point on the same plot, and to print it's caracteristics according to Plummer et al., 2013 ([DOI: 10.1155/2014/538602](https://onlinelibrary.wiley.com/doi/10.1155/2014/538602)). "
]
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -489,31 +489,29 @@
}
],
"source": [
"# Créer la figure et les axes\n",
"# Create the figure and the axes\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Générer une colormap avec autant de couleurs qu'il y a d'ID uniques\n",
"# Generate one color for each ID point\n",
"num_colors = len(concatenated_df['ID'].unique())\n",
"colors = plt.cm.rainbow(np.linspace(0, 1, num_colors))\n",
"\n",
"# Tracer un point pour chaque participant\n",
"# Create a point per individual\n",
"for i, row in concatenated_df.iterrows():\n",
" ax.scatter(row['Cognitive Dual Task Effect'], row['Motor Dual Task Effect'], color=colors[i % num_colors], label=f'ID {row[\"ID\"]}')\n",
"\n",
"# Ajouter des labels et des titres\n",
"# Labels and Titles\n",
"ax.axhline(0, color='black', linewidth=0.5)\n",
"ax.axvline(0, color='black', linewidth=0.5)\n",
"ax.set_title('Dual Task Effect (DTE)')\n",
"ax.set_xlabel('Cognitive Dual Task Effect')\n",
"ax.set_ylabel('Motor Dual Task Effect')\n",
"\n",
"# Afficher la légende\n",
"ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))\n",
"\n",
"# Afficher le graphique\n",
"\n",
"plt.show()\n",
"\n",
"# Imprimer les informations pour chaque participant\n",
"# Print each participant's information\n",
"for i, row in concatenated_df.iterrows():\n",
" print(f\"Participant {row['ID']:<5}: Dual Task Effect (DTE) = {row['Dual Task Effect']}\")\n"
]
Expand All @@ -527,14 +525,14 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/mgg/Documents/GitHub/DualTaskEffect/results/DTE_plot.jpg saved\n"
"/Users/mgg/Documents/GitHub/DualTaskEffect/DualTaskEffect/results/DTE_plot.jpg saved\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To do so, you need to:

![Dual Task Effect Graph](https://github.com/MatthieuGG/DualTaskEffect/blob/main/results/DTE_plot.jpg?raw=true)

`(change results)`
`Participant 1 : Dual Task Effect (DTE) = Cognitive priority tradeoff`
(etc. for all participants)

---
Expand Down
2 changes: 2 additions & 0 deletions results/001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
1,14.97898651,15.44820299,21.13898374,17.90350497,41.12425914722317,-15.893770826220868,Cognitive priority tradeoff
2 changes: 2 additions & 0 deletions results/0010.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
10,16.3019333,18.70198154,5.92404595,8.74023549,-63.66046995174492,53.265724964457426,Motor priority trade off
2 changes: 2 additions & 0 deletions results/002.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
2,13.48028925,19.57888123,14.48854101,14.7529204,7.479451970958266,24.64880793395568,Mutual facilitation
2 changes: 2 additions & 0 deletions results/003.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
3,15.44213875,12.06779162,11.14646008,7.74518034,-27.817899706412103,35.81940603644596,Motor priority trade off
2 changes: 2 additions & 0 deletions results/004.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
4,11.90332329,15.02299776,7.75540158,16.65464607,-34.846753372519714,-10.86100348323554,Mutual interference
2 changes: 2 additions & 0 deletions results/005.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
5,10.40251621,15.41428928,15.57637495,18.25569465,49.73660829315833,-18.43358015660647,Cognitive priority tradeoff
2 changes: 2 additions & 0 deletions results/006.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
6,17.20050227,11.53435001,11.39124907,15.48966673,-33.77374165481273,-34.291630794720426,Mutual interference
2 changes: 2 additions & 0 deletions results/007.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
7,15.49320746,16.98764647,5.22986744,9.89775582,-66.24412696013819,41.735567446147826,Motor priority trade off
2 changes: 2 additions & 0 deletions results/008.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
8,10.75985418,14.05783247,15.56594141,11.89467038,44.66684352408205,15.38759331935614,Mutual facilitation
2 changes: 2 additions & 0 deletions results/009.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ID,Single Task - Cognitive performance,Single Task - Motor performance,Dual Task - Cognitive performance,Dual Task - Motor performance,Cognitive Dual Task Effect,Motor Dual Task Effect,Dual Task Effect
9,12.26164879,19.10503859,21.72078185,16.50136986,77.14405478416904,13.628178334917454,Mutual facilitation
8 changes: 8 additions & 0 deletions sample/001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,1
Single Task - Cognitive performance,14.97898651
Single Task - Motor performance,15.44820299
Dual Task - Cognitive performance,21.13898374
Dual Task - Motor performance,17.90350497
Cognitive Dual Task Effect,41.12425914722317
Motor Dual Task Effect,-15.893770826220868
Dual Task Effect,Cognitive priority tradeoff
8 changes: 8 additions & 0 deletions sample/002.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,2
Single Task - Cognitive performance,13.48028925
Single Task - Motor performance,19.57888123
Dual Task - Cognitive performance,14.48854101
Dual Task - Motor performance,14.7529204
Cognitive Dual Task Effect,7.479451970958266
Motor Dual Task Effect,24.64880793395568
Dual Task Effect,Mutual facilitation
8 changes: 8 additions & 0 deletions sample/003.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,3
Single Task - Cognitive performance,15.44213875
Single Task - Motor performance,12.06779162
Dual Task - Cognitive performance,11.14646008
Dual Task - Motor performance,7.74518034
Cognitive Dual Task Effect,-27.817899706412103
Motor Dual Task Effect,35.81940603644596
Dual Task Effect,Motor priority trade off
8 changes: 8 additions & 0 deletions sample/004.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,4
Single Task - Cognitive performance,11.90332329
Single Task - Motor performance,15.02299776
Dual Task - Cognitive performance,7.75540158
Dual Task - Motor performance,16.65464607
Cognitive Dual Task Effect,-34.846753372519714
Motor Dual Task Effect,-10.86100348323554
Dual Task Effect,Mutual interference
8 changes: 8 additions & 0 deletions sample/005.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,5
Single Task - Cognitive performance,10.40251621
Single Task - Motor performance,15.41428928
Dual Task - Cognitive performance,15.57637495
Dual Task - Motor performance,18.25569465
Cognitive Dual Task Effect,49.73660829315833
Motor Dual Task Effect,-18.43358015660647
Dual Task Effect,Cognitive priority tradeoff
8 changes: 8 additions & 0 deletions sample/006.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,6
Single Task - Cognitive performance,17.20050227
Single Task - Motor performance,11.53435001
Dual Task - Cognitive performance,11.39124907
Dual Task - Motor performance,15.48966673
Cognitive Dual Task Effect,-33.77374165481273
Motor Dual Task Effect,-34.291630794720426
Dual Task Effect,Mutual interference
8 changes: 8 additions & 0 deletions sample/007.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,7
Single Task - Cognitive performance,15.49320746
Single Task - Motor performance,16.98764647
Dual Task - Cognitive performance,5.22986744
Dual Task - Motor performance,9.89775582
Cognitive Dual Task Effect,-66.24412696013819
Motor Dual Task Effect,41.735567446147826
Dual Task Effect,Motor priority trade off
8 changes: 8 additions & 0 deletions sample/008.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,8
Single Task - Cognitive performance,10.75985418
Single Task - Motor performance,14.05783247
Dual Task - Cognitive performance,15.56594141
Dual Task - Motor performance,11.89467038
Cognitive Dual Task Effect,44.66684352408205
Motor Dual Task Effect,15.38759331935614
Dual Task Effect,Mutual facilitation
8 changes: 8 additions & 0 deletions sample/009.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,9
Single Task - Cognitive performance,12.26164879
Single Task - Motor performance,19.10503859
Dual Task - Cognitive performance,21.72078185
Dual Task - Motor performance,16.50136986
Cognitive Dual Task Effect,77.14405478416904
Motor Dual Task Effect,13.628178334917454
Dual Task Effect,Mutual facilitation
8 changes: 8 additions & 0 deletions sample/010.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,10
Single Task - Cognitive performance,16.3019333
Single Task - Motor performance,18.70198154
Dual Task - Cognitive performance,5.92404595
Dual Task - Motor performance,8.74023549
Cognitive Dual Task Effect,-63.66046995174492
Motor Dual Task Effect,53.265724964457426
Dual Task Effect,Motor priority trade off

0 comments on commit 33fe7fb

Please sign in to comment.