When running rsp_process on my sample, I encountered the following error:
ValueError: Number of samples, -1, must be non-negative.
This error occurs during the RVT calculation, and I discovered that fr_phase has the same values around the corresponding indexes in _rsp_rvt_harrison
. By applying the following patch to _rsp_rvt_find_min, the error is resolved:
--- a/neurokit2/rsp/rsp_rvt.py
+++ b/neurokit2/rsp/rsp_rvt.py
@@ -325,7 +325,7 @@ def _rsp_rvt_find_min(increase_inds, fr_phase, smaller_index, silent):
n_min = increase_inds[bigger_n_max]
fr_min = fr_phase[n_min].squeeze()
# Sometime fr_min is the same as n_max and it caused problems
- if fr_phase[smaller_index].squeeze() < fr_min:
+ if fr_phase[smaller_index].squeeze() <= fr_min:
if not silent:
warn(
"rsp_rvt(): The next bigger increasing index has a bigger value than the chosen decreasing index, "
But the code contains the following comment:
# Sometime fr_min is the same as n_max and it caused problems
What specific problems occur when fr_min is the same as n_max?
Should I avoid this calculation if this condition arises, or can the above patch be applied?
When running
rsp_process
on my sample, I encountered the following error:This error occurs during the RVT calculation, and I discovered that
fr_phase
has the same values around the corresponding indexes in _rsp_rvt_harrison . By applying the following patch to _rsp_rvt_find_min, the error is resolved:But the code contains the following comment:
fr_min
is the same asn_max
?