Skip to content

Commit

Permalink
major restructure
Browse files Browse the repository at this point in the history
- template notebooks moved to /templates folder
- all template notebooks have been fully updated and commented
- minor edits to studies notebooks
  • Loading branch information
teanijarv committed Dec 16, 2022
1 parent 29eede6 commit a57e0c2
Show file tree
Hide file tree
Showing 18 changed files with 2,524 additions and 9,699 deletions.
Binary file modified .DS_Store
Binary file not shown.
128 changes: 0 additions & 128 deletions oddball_data_visualisation.ipynb

This file was deleted.

8,046 changes: 0 additions & 8,046 deletions oddball_erp_analysis.ipynb

This file was deleted.

289 changes: 0 additions & 289 deletions oddball_erp_preprocessing.ipynb

This file was deleted.

604 changes: 0 additions & 604 deletions resting_aperiodicfit_bp_analysis.ipynb

This file was deleted.

270 changes: 0 additions & 270 deletions resting_classic_bp_analysis.ipynb

This file was deleted.

330 changes: 0 additions & 330 deletions resting_preprocessing.ipynb

This file was deleted.

10 changes: 6 additions & 4 deletions signal_processing/erp_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def find_all_peaks(evoked_obj,epochs,thresh=None,subject_name='',verbose=False,p
return minpeak_times,minpeak_mags,maxpeak_times,maxpeak_mags

def identify_erps(evoked_obj,erp_wins,minpeak_times,minpeak_mags,maxpeak_times,maxpeak_mags,subject_name='',
verbose=False,plot=False,savefig=False,results_foldername = "Results/"):
verbose=False,plot=False,savefig=False,results_foldername = "Results/",exp_folder=''):
# Pre-define variables
erp_peaks = {}
not_erp_peaks = {}
Expand Down Expand Up @@ -129,13 +129,14 @@ def identify_erps(evoked_obj,erp_wins,minpeak_times,minpeak_mags,maxpeak_times,m
plt.plot(erp_peaks[erp_name][0], erp_peaks[erp_name][1], marker='*', linestyle='None', color=color)
plt.annotate(erp_name, (erp_peaks[erp_name][0]+15,erp_peaks[erp_name][1]-0.15))
if savefig == True:
plt.savefig(fname='{}/ERP plots/{}_erpfig.png'.format(results_foldername,subject_name)) # add ERP plots to precreation function
plt.savefig(fname='{}/{}/ERP analysis/{}_erpfig.png'.format(results_foldername,
exp_folder, subject_name)) # add ERP plots to precreation function
plt.show()

return erp_peaks, not_erp_peaks

def find_minmax_erp(evoked_obj,erp_peaks,erp_tochange,new_time_win,subject_name='',
verbose=False,plot=False,savefig=False,results_foldername = "Results/"):
verbose=False,plot=False,savefig=False,results_foldername = "Results/",exp_folder=''):
time_coef = 1e3
amplitude_coef= 1e6

