Open noah10 opened 3 years ago
I realized that there's another way this bug can manifest: If the data aren't detrended, polynomial_detrend will be called. This returns an RRiDetrended object, which of course lacks a copy method and triggers this same attribute error.
Hey @rhenanbartels and @noah10 , thanks for this amazing package. Is there any bug fix to solve the problem? How to compute AR frequency analysis with detrended and interpolated data when using smoothness_priors()? Thanks
Here's some sample code:
And here is the resulting stack trace:
The problem is here (or at least starts here): https://github.com/rhenanbartels/hrv/blob/190c923250884b1f5632e38658bd8df7d9d5352e/hrv/classical.py#L200
That call to _interpolate_rri returns a numpy.ndarray, meaning that if rri was originally an RRi (or RRiDetrended) instance it isn't any more. That allows the call to data.copy() to succeed, because ndarray has a copy method. If you pass in an RRiDetrended instance where interpolated is True, line 200 is never executed and pburg doesn't get an ndarray, triggering the failure.