antropy icon indicating copy to clipboard operation
antropy copied to clipboard

sample_entropy not matching data types

Open fstinner opened this issue 2 years ago • 2 comments

I always get error messages with the function "sample_entropy" that the types at _numba_sampen are not the correct ones: "No matching definition for argument type(s) readonly array(float64, 1d, C), int64, float64".

I was able to fix the error by hard specifying the data types: Old: if metric == "chebyshev" and x.size < 5000: return _numba_sampen(x, order=order, r=0.2 * x.std(ddof=0))

New: if metric == "chebyshev" and x.size < 5000: return _numba_sampen(x.astype(np.float64), order=np.int32(order), r=np.float64(0.2 * x.std(ddof=0)))

fstinner avatar May 24 '23 21:05 fstinner

Hi @fstinner,

  1. Can you share an example code that would produce the error?
  2. That's surprising because we already enforce that x is a float64. But better safe than sorry, please feel free to submit the above modifications as a PR!

raphaelvallat avatar May 26 '23 07:05 raphaelvallat

I had the same issue @fstinner's solution solved it for me.

sderooij avatar Sep 05 '23 13:09 sderooij