Expand Down Expand Up @@ -188,7 +189,8 @@ def find_minmax_erp(evoked_obj,erp_peaks,erp_tochange,new_time_win,subject_name=
plt.plot(erp_peaks[erp_name][0], erp_peaks[erp_name][1], marker='*', linestyle='None', color=color)
plt.annotate(erp_name, (erp_peaks[erp_name][0]+15,erp_peaks[erp_name][1]-0.15))
if savefig == True:
plt.savefig(fname='{}/ERP plots/{}_erpfig.png'.format(results_foldername,subject_name)) # add ERP plots to precreation function
plt.savefig(fname='{}/{}/ERP analysis/{}_erpfig.png'.format(results_foldername,
exp_folder, subject_name)) # add ERP plots to precreation function
plt.show()

return erp_peaks
Expand Down
10 changes: 5 additions & 5 deletions studies/LABS-LEISURE_rsEEG_aperiodic+iaf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -31,7 +31,7 @@
"from fooof.plts.periodic import plot_peak_params\n",
"\n",
"# Set the current working directory to be the project main folder\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pipeline-TI')\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pyline')\n",
"plt.rc('axes', axisbelow=True)\n",
"\n",
"import basic.arrange_data as arrange\n",
Expand Down Expand Up @@ -1546,12 +1546,12 @@
" '\\nAbs. PSD: '+str(np.round(abs_bp, 4))+'\\nRel. PSD: '+str(np.round(rel_bp, 4)),\n",
" (0.75, 0.16), xycoords='figure fraction', color='green', fontsize=8.5)\n",
" \n",
" plt.suptitle('{} region ({})'.format(region,subject_names[i]))\n",
" plt.suptitle('{} region ({})'.format(region, subject_names[i]))\n",
" plt.tight_layout()\n",
" if savefig == True:\n",
" plt.savefig(fname='{}/{}/FOOOF/{}_{}_{}_fooof.png'.format(results_folder, exp_folder[exp],\n",
" exp_condition[exp], subject_names[i],\n",
" region))\n",
" exp_condition[exp], subject_names[i],\n",
" region), dpi=300)\n",
" plt.show()\n",
"\n",
" # Add model parameters to dataframe\n",
Expand Down
4 changes: 2 additions & 2 deletions studies/LEISURE_rsEEG_aperiodic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"from fooof.plts.spectra import plot_spectrum\n",
"\n",
"# Set the current working directory to be the project main folder\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pipeline-TI')\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pyline')\n",
"\n",
"import basic.arrange_data as arrange\n",
"import signal_processing.pre_process as pre_process\n",
Expand Down Expand Up @@ -921,7 +921,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:52) \n[Clang 13.0.1 ]"
"version": "3.9.13"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
4 changes: 2 additions & 2 deletions studies/OKTOS_rsEEG_classic_bp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -26,7 +26,7 @@
"#mne.set_log_level('error')\n",
"\n",
"# Set the current working directory to be the project main folder\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pipeline-TI')\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pyline')\n",
"\n",
"import basic.arrange_data as arrange\n",
"import signal_processing.pre_process as pre_process\n",
Expand Down
177 changes: 177 additions & 0 deletions templates/auditory_oddball/oddball_data_visualisation.ipynb

Large diffs are not rendered by default.

408 changes: 408 additions & 0 deletions templates/auditory_oddball/oddball_erp_analysis.ipynb

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions templates/auditory_oddball/oddball_erp_preprocessing.ipynb

Large diffs are not rendered by default.

449 changes: 449 additions & 0 deletions templates/resting_state/resting_aperiodicfit_bp_analysis.ipynb

Large diffs are not rendered by default.

590 changes: 590 additions & 0 deletions templates/resting_state/resting_classic_bp_analysis.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import basic.arrange_data as arrange\n",
"from basic.stats import apply_stat_test\n",
"import data_visualisation as dataviz"
"### (DISCONTINUED) Resting State EEG: data visualisation"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"**Spectral analysis data visualisation**\n",
"import pandas as pd\n",
"import os\n",
"\n",
"Change these parameters! Set the folder of EEG power spectrum density files\n",
"os.chdir('/Users/tanijarv/Documents/GitHub/EEG-pyline')\n",
"\n",
"*NB! The path has to be relative to this notebook.*"
"import basic.arrange_data as arrange\n",
"from basic.stats import apply_stat_test\n",
"import data_visualisation as dataviz"
]
},
{
Expand Down Expand Up @@ -55,13 +56,6 @@
"# condition_codes_comparisons_eo = [['EO_00','EO_06'],['EO_06','EO_07'],['EO_00','EO_07']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run this script to load in all the necessary data for plotting. Also it will display you all the significant changes which will help you choose what regions and bands to plot."
]
},
{
"cell_type": "code",
"execution_count": 7,
Expand Down Expand Up @@ -335,7 +329,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:52) \n[Clang 13.0.1 ]"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
418 changes: 418 additions & 0 deletions templates/resting_state/resting_preprocessing.ipynb

Large diffs are not rendered by default.

0 comments on commit a57e0c2

Please sign in to comment.