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
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 7 additions & 1 deletion meegkit/utils/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ def fit_eeg_distribution(X, min_clean_fraction=0.25, max_dropout_fraction=0.1,
# calculate the distribution's standard deviation from alpha and beta
sig = np.sqrt((alpha ** 2) * gamma(3 / beta) / gamma(1 / beta))

# Ensure scalar values are returned (extract from arrays if needed)
alpha = float(np.asarray(alpha).squeeze())
mu = float(np.asarray(mu).squeeze())
sig = float(np.asarray(sig).squeeze())

return mu, sig, alpha, beta


Expand Down Expand Up @@ -432,7 +437,8 @@ def numf(h, a, nb):
toeplitz(impr, np.concatenate((1, np.zeros((1, nb))), axis=None)),
h.T, rcond=None)[0].T

return b
# Ensure 1D array is returned
return np.atleast_1d(b.squeeze())


def denf(R, na):
Expand Down
5 changes: 3 additions & 2 deletions meegkit/utils/sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ def prony(h, nb, na):

# K-M by N
a_right = np.linalg.lstsq(-H2, h1, rcond=None)[0]
a = np.r_[(np.array([1]), a_right)][None, :]
a = np.r_[(np.array([1]), a_right)]
b = np.dot(np.dot(c, a), H1.T)
return b, a
# Ensure 1D arrays are returned
return np.atleast_1d(b.squeeze()), np.atleast_1d(a.squeeze())
2 changes: 1 addition & 1 deletion meegkit/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def snr_spectrum(X, freqs, n_avg=1, n_harm=1, skipbins=1):

# Ratio
with np.errstate(divide="ignore", invalid="ignore"):
SNR[i_bin, i_trial] = np.sqrt(A) / np.sqrt(B)
SNR[i_bin, i_trial] = np.sqrt(A) / np.sqrt(np.mean(B))

del A
del B
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = {text = "BSD (3-clause)"}
dynamic = ["version", "dependencies"]
description = "M/EEG denoising in Python"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.8"
requires-python = ">=3.9"

[project.urls]
homepage = "https://nbara.github.io/python-meegkit"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_asr_class(method, reref, show=False):

if reref:
if method == "riemann":
with pytest.raises(ValueError, match="Add regularization"):
with pytest.raises(ValueError, match="add regularization"):
blah = ASR(method=method, estimator="scm")
blah.fit(raw2[:, train_idx])

Expand Down