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.7 #901

Merged
merged 37 commits into from
Nov 6, 2023
Merged

0.2.7 #901

Changes from 6 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
00f73cc
adjust delay
DominiqueMakowski Aug 29, 2023
1570a10
change coarsegraining
DominiqueMakowski Aug 30, 2023
a12ce58
entropy_sample: return phi in info dict
DominiqueMakowski Aug 31, 2023
820d0d9
return more info in entropy_sample
DominiqueMakowski Aug 31, 2023
487407d
Update utils_complexity_coarsegraining.py
DominiqueMakowski Sep 4, 2023
5768e51
0.2.7
DominiqueMakowski Sep 12, 2023
c5e95d3
Merge branch 'dev' into fix_entropymultiscale
DominiqueMakowski Sep 13, 2023
6fbef91
rename .utils to .utils_entropy
DominiqueMakowski Sep 15, 2023
aea7de4
complexity_decorrelation(): add 'show' argument
DominiqueMakowski Sep 16, 2023
731405c
linting
DominiqueMakowski Sep 16, 2023
41b923a
move entropy_approximate internals and add entropy_quadratic
DominiqueMakowski Sep 16, 2023
ec67af6
add to docs
DominiqueMakowski Sep 16, 2023
19d5487
Update entropy_svd.py
DominiqueMakowski Sep 16, 2023
f4b63f0
add makowski method LLE
DominiqueMakowski Sep 21, 2023
9af817e
Update complexity_lyapunov.py
DominiqueMakowski Sep 21, 2023
067f1cc
fix scikit-learn #910
DominiqueMakowski Sep 21, 2023
a7382fd
Update entropy_quadratic.py
DominiqueMakowski Sep 21, 2023
e424839
Merge pull request #892 from neuropsychology/fix_entropymultiscale
DominiqueMakowski Sep 22, 2023
763e419
Merge branch 'dev' into lyapunov
DominiqueMakowski Sep 22, 2023
97ef675
fix test
DominiqueMakowski Sep 22, 2023
9dffa6f
minor docs
DominiqueMakowski Sep 27, 2023
215f2fa
Update eda_plot.py
mperreir Oct 2, 2023
b05a700
Update eda_intervalrelated.py
mperreir Oct 2, 2023
379d219
Merge pull request #916 from mperreir/fix_plot_eda
DominiqueMakowski Oct 2, 2023
44959c6
Merge pull request #906 from neuropsychology/lyapunov
DominiqueMakowski Oct 2, 2023
beea596
Merge branch 'dev' into pr/917
DominiqueMakowski Oct 2, 2023
5a1d2ad
Update eda_intervalrelated.py
mperreir Oct 3, 2023
6d611c9
Merge branch 'fix_eda_intervalrelated' of https://github.com/mperreir…
mperreir Oct 3, 2023
984194a
minor renaming
DominiqueMakowski Oct 3, 2023
484dd7f
Merge pull request #917 from mperreir/fix_eda_intervalrelated
DominiqueMakowski Oct 9, 2023
d7120b4
comment off intervals_process example
DominiqueMakowski Oct 9, 2023
4cd82c6
add new detector
DominiqueMakowski Oct 24, 2023
b4a57f2
Update read_xdf.py
DominiqueMakowski Oct 24, 2023
323929f
Merge pull request #920 from neuropsychology/ecg_peak_manikandan
DominiqueMakowski Oct 25, 2023
7ab0277
fixed sklearn sanity checks for valid_metrics
stamate Nov 2, 2023
76a1efa
Merge branch 'dev' into pr/925
DominiqueMakowski Nov 2, 2023
c1e38e1
Merge pull request #925 from stamate/bugfix-sklearn_version_valid_met…
DominiqueMakowski Nov 2, 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
31 changes: 16 additions & 15 deletions neurokit2/eda/eda_intervalrelated.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def eda_intervalrelated(data, sampling_rate=1000, **kwargs):
# Add label info
results[index]["Label"] = data[index]["Label"].iloc[0]

results[index] = _eda_intervalrelated(
data[index], results[index], sampling_rate=sampling_rate, **kwargs
)
results[index] = _eda_intervalrelated(data[index], results[index], sampling_rate=sampling_rate, **kwargs)

results = pd.DataFrame.from_dict(results, orient="index")

Expand All @@ -89,9 +87,7 @@ def eda_intervalrelated(data, sampling_rate=1000, **kwargs):
# =============================================================================


def _eda_intervalrelated(
data, output={}, sampling_rate=1000, method_sympathetic="posada", **kwargs
):
def _eda_intervalrelated(data, output={}, sampling_rate=1000, method_sympathetic="posada", **kwargs):
"""Format input for dictionary."""
# Sanitize input
colnames = data.columns.values
Expand All @@ -114,7 +110,12 @@ def _eda_intervalrelated(
)
output["SCR_Peaks_Amplitude_Mean"] = np.nan
else:
output["SCR_Peaks_Amplitude_Mean"] = np.nanmean(data["SCR_Amplitude"].values)
peaks_idx = data["SCR_Peaks"] == 1
# Mean amplitude is only computed over peaks. If no peaks, return NaN
if peaks_idx.sum() > 0:
output["SCR_Peaks_Amplitude_Mean"] = np.nanmean(data[peaks_idx]["SCR_Amplitude"].values)
else:
output["SCR_Peaks_Amplitude_Mean"] = np.nan

# Get variability of tonic
if "EDA_Tonic" in colnames:
Expand All @@ -126,28 +127,28 @@ def _eda_intervalrelated(
if "EDA_Clean" in colnames:
output.update(
eda_sympathetic(
data["EDA_Clean"], sampling_rate=sampling_rate, method=method_sympathetic
data["EDA_Clean"],
sampling_rate=sampling_rate,
method=method_sympathetic,
)
)
elif "EDA_Raw" in colnames:
# If not clean signal, use raw
output.update(
eda_sympathetic(
data["EDA_Raw"], sampling_rate=sampling_rate, method=method_sympathetic
data["EDA_Raw"],
sampling_rate=sampling_rate,
method=method_sympathetic,
)
)

# EDA autocorrelation
output.update({"EDA_Autocorrelation": np.nan}) # Default values
if len(data) > sampling_rate * 30: # 30 seconds minimum (NOTE: somewhat arbitrary)
if "EDA_Clean" in colnames:
output["EDA_Autocorrelation"] = eda_autocor(
data["EDA_Clean"], sampling_rate=sampling_rate, **kwargs
)
output["EDA_Autocorrelation"] = eda_autocor(data["EDA_Clean"], sampling_rate=sampling_rate, **kwargs)
elif "EDA_Raw" in colnames:
# If not clean signal, use raw
output["EDA_Autocorrelation"] = eda_autocor(
data["EDA_Raw"], sampling_rate=sampling_rate, **kwargs
)
output["EDA_Autocorrelation"] = eda_autocor(data["EDA_Raw"], sampling_rate=sampling_rate, **kwargs)

return output
Loading