2025-01-15 12:21:10 +03:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
2025-02-16 01:41:18 +01:00
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
# build-system
|
2025-01-15 12:21:10 +03:00
|
|
|
setuptools,
|
2025-02-16 01:41:18 +01:00
|
|
|
|
|
|
|
# dependencies
|
2025-01-15 12:21:10 +03:00
|
|
|
matplotlib,
|
2025-02-16 01:41:18 +01:00
|
|
|
numpy,
|
|
|
|
pandas,
|
2025-01-15 12:21:10 +03:00
|
|
|
requests,
|
2025-02-16 01:41:18 +01:00
|
|
|
scikit-learn,
|
|
|
|
scipy,
|
|
|
|
|
|
|
|
# tests
|
2025-01-15 12:21:10 +03:00
|
|
|
astropy,
|
|
|
|
coverage,
|
2025-02-16 01:41:18 +01:00
|
|
|
mock,
|
|
|
|
plotly,
|
|
|
|
pytest-cov-stub,
|
2025-01-15 12:21:10 +03:00
|
|
|
pytestCheckHook,
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "neurokit2";
|
|
|
|
version = "0.2.10";
|
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "neuropsychology";
|
|
|
|
repo = "NeuroKit";
|
|
|
|
tag = "v${version}";
|
|
|
|
hash = "sha256-e/B1JvO6uYZ6iVskFvxZLSSXi0cPep9bBZ0JXZTVS28=";
|
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2025-02-16 01:41:18 +01:00
|
|
|
--replace-fail '"pytest-runner", ' ""
|
2025-01-15 12:21:10 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
matplotlib
|
2025-02-16 01:41:18 +01:00
|
|
|
numpy
|
|
|
|
pandas
|
2025-01-15 12:21:10 +03:00
|
|
|
requests
|
2025-02-16 01:41:18 +01:00
|
|
|
scikit-learn
|
|
|
|
scipy
|
2025-01-15 12:21:10 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytest-cov-stub
|
|
|
|
mock
|
|
|
|
plotly
|
|
|
|
astropy
|
|
|
|
coverage
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
# Crash in matplotlib (Fatal Python error: Aborted)
|
|
|
|
"test_events_plot"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# Required dependencies not available in nixpkgs
|
|
|
|
"tests/tests_bio.py"
|
2025-02-16 01:41:18 +01:00
|
|
|
"tests/tests_complexity.py"
|
2025-01-15 12:21:10 +03:00
|
|
|
"tests/tests_data.py"
|
2025-02-16 01:41:18 +01:00
|
|
|
"tests/tests_ecg.py"
|
|
|
|
"tests/tests_ecg_delineate.py"
|
2025-01-15 12:21:10 +03:00
|
|
|
"tests/tests_ecg_findpeaks.py"
|
|
|
|
"tests/tests_eda.py"
|
2025-02-16 01:41:18 +01:00
|
|
|
"tests/tests_eeg.py"
|
2025-01-15 12:21:10 +03:00
|
|
|
"tests/tests_emg.py"
|
2025-02-16 01:41:18 +01:00
|
|
|
"tests/tests_eog.py"
|
|
|
|
"tests/tests_epochs.py"
|
2025-01-15 12:21:10 +03:00
|
|
|
"tests/tests_hrv.py"
|
|
|
|
"tests/tests_ppg.py"
|
2025-02-16 01:41:18 +01:00
|
|
|
"tests/tests_rsp.py"
|
2025-01-15 12:21:10 +03:00
|
|
|
"tests/tests_signal.py"
|
|
|
|
|
|
|
|
# Dependency is broken `mne-python`
|
|
|
|
"tests/tests_microstates.py"
|
|
|
|
];
|
|
|
|
|
2025-05-01 03:46:26 +08:00
|
|
|
pytestFlags = [
|
2025-02-16 01:41:18 +01:00
|
|
|
# Otherwise, test collection fails with:
|
|
|
|
# AttributeError: module 'scipy.ndimage._delegators' has no attribute '@py_builtins_signature'. Did you mean: 'grey_dilation_signature'?
|
|
|
|
# https://github.com/scipy/scipy/issues/22236
|
|
|
|
"--assert=plain"
|
|
|
|
];
|
|
|
|
|
2025-01-15 12:21:10 +03:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"neurokit2"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Python Toolbox for Neurophysiological Signal Processing";
|
|
|
|
homepage = "https://github.com/neuropsychology/NeuroKit";
|
|
|
|
changelog = "https://github.com/neuropsychology/NeuroKit/releases/tag/v${version}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ genga898 ];
|
|
|
|
};
|
|
|
|
}
|