Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.5 #814

Merged
merged 116 commits into from
Jul 9, 2023
Merged

0.2.5 #814

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
275359b
Update README figures
DominiqueMakowski Oct 3, 2022
2890732
use qpeaks to determine end of search for QRS onset
danibene Jan 26, 2023
fb87ab5
Merge branch 'dev' of https://github.com/danibene/NeuroKit into fix/e…
danibene Jan 26, 2023
a6ccb44
Merge branch 'dev' of https://github.com/danibene/NeuroKit into fix/e…
danibene Jan 26, 2023
27cb046
0.2.5
DominiqueMakowski Apr 6, 2023
edc15b1
Merge branch 'neuropsychology:master' into fix/ecg_delineate_order
danibene Apr 14, 2023
ce73a2d
use np.array_equal instead of np.all
danibene Apr 18, 2023
fae8a3e
Merge branch 'neuropsychology:master' into fix/signal_interpolate_arr…
danibene Apr 18, 2023
2de7a70
fix docs bug
DominiqueMakowski Apr 22, 2023
b92e1fb
Merge pull request #816 from danibene/fix/signal_interpolate_array_equal
DominiqueMakowski Apr 22, 2023
6632238
minor fix to intervals_to_peaks
DominiqueMakowski May 11, 2023
b1f8f3c
add total power as HRV feature
danibene May 12, 2023
f712b95
add total power to docstring
danibene May 13, 2023
6ec6c9a
remove test comparing kim2004 eda with biosppy
danibene May 13, 2023
7667c8e
Merge pull request #822 from danibene/feature/total_power_hrv
danibene May 13, 2023
a9072cb
set column to float with numpy array instead of pandas series
danibene May 13, 2023
aa5fc12
set column to float with numpy array instead of pandas series for ppg…
danibene May 13, 2023
96e3af7
update pandas isinteger to avoid deprecation warning
danibene May 13, 2023
c1b1b9d
Merge pull request #825 from danibene/fix/remove_eda_biosppy_test
danibene May 14, 2023
877445e
change how arrays of peaks and onsets are defined for bishop method
danibene May 30, 2023
bf700e1
add bishop method to report test
danibene May 30, 2023
bad8e5d
reduce sampling rate in report test
danibene May 30, 2023
8e12c4d
Merge pull request #833 from danibene/fix/bishop_peaks_format
danibene May 30, 2023
add44af
add interpolation_rate to docstring
danibene May 30, 2023
690eac7
minor
DominiqueMakowski May 30, 2023
811ae01
allow signal_interpolate to process duplicate x values
danibene May 30, 2023
7926903
add akima method of interpolation
danibene May 30, 2023
584e652
use signal_interpolate in ppg_simulate
danibene May 30, 2023
8b8c082
add test case failing with current version
danibene May 30, 2023
878cc79
fix typo in variable name
danibene May 30, 2023
b2a6c19
remove extrapolate argument from akima method
danibene May 30, 2023
6891440
remove scipy.interpolate from imports
danibene May 30, 2023
0ab019d
update filenames for figures in docstrings of complexity_tolerance
danibene May 30, 2023
42fca53
change text associated with link in docstring
danibene May 30, 2023
af3ceb4
use float(ser.iloc[0]) to avoid FutureWarning
danibene May 31, 2023
d8b1cee
remove nk before calling fractal_dfa
danibene May 31, 2023
c5bae06
update pandas isinteger to address FutureWarning
danibene May 31, 2023
52b979b
specify ordered for pick_channels
danibene May 31, 2023
ba39248
only test mean and range of heart rate if sampling rate is greater th…
danibene May 31, 2023
f4206ac
Use float(ser.iloc[0]) for sd1 and sd2
danibene May 31, 2023
47106fd
fix name of RSP_Phase_Completion in docstring
danibene May 31, 2023
ee7079f
Update ecg_process.py
BeardedBioelectronics May 31, 2023
3cf70af
Merge pull request #836 from BeardedBioelectronics/ECG-Typo-Fix
danibene Jun 1, 2023
9a08861
Fixed output
Jun 2, 2023
e7f9995
add test that works on current version of neurokit2
danibene Jun 2, 2023
d06756e
Merge branch 'dev' into fix_output
danibene Jun 2, 2023
b9b2cde
fix typos and updated returns in docstring to reflect output
danibene Jun 2, 2023
1b692c3
Fixed error message for ppg_intervalrelated
Jun 3, 2023
6007ee5
Fixed ppg_intervalrelated (take 2)
Jun 3, 2023
16730e0
Fixed coding style
Jun 3, 2023
41f125b
Fixed df values bug
Jun 3, 2023
eb20130
test dataframe as input
danibene Jun 4, 2023
0fc8471
format with black
danibene Jun 4, 2023
698c25d
Merge pull request #815 from danibene/fix/ecg_delineate_order
DominiqueMakowski Jun 5, 2023
d821ef6
Merge pull request #834 from danibene/docs/intervals_process_returns
DominiqueMakowski Jun 5, 2023
3fa337b
Merge pull request #835 from danibene/fix/ppg_simulate_interpolate
DominiqueMakowski Jun 5, 2023
5116fb4
format + update version supported
DominiqueMakowski Jun 5, 2023
f15e0d9
add handling of NaNs to signal_filter
danibene Jun 7, 2023
b61ab5e
test filtering of signal with NaNs
danibene Jun 7, 2023
6603c57
use nanstd instead of std
danibene Jun 7, 2023
2713a37
change condition to pass test
danibene Jun 7, 2023
9bfec57
add powerline in test_signal_filter_with_missing
danibene Jun 7, 2023
ac39ec1
remove type annotations
danibene Jun 7, 2023
9b953ca
Merge branch 'dev' into fix_output
danibene Jun 7, 2023
0365e2e
use signal_simulate instead of ecg_simulate
danibene Jun 7, 2023
dde6915
change test condition
danibene Jun 7, 2023
cf2d93f
Merge pull request #837 from ThomasGebhardt/fix_output
danibene Jun 7, 2023
d09b295
use linear interpolation
danibene Jun 7, 2023
b92d5a8
add emg_methods
danibene Jun 8, 2023
557d308
address UnboundLocalError
danibene Jun 8, 2023
ab69c24
add neurokit reference and correct reference key
danibene Jun 8, 2023
f0af60d
add interactive plot
danibene Jun 8, 2023
2cb3b24
remove shading from interactive plot
danibene Jun 8, 2023
6dded40
add plt close to avoid plotting twice
danibene Jun 8, 2023
e45a043
add some of the kwargs
danibene Jun 8, 2023
f6d4d2d
Corrected Error in basSQI calculation
Jacob-Liam-Albaugh Jun 12, 2023
fdb9572
Merge pull request #840 from Jacob-Liam-Albaugh/patch-1
DominiqueMakowski Jun 12, 2023
774458f
Merge pull request #839 from danibene/feature/signal_filter_with_missing
danibene Jun 13, 2023
a00fc4c
add more descriptions of the threshold
danibene Jun 14, 2023
f7d16b5
include emg in docstring of report
danibene Jun 14, 2023
51e157a
test more parameters in test_emg_report
danibene Jun 14, 2023
dde915c
style
danibene Jun 14, 2023
5d7f2eb
fix parameters for test_emg_report
danibene Jun 14, 2023
6b2ece7
corrrect name of kwarg
danibene Jun 14, 2023
8cc775c
increase sampling rate for biosppy cleaning method
danibene Jun 14, 2023
76cc736
change dict used to access kwargs
danibene Jun 14, 2023
ce14c6c
get figure returned from function
danibene Jun 14, 2023
75c931f
get emg figure from emg_plot in test
danibene Jun 15, 2023
2bc31bb
remove whitespace
danibene Jun 16, 2023
3779cb7
update ecg_clean biosppy method
DominiqueMakowski Jun 23, 2023
30220ef
fix test
DominiqueMakowski Jun 23, 2023
fdd7f34
fix typo in docstring
danibene Jun 26, 2023
ff8ec3b
add RMSSDSD
DominiqueMakowski Jun 29, 2023
c8c00aa
Update hrv_time.py
DominiqueMakowski Jun 29, 2023
d52ba4f
Merge pull request #852 from danibene/fix/typo_docstring_eda_process
DominiqueMakowski Jul 3, 2023
1e83e32
Update neurokit2/hrv/hrv_time.py
DominiqueMakowski Jul 3, 2023
503ce96
Merge pull request #841 from danibene/feature/report_methods_emg
danibene Jul 3, 2023
5d7d181
fix style
danibene Jul 3, 2023
7f735a6
Merge pull request #849 from neuropsychology/ecg_update_biosppy_clean
DominiqueMakowski Jul 5, 2023
43d0b78
update get_metric in complexity/utils
danibene Jul 5, 2023
59bf6d2
define valid_metrics based on version of sklearn
danibene Jul 5, 2023
0aa4698
check sklearn version in test
danibene Jul 5, 2023
fbcb6b6
specify tornado version
danibene Jul 5, 2023
63ea116
revert pip install
danibene Jul 5, 2023
82e1953
set event loop policy asyncio
danibene Jul 5, 2023
87018a2
Merge pull request #861 from danibene/fix/version_sklearn_get_metric
danibene Jul 5, 2023
a2abcef
Merge pull request #855 from neuropsychology/hrv_rmssd_sd
DominiqueMakowski Jul 5, 2023
9e4dac3
downgrade version of ipykernel
danibene Jul 5, 2023
d11d0a8
downgrade version of ipykernel in docs-build.yml
danibene Jul 5, 2023
51308a8
downgrade version of numpy in docs-check.yml
danibene Jul 5, 2023
f823fb9
downgrade version of numpy in docs-build.yml
danibene Jul 5, 2023
49b5268
Merge pull request #862 from danibene/fix/docs_asyncio_warning
danibene Jul 7, 2023
6ca6552
remove blank line
danibene Jul 7, 2023
8c30b31
[Utils] add fillmissing()
DominiqueMakowski Jul 8, 2023
f2c5c4e
Merge branch 'dev' of https://github.com/neuropsychology/NeuroKit int…
DominiqueMakowski Jul 8, 2023
294196f
style
DominiqueMakowski Jul 8, 2023
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
Prev Previous commit
Next Next commit
minor
- prevent warning in ecg_delineate
- safety check in eventrelated
  • Loading branch information
