Skip to content

Commit

Permalink
update dependencies - for build (#220)
Browse files Browse the repository at this point in the history
* major update: merging develop to master (#217)

* example test commit (#182)

* example test commit

* example edit

* ci: run test workflow on develop branch

* ci: add develop branch to job triggers

* ci: fix syntax issue in workflow

* fix: fixed import (brainflow updated API)

* build(deps): locked pylsl==1.10.5 (#187)

* Experiment Class Refactor (update to #183), converting specific experiments to subclasses (#184)

* First commit

* Second commit

* Modifications

* Lol

* Lol

* Incorporated N170 and p300, looking good for a PR

* ssvep update

* Implementing subclasses instead of loose functions

* fix: fixed import (brainflow updated API)

* Playing around still

* Fixing import errors

* Adding abstractmethod decorators

* Still working on the import error

* Guess what's finally working

* Comments and naming ticks

* More comments

* Live coding demonstration

* ssvep adapted

* Adapting Auditory Oddball

* changing save_fn to self.save_fun

* This maybe the last big change

* utils file changed, changes work through cli

Co-authored-by: Erik Bjäreholt <[email protected]>

* Submodule added for gsoc

* Adding pipelines for cli analysis (#202)

* started pipelines function

* almost working simple function equivalents of nb scripts

* fix: fixed import (brainflow updated API)

* sqc fixes for unicorn (#176)

* Ignore pushes

* Trying to create a cli

* Stepping through the problem

* First commit

* Fixing pause in signal quality check

* Fixing Signal quality check problem

* fix the technical debt

* Save path done for automated saving pdf

* I feel amazing

* Almost through

* Update eegnb/cli/__main__.py

Co-authored-by: Erik Bjäreholt <[email protected]>

* Trying to create cli but it's being really painful

* Extra word cli error

* Changed example handling

* Pain

* Adding whole datapath

* Finally fixed cli

* hmm

* Looking good

* added hyperlink

* Having some issues with detecting css and image deltetion

* Just the css now

* Fixed the css linking problem though it's a weird soln

* Automated running, still fnames problem

* Hahahah embedded images in html

* Improving code

* Okay now

* Look at that

* Almost there just the two figures now

* Now

* Added attrdict to do with cli error

Co-authored-by: John Griffiths <[email protected]>
Co-authored-by: Erik Bjäreholt <[email protected]>
Co-authored-by: John Griffiths <[email protected]>

* added more options for site args; improved function names; removed some redundant lines (#209)

* fix subject num parsing bug

* analysis report function improvements for openbci cyton and gtec unicorn devices

* run exp fix

* Update requirements.txt

* fixes to get docs building by github action (#210)

* fixes to get docs building by github action

* reverted some changes

* Update 01r__ssvep_viz.py

Co-authored-by: John Griffiths <[email protected]>

* Update README.rst

small commit to test doc build workflow on this branch

* removing gsoc submodule

Co-authored-by: Erik Bjäreholt <[email protected]>
Co-authored-by: Parv Agarwal <[email protected]>
Co-authored-by: Parvfect <[email protected]>
Co-authored-by: Ben Pettit <[email protected]>

* update dependencies - seaborn

* docs/perf: reduced the imports: `cueing` example

* bug: update deprecated `plot_psd()` method

- feature of new `mne` version.
- instead of doing plot_psd() from the `mne.io.Raw` object, must do this:
	- `raw.compute_psd().plot()`
	- i.e., has to pass through a `spectrum` object

* updated deprec. `mne` function

* perf: removed importage of unused packages from example
- One of them, i.e., `collections.Iterable` is even deprecated.
- Must use `collections.abc.Iterable` instead now.
- Resulting in faster build/user run

* bugfix: `plot_conditions` - due to `sns` deprecation

* bugfix: resolved `psd_welch()` deprecation (`mne`)

---------

Co-authored-by: John Griffiths <[email protected]>
Co-authored-by: Erik Bjäreholt <[email protected]>
Co-authored-by: Parv Agarwal <[email protected]>
Co-authored-by: Parvfect <[email protected]>
Co-authored-by: Ben Pettit <[email protected]>
Co-authored-by: Taha Morshedzadeh <[email protected]>
  • Loading branch information
7 people authored Mar 4, 2023
1 parent 8f41ebe commit 584272e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
21 changes: 9 additions & 12 deletions eegnb/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import logging
from collections import OrderedDict
from glob import glob
from typing import Union, List, Dict
from collections import Iterable
from typing import Union, List#, Dict
# from collections import Iterable
from time import sleep, time
from numpy.core.fromnumeric import std
# from numpy.core.fromnumeric import std
import keyboard
import os

Expand Down Expand Up @@ -277,14 +277,16 @@ def plot_conditions(

for ch in range(channel_count):
for cond, color in zip(conditions.values(), palette):
sns.tsplot(
X[y.isin(cond), ch],
time=times,
sns.lineplot(
data=pd.DataFrame(X[y.isin(cond), ch].T, index=times),
x=times,
y=ch,
color=color,
n_boot=n_boot,
ci=ci,
ax=axes[ch],
errorbar=('ci',ci)
)
axes[ch].set(xlabel='Time (s)', ylabel='Amplitude (uV)', title=epochs.ch_names[channel_order[ch]])

if diff_waveform:
diff = np.nanmean(X[y == diff_waveform[1], ch], axis=0) - np.nanmean(
Expand All @@ -298,11 +300,6 @@ def plot_conditions(
x=0, ymin=ylim[0], ymax=ylim[1], color="k", lw=1, label="_nolegend_"
)

axes[0].set_xlabel("Time (s)")
axes[0].set_ylabel("Amplitude (uV)")
axes[-1].set_xlabel("Time (s)")
axes[1].set_ylabel("Amplitude (uV)")

if diff_waveform:
legend = ["{} - {}".format(diff_waveform[1], diff_waveform[0])] + list(
conditions.keys()
Expand Down
10 changes: 5 additions & 5 deletions examples/visual_cueing/01r__cueing_singlesub_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#

# Some standard pythonic imports
import os,sys,glob,numpy as np,pandas as pd
import os,numpy as np#,sys,glob,pandas as pd
from collections import OrderedDict
import warnings
warnings.filterwarnings('ignore')
from matplotlib import pyplot as plt
import matplotlib.patches as patches

# MNE functions
from mne import Epochs,find_events, concatenate_raws
from mne import Epochs,find_events#, concatenate_raws
from mne.time_frequency import tfr_morlet

# EEG-Notebooks functions
Expand Down Expand Up @@ -73,7 +73,7 @@
# One way to analyze the SSVEP is to plot the power spectral density, or PSD. SSVEPs should appear as peaks in power for certain frequencies. We expect clear peaks in the spectral domain at the stimulation frequencies of 30 and 20 Hz.
#

raw.plot_psd();
raw.compute_psd().plot();

# Should see the electrical noise at 60 Hz, and maybe a peak at the red and blue channels between 7-14 Hz (Alpha)

Expand All @@ -84,8 +84,8 @@
# Most ERP components are composed of lower frequency fluctuations in the EEG signal. Thus, we can filter out all frequencies between 1 and 30 hz in order to increase our ability to detect them.
#

raw.filter(1,30, method='iir')
raw.plot_psd(fmin=1, fmax=30);
raw.filter(1,30, method='iir');
raw.compute_psd(fmin=1, fmax=30).plot();

###################################################################################################
# Epoching
Expand Down
12 changes: 9 additions & 3 deletions examples/visual_ssvep/01r__ssvep_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# MNE functions
from mne import Epochs,find_events
from mne.time_frequency import psd_welch,tfr_morlet
from mne.time_frequency import tfr_morlet

# EEG-Notebooks functions
from eegnb.analysis.utils import load_data,plot_conditions
Expand Down Expand Up @@ -88,8 +88,14 @@
# Next, we can compare the PSD of epochs specifically during 20hz and 30hz stimulus presentation

f, axs = plt.subplots(2, 1, figsize=(10, 10))
psd1, freq1 = psd_welch(epochs['30 Hz'], n_fft=1028, n_per_seg=256 * 3, picks='all')
psd2, freq2 = psd_welch(epochs['20 Hz'], n_fft=1028, n_per_seg=256 * 3, picks='all')

welch_params=dict(method='welch',
n_fft=1028,
n_per_seg=256 * 3,
picks='all')

psd1, freq1 = epochs['30 Hz'].compute_psd(**welch_params).get_data(return_freqs=True)
psd2, freq2 = epochs['20 Hz'].compute_psd(**welch_params).get_data(return_freqs=True)
psd1 = 10 * np.log10(psd1)
psd2 = 10 * np.log10(psd2)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scikit-learn>=0.23.2
pandas>=1.1.4
numpy>=1.19.4
mne>=0.20.8
seaborn==0.9.0
seaborn>=0.9.0
pyriemann>=0.2.7
jupyter
muselsl>=2.0.2
Expand Down

0 comments on commit 584272e

Please sign in to comment.