Skip to content

Commit

Permalink
Merge pull request #705 from neuropsychology/dev
Browse files Browse the repository at this point in the history
0.2.2
  • Loading branch information
DominiqueMakowski authored Nov 15, 2022
2 parents 5cd089e + 9ddf090 commit a1f317b
Show file tree
Hide file tree
Showing 153 changed files with 5,272 additions and 1,813 deletions.
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# # Number of days of inactivity before an issue becomes stale
# daysUntilStale: 180
# # Number of days of inactivity before a stale issue is closed
# daysUntilClose: 180
# daysUntilClose: 360
# # Issues with these labels will never be considered stale
# exemptLabels:
# - feature idea 🔥
Expand All @@ -14,4 +14,4 @@
# recent activity. It will eventually be closed if no further activity occurs.
# # Comment to post when closing a stale issue. Set to `false` to disable
# closeComment: >
# This issue has been inactive for a long time. We're closing it (but feel free to reopen it if need be).
# This issue has been inactive for a long time. We're closing it (but feel free to reopen it if need be).
1 change: 1 addition & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
pip install seaborn
pip install EMD-signal
pip install cvxopt
pip install ts2vg
pip install https://github.com/neuropsychology/neurokit/zipball/dev
- name: Build documentation 📜
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
pip install seaborn
pip install EMD-signal
pip install cvxopt
pip install ts2vg
pip install https://github.com/neuropsychology/neurokit/zipball/dev
- name: Build documentation 📜
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -39,4 +39,4 @@ jobs:
cd $GITHUB_WORKSPACE && python -m tox -e py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ ENV/
# vscode stuff
.vscode/

# PyCharm stuff
.idea/

# Rope project settings
.ropeproject

Expand Down
16 changes: 0 additions & 16 deletions .idea/NeuroKit.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/other.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

116 changes: 0 additions & 116 deletions .idea/workspace.xml

This file was deleted.

1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Contributors
* `Patryk Wielopolski <https://github.com/pfilo8>`_ *(Wrocław University of Science and Technology, Poland)*
* `Jannik Gut <https://github.com/rostro36>`_
* `Nattapong Thammasan <https://github.com/Nattapong-OnePlanet>`_ *(OnePlanet, Netherlands)*
* `Marek Sokol <https://github.com/sokolmarek>`_ *(Faculty of Biomedical Engineering of the CTU in Prague, Czech Republic)*


Thanks also to `Gansheng Tan <https://github.com/GanshengT>`_, `Chuan-Peng Hu <https://github.com/hcp4715>`_, `@ucohen <https://github.com/ucohen>`_, `Anthony Gatti <https://github.com/gattia>`_, `Julien Lamour <https://github.com/lamourj>`_, `@renatosc <https://github.com/renatosc>`_, `Nicolas Beaudoin-Gagnon <https://github.com/Fegalf>`_ and `@rubinovitz <https://github.com/rubinovitz>`_ for their contribution in `NeuroKit 1 <https://github.com/neuropsychology/NeuroKit.py>`_.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Complexity (Entropy, Fractal Dimensions, ...)
.. code-block:: python
# Generate signal
signal = nk.signal_simulate(frequency=[1, 3], noise=0.01, sampling_rate=100)
signal = nk.signal_simulate(frequency=[1, 3], noise=0.01, sampling_rate=200)
# Find optimal time delay, embedding dimension and r
parameters = nk.complexity_optimize(signal, show=True)
Expand Down
Binary file added data/eeg_1min_200hz.pickle
Binary file not shown.
20 changes: 20 additions & 0 deletions data/eeg_1min_200hz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pickle

import mne

raw = mne.io.read_raw_fif(
mne.datasets.sample.data_path() / "MEG/sample/sample_audvis_raw.fif",
preload=True,
verbose=False,
)
raw = raw.pick(["eeg", "eog", "stim"], verbose=False)
raw = raw.crop(0, 60)
raw = raw.resample(200)

# raw.ch_names

# raw.info["sfreq"]

# Store data (serialize)
with open("eeg_1min_200hz.pickle", "wb") as handle:
pickle.dump(raw, handle, protocol=pickle.HIGHEST_PROTOCOL)
20 changes: 12 additions & 8 deletions data/eeg_resting_8min.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

import neurokit2 as nk

# EDF TO FIF
# ==========
# Read original file (too big to be uploaded on github)
raw = mne.io.read_raw_edf("eeg_restingstate_3000hz.edf", preload=True)

# Find event onset and cut
event = nk.events_find(raw.copy().pick_channels(["Foto"]).to_data_frame()["Foto"])
tmin = event["onset"][0] / 3000
raw = raw.crop(tmin=tmin, tmax=tmin+8*60)
raw = raw.crop(tmin=tmin, tmax=tmin + 8 * 60)


# EOG
Expand All @@ -21,21 +23,23 @@


# Montage
mne.rename_channels(raw.info, dict(zip(raw.info["ch_names"], TruScanEEGpy.convert_to_tenfive(raw.info["ch_names"]))))
mne.rename_channels(
raw.info, dict(zip(raw.info["ch_names"], TruScanEEGpy.convert_to_tenfive(raw.info["ch_names"])))
)
montage = TruScanEEGpy.montage_mne_128(TruScanEEGpy.layout_128(names="10-5"))
extra_channels = np.array(raw.info["ch_names"])[np.array([i not in montage.ch_names for i in raw.info["ch_names"]])]
extra_channels = np.array(raw.info["ch_names"])[
np.array([i not in montage.ch_names for i in raw.info["ch_names"]])
]
raw = raw.drop_channels(extra_channels[np.array([i not in ["EOG"] for i in extra_channels])])
raw = raw.set_montage(montage)



# Save
raw = raw.resample(300)
raw.save("eeg_restingstate_300hz.fif", overwrite=True)



## Convert to df
#df = pd.DataFrame(raw.get_data().T)
#df.columns = raw.info["ch_names"]
#df.to_csv("eeg_restingstate_300hz.csv")
# df = pd.DataFrame(raw.get_data().T)
# df.columns = raw.info["ch_names"]
# df.to_csv("eeg_restingstate_300hz.csv")
27 changes: 18 additions & 9 deletions docs/examples/bio_custom/bio_custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@
"# Load NeuroKit and other useful packages\n",
"import neurokit2 as nk\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"execution_count": null,
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# This \"decorative\" cell should be hidden from the docs once this is implemented:\n",
"# https://github.com/microsoft/vscode-jupyter/issues/1182 \n",
"plt.rcParams['figure.figsize'] = [15, 5] # Bigger images\n",
"# Note: this cell is hidden using the \"remove-input\" tag\n",
"# Make bigger images\n",
"import matplotlib.pyplot as plt\n",
"plt.rcParams['figure.figsize'] = [15, 5] \n",
"plt.rcParams['font.size']= 14"
]
},
Expand Down Expand Up @@ -318,7 +322,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3.9.7 64-bit",
"language": "python",
"name": "python3"
},
Expand All @@ -332,9 +336,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
},
"vscode": {
"interpreter": {
"hash": "11938c6bc6919ae2720b4d5011047913343b08a43b18698fd82dedb0d4417594"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Loading

0 comments on commit a1f317b

Please sign in to comment.