Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:mrosol/NeuroKit into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Rosoł authored and Maciej Rosoł committed Dec 12, 2024
2 parents e45d13b + a707a2d commit 11e7cb7
Show file tree
Hide file tree
Showing 77 changed files with 2,006 additions and 578 deletions.
43 changes: 0 additions & 43 deletions .codeclimate.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
pip install EMD-signal
pip install cvxopt
pip install ts2vg
pip install pickleshare
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 @@ -38,6 +38,7 @@ jobs:
pip install EMD-signal
pip install cvxopt
pip install ts2vg
pip install pickleshare
pip install https://github.com/neuropsychology/neurokit/zipball/dev
- name: Build documentation 📜
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/releasePR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
run: python setup.py sdist bdist_wheel

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
#if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Contributors
* `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)*
* `Johannes Herforth <https://github.com/DerAndereJohannes>`_ *(University of Luxembourg, Luxembourg)*


Thanks also to `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
11 changes: 11 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
News
=====

0.2.8
-------------------
New Features
+++++++++++++

* New feature `events_find()`: is now able to combine multiple digital input channels,
retrieve events from the combined events channel and differentiate between the inputs that
occur simultaneously.



0.2.4
-------------------
Fixes
Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
.. image:: https://codecov.io/gh/neuropsychology/NeuroKit/branch/master/graph/badge.svg
:target: https://codecov.io/gh/neuropsychology/NeuroKit

.. image:: https://api.codeclimate.com/v1/badges/517cb22bd60238174acf/maintainability
:target: https://codeclimate.com/github/neuropsychology/NeuroKit/maintainability
:alt: Maintainability



**The Python Toolbox for Neurophysiological Signal Processing**
Expand All @@ -44,6 +42,7 @@ Quick Example
# Compute relevant features
results = nk.bio_analyze(processed_data, sampling_rate=100)
And **boom** 💥 your analysis is done 😎

Download
Expand Down
4 changes: 2 additions & 2 deletions data/gudb/download_gudb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# creating class which loads the experiment
ecg_class = ecg_gudb_database.GUDb(participant, experiment)

# Chest Strap Data - only donwload if R-peaks annotations are available
# Chest Strap Data - only download if R-peaks annotations are available
if ecg_class.anno_cs_exists:

data = pd.DataFrame({"ECG": ecg_class.cs_V2_V1})
Expand All @@ -41,7 +41,7 @@
anno = pd.DataFrame({"Rpeaks": ecg_class.anno_cs})
anno["Participant"] = "GUDB_%.2i" %(participant)
anno["Sampling_Rate"] = 250
anno["Database"] = "GUDB (" + experiment + ")"
anno["Database"] = "GUDB_" + experiment

# Store with the rest
dfs_ecg.append(data)
Expand Down
24 changes: 12 additions & 12 deletions data/ludb/download_ludb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
The database consists of 200 10-second 12-lead ECG signal records representing different morphologies of the ECG signal. The ECGs were collected from healthy volunteers and patients, which had various cardiovascular diseases. The boundaries of P, T waves and QRS complexes were manually annotated by cardiologists for all 200 records.
Steps:
1. In the command line, run 'pip install gsutil'
2. Then, 'gsutil -m cp -r gs://ludb-1.0.0.physionet.org D:/YOURPATH/NeuroKit/data/ludb'
This will download all the files in a folder named 'ludb-1.0.0.physionet.org' at the
destination you entered.
1. Download zipped data base from https://physionet.org/content/ludb/1.0.1/
2. Unzip the folder so that you have a `lobachevsky-university-electrocardiography-database-1.0.1/` folder'
3. Run this script.
"""
import pandas as pd
Expand All @@ -16,31 +14,33 @@
import os


files = os.listdir("./ludb-1.0.0.physionet.org/")

dfs_ecg = []
dfs_rpeaks = []


for participant in range(200):
filename = str(participant + 1)

data, info = wfdb.rdsamp("./ludb-1.0.0.physionet.org/" + filename)
data, info = wfdb.rdsamp(
"./lobachevsky-university-electrocardiography-database-1.0.1/data/" + filename
)

# Get signal
data = pd.DataFrame(data, columns=info["sig_name"])
data = data[["i"]].rename(columns={"i": "ECG"})
data["Participant"] = "LUDB_%.2i" %(participant + 1)
data["Participant"] = "LUDB_%.2i" % (participant + 1)
data["Sample"] = range(len(data))
data["Sampling_Rate"] = info['fs']
data["Sampling_Rate"] = info["fs"]
data["Database"] = "LUDB"

# Get annotations
anno = wfdb.rdann("./ludb-1.0.0.physionet.org/" + filename, 'atr_i')
anno = wfdb.rdann(
"./lobachevsky-university-electrocardiography-database-1.0.1/data/" + filename, "i"
)
anno = anno.sample[np.where(np.array(anno.symbol) == "N")[0]]
anno = pd.DataFrame({"Rpeaks": anno})
anno["Participant"] = "LUDB_%.2i" %(participant + 1)
anno["Sampling_Rate"] = info['fs']
anno["Participant"] = "LUDB_%.2i" % (participant + 1)
anno["Sampling_Rate"] = info["fs"]
anno["Database"] = "LUDB"

# Store with the rest
Expand Down
Empty file.
88 changes: 88 additions & 0 deletions docs/codebook.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Codebook
========

Here you can download the complete codebook which details the variables that you can compute using the NeuroKit package.

.. raw:: html

<div style="text-align: center;">
<a href="_static/neurokit_codebook.csv" download="neurokit_codebook.csv">
<button style="background-color: #4CAF50; color: white; padding: 10px 20px; margin: 10px; border: none; cursor: pointer; width: 50%;">Download Codebook</button>
</a>
</div>

This codebook contains detailed descriptions of all variables, their descriptions, and additional metadata.


Codebook Table
==============

.. raw:: html

<style>
#csvDataTable {
width: 100%;
border-collapse: collapse;
}
#csvDataTable th, #csvDataTable td {
padding: 8px 12px;
border: 1px solid #ccc;
text-align: left;
}
</style>

<div id="csv-table">
<table id="csvDataTable">
</table>
</div>

<script>
function parseCSVLine(text) {
const cols = [];
let col = '';
let insideQuotes = false;
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (insideQuotes && char === '"' && text[i + 1] == '"') {
i++;
col += char;
continue;
}
if (char === '"' && text[i - 1] !== '\\') {
insideQuotes = !insideQuotes;
continue;
}
if (char === ',' && !insideQuotes) {
cols.push(col);
col = '';
} else {
col += char;
}
}
cols.push(col);
return cols.map(field => field.replace(/""/g, '"')); // Replace escaped quotes
}
document.addEventListener("DOMContentLoaded", function() {
fetch('_static/neurokit_codebook.csv')
.then(response => response.text())
.then(csv => {
let lines = csv.trim().split('\n');
let html = '<tr><th>' + parseCSVLine(lines[0]).join('</th><th>') + '</th></tr>';
for (let i = 1; i < lines.length; i++) {
html += '<tr><td>' + parseCSVLine(lines[i]).join('</td><td>') + '</td></tr>';
}
document.getElementById('csvDataTable').innerHTML = html;
})
.catch(error => console.error('Error loading the CSV file:', error));
});
</script>

6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath("../"))


Expand Down Expand Up @@ -69,6 +69,7 @@ def find_version():
"sphinxemoji.sphinxemoji",
"sphinx_copybutton",
"myst_nb",
"directives.csv_codebook_directive",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -131,8 +132,9 @@ def find_version():
"use_issues_button": True,
"path_to_docs": "docs/",
"use_edit_page_button": True,
"logo_only": True,
# "logo_only": True,
"show_toc_level": 1,
"navigation_with_keys": False,
}


Expand Down
Loading

0 comments on commit 11e7cb7

Please sign in to comment.