DominiqueMakowski committed May 30, 2023
commit 690eac7c1809a9f0ea7a9013b5d26af893909131
8 changes: 3 additions & 5 deletions neurokit2/ecg/ecg_delineate.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,11 @@ def _dwt_delineate_tp_peaks(
srch_idx_start = rpeak_ + srch_bndry
srch_idx_end = rpeak_ + 2 * int(rt_duration * sampling_rate)
dwt_local = dwtmatr[degree_tpeak + degree_add, srch_idx_start:srch_idx_end]
height = epsilon_T_weight * np.sqrt(np.mean(np.square(dwt_local)))

if len(dwt_local) == 0:
tpeaks.append(np.nan)
continue

height = epsilon_T_weight * np.sqrt(np.mean(np.square(dwt_local)))
ecg_local = ecg[srch_idx_start:srch_idx_end]
peaks, __ = scipy.signal.find_peaks(np.abs(dwt_local), height=height)
peaks = list(
Expand Down Expand Up @@ -432,12 +431,11 @@ def _dwt_delineate_tp_peaks(
srch_idx_start = rpeak - 2 * int(p2r_duration * sampling_rate)
srch_idx_end = rpeak - srch_bndry
dwt_local = dwtmatr[degree_ppeak + degree_add, srch_idx_start:srch_idx_end]
height = epsilon_P_weight * np.sqrt(np.mean(np.square(dwt_local)))

if len(dwt_local) == 0:
ppeaks.append(np.nan)
continue


height = epsilon_P_weight * np.sqrt(np.mean(np.square(dwt_local)))
ecg_local = ecg[srch_idx_start:srch_idx_end]
peaks, __ = scipy.signal.find_peaks(np.abs(dwt_local), height=height)
peaks = list(filter(lambda p: np.abs(dwt_local[p]) > 0.025 * max(dwt_local), peaks))
Expand Down
15 changes: 10 additions & 5 deletions neurokit2/epochs/eventrelated_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
def _eventrelated_sanitizeinput(epochs, what="ecg", silent=False):
# Sanity checks
if isinstance(epochs, pd.DataFrame):
epochs = _df_to_epochs(epochs) # Convert df to dict
if "Time" in epochs.columns.values:
# Assumpe it is a dataframe of epochs created by `epochs_to_df`
epochs = _df_to_epochs(epochs) # Convert df back to dict
else:
raise ValueError(
"It seems that you are trying to pass a single epoch to an eventrelated function."
+ 'If this is what you want, please wrap it in a dict: `{"0": epoch}` '
)

if not isinstance(epochs, dict):
raise ValueError(
Expand All @@ -37,7 +44,6 @@ def _eventrelated_sanitizeinput(epochs, what="ecg", silent=False):


def _eventrelated_addinfo(epoch, output={}):

# Add label
if "Index" in epoch.columns:
output["Event_Onset"] = epoch.loc[np.min(np.abs(epoch.index))]["Index"]
Expand All @@ -58,7 +64,6 @@ def _eventrelated_addinfo(epoch, output={}):


def _eventrelated_sanitizeoutput(data):

df = pd.DataFrame.from_dict(data, orient="index") # Convert to a dataframe

colnames = df.columns.values
Expand All @@ -76,12 +81,12 @@ def _eventrelated_sanitizeoutput(data):


def _eventrelated_rate(epoch, output={}, var="ECG_Rate"):

# Sanitize input
colnames = epoch.columns.values
if len([i for i in colnames if var in i]) == 0:
warn(
"Input does not have an `" + var + "` column." " Will skip all rate-related features.",
"Input does not have an `" + var + "` column."
" Will skip all rate-related features.",
category=NeuroKitWarning,
)
return output
Expand Down