Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/doc_build_test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
name: Sphinx_build_test

on:
push:
branches:
- develop
paths:
- 'selfeeg/**'
- 'docs/**'
- '.github/workflows/doc_build_test.yml'
pull_request:
branches:
- main
- develop
paths:
- 'selfeeg/**'
- 'docs/**'
Expand All @@ -15,9 +23,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: '3.11'
cache: 'pip'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ on:
push:
branches:
- main
- develop
paths:
- 'selfeeg/**'
- 'test/**'
- '.github/workflows/python-app.yml'
- '.github/workflows/selfeeg_test.yml'
pull_request:
paths:
- 'selfeeg/**'
- 'test/**'
- '.github/workflows/python-app.yml'
- '.github/workflows/selfeeg_test.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -23,14 +24,14 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11"]
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -39,7 +40,8 @@ jobs:
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
pip install torch torchvision
pip install torchaudio
pip install -r requirements.txt
- name: Test with unittest
run: python3 -m unittest discover test "*_test.py"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![PyPI](https://img.shields.io/pypi/v/selfeeg?label=PyPI&color=blue)](https://pypi.org/project/selfeeg/)
[![Conda](https://img.shields.io/conda/vn/conda-forge/selfeeg.svg?color=blue)](https://anaconda.org/conda-forge/selfeeg)
[![Docs](https://img.shields.io/readthedocs/selfeeg)](https://readthedocs.org/projects/selfeeg/)
[![Unittest](https://github.com/MedMaxLab/selfEEG/actions/workflows/python-app.yml/badge.svg)](https://github.com/MedMaxLab/selfEEG/actions/workflows/python-app.yml)
[![Unittest](https://github.com/MedMaxLab/selfEEG/actions/workflows/python-app.yml/badge.svg)](https://github.com/MedMaxLab/selfEEG/actions/workflows/selfeeg_test.yml)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06224/status.svg)](https://doi.org/10.21105/joss.06224)
[![License](https://img.shields.io/badge/License-MIT-violet.svg)](https://github.com/MedMaxLab/selfEEG/blob/main/LICENSE.md)

Expand Down
10 changes: 8 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Version X.X.X (only via git install)

# Version 0.2.2 (latest)

**Functionality**

- **models module**:
- Fix issue in EEGConformer (projection from F to d_model missing in the forward).
- Add TransformEEG model.

**maintenance**

* Improve unittest time

# Version 0.2.1 (latest)
# Version 0.2.1

**Functionality**

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py310', 'py311', 'py312', 'py313']
2 changes: 1 addition & 1 deletion selfeeg/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
0.2.2
6 changes: 3 additions & 3 deletions selfeeg/augmentation/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class StaticSingleAug:
"""

def __init__(
self, augmentation: "function", arguments: list or dict or list[list or dict] = None
self, augmentation: "function", arguments: list | dict | list[list | dict] = None
):

if not (inspect.isfunction(augmentation) or inspect.isbuiltin(augmentation)):
Expand Down Expand Up @@ -252,8 +252,8 @@ def __init__(
self,
augmentation,
discrete_arg: Dict[str, Any] = None,
range_arg: Dict[str, list[int or float, int or float]] = None,
range_type: Dict[str, str or bool] or list[str or bool] = None,
range_arg: Dict[str, list[int | float, int | float]] = None,
range_type: Dict[str, str | bool] | list[str | bool] = None,
):

# set augmentation function
Expand Down
8 changes: 4 additions & 4 deletions selfeeg/augmentation/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def add_band_noise(
x: ArrayLike,
bandwidth: list[tuple[float, float], str, float],
samplerate: float = 256,
noise_range: float or list[float, float] = None,
noise_range: float | list[float, float] = None,
std: float = None,
get_noise: bool = False,
) -> tuple[ArrayLike, Optional[ArrayLike]]:
Expand Down Expand Up @@ -1419,7 +1419,7 @@ def get_filter_coeff(
if btype.lower() == "bandstop":
btype = "lowpass"
else:
message = 'Brainwave "', bandwidth[i], '" not exist. \n'
message = f'Brainwave "{eeg_band}" not exist. \n'
message += "Choose between delta, theta, alpha, beta, "
message += "gamma, gamma_low, gamma_high"
raise ValueError(message)
Expand Down Expand Up @@ -2829,9 +2829,9 @@ def crop_and_resize(
# RE-REFERENCING
def change_ref(
x: ArrayLike,
mode: str or int = "avg",
mode: str | int = "avg",
reference: int = None,
exclude_from_ref: int or list[int] = None,
exclude_from_ref: int | list[int] = None,
) -> ArrayLike:
"""
changes the reference of all EEG record in the ArrayLike object.
Expand Down
38 changes: 19 additions & 19 deletions selfeeg/dataloading/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
# get_eeg_partition_number
def get_eeg_partition_number(
EEGpath: str,
freq: int or float = 250,
window: int or float = 2,
freq: int | float = 250,
window: int | float = 2,
overlap: float = 0.10,
includePartial: bool = True,
file_format: str or list[str] = "*",
file_format: str | list[str] = "*",
load_function: "function" = None,
optional_load_fun_args: list or dict = None,
optional_load_fun_args: list | dict = None,
transform_function: "function" = None,
optional_transform_fun_args: list or dict = None,
optional_transform_fun_args: list | dict = None,
keep_zero_sample: bool = True,
save: bool = False,
save_path: str = None,
Expand Down Expand Up @@ -335,11 +335,11 @@ def get_eeg_split_table(
partition_table: pd.DataFrame,
test_ratio: float = 0.2,
val_ratio: float = 0.2,
test_split_mode: str or int = 2,
val_split_mode: str or int = 2,
exclude_data_id: list or dict = None,
test_data_id: list or dict = None,
val_data_id: list or dict = None,
test_split_mode: str | int = 2,
val_split_mode: str | int = 2,
exclude_data_id: list | dict = None,
test_data_id: list | dict = None,
val_data_id: list | dict = None,
val_ratio_on_all_data: bool = True,
stratified: bool = False,
labels: ArrayLike = None,
Expand Down Expand Up @@ -862,12 +862,12 @@ def get_eeg_split_table_kfold(
partition_table: pd.DataFrame,
kfold: int = 10,
test_ratio: float = 0.2,
test_split_mode: str or int = 2,
val_split_mode: str or int = 2,
exclude_data_id: list or dict = None,
test_data_id: list or dict = None,
test_split_mode: str | int = 2,
val_split_mode: str | int = 2,
exclude_data_id: list | dict = None,
test_data_id: list | dict = None,
stratified: bool = False,
labels: "array like" = None,
labels: ArrayLike = None,
dataset_id_extractor: "function" = None,
subject_id_extractor: "function" = None,
split_tolerance=0.01,
Expand Down Expand Up @@ -1496,9 +1496,9 @@ def __init__(
load_function: "function" = None,
transform_function: "function" = None,
label_function: "function" = None,
optional_load_fun_args: list or dict = None,
optional_transform_fun_args: list or dict = None,
optional_label_fun_args: list or dict = None,
optional_load_fun_args: list | dict = None,
optional_transform_fun_args: list | dict = None,
optional_label_fun_args: list | dict = None,
multilabel_on_load: bool = False,
label_on_load: bool = False,
label_key: list = None,
Expand Down Expand Up @@ -1780,7 +1780,7 @@ def __getitem__(self, index):
(
*dim_idx,
slice(None),
slice(self.currEEG.shape[-1] - Nsample, self.currEEG.shape[-1]),
slice(self.currEEG.shape[-1] - self.Nsample, self.currEEG.shape[-1]),
)
]
else:
Expand Down
2 changes: 2 additions & 0 deletions selfeeg/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
StagerNetEncoder,
STNetEncoder,
TinySleepNetEncoder,
TransformEEGEncoder,
xEEGNetEncoder,
)

Expand All @@ -34,5 +35,6 @@
StagerNet,
STNet,
TinySleepNet,
TransformEEG,
xEEGNet,
)
Loading