EntropyHub icon indicating copy to clipboard operation
EntropyHub copied to clipboard

SampEn and MSE frequently report "inf" values

Open hasibagen opened this issue 1 year ago • 0 comments

Hello,

I've been using the EntropyHub package to compute Sample Entropy (SampEn) and Multiscale Sample Entropy (MSE) for EEG and fMRI data. However, I've encountered frequent occurrences where these functions return "inf" values.

Sample details:

I generated synthetic data to test this:

np.random.seed(42)
n_samples = 2000
time = np.linspace(-30, 60, n_samples)

hbo_signal = (
    0.2 * np.sin(0.2 * time)
    + 0.1 * np.sin(0.05 * time)
    + 0.03 * np.random.normal(size=n_samples)
)
hbr_signal = -0.1 * np.sin(0.2 * time) + 0.05 * np.random.normal(size=n_samples)

Mobj = EH.MSobject("SampEn")
MSx, CI = EH.MSEn(hbo_signal, Mobj, Scales=5, Methodx="modified")

While trying to compute SampEn, the result often comes back as "inf" for certain scales. Question: Why are SampEn and MSE reporting "inf" values so frequently, and is there a way to prevent this issue from occurring? I've observed this both with real and synthetic data, and the issue persists across different packages.

Your help or guidance would be greatly appreciated!

hasibagen avatar Oct 18 '24 07:10 hasibagen