You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interval_process is defined as taking **kwargs (to be passed to :func:.signal_interpolate), and signal_interpolate is written as taking **kwargs:
In interval_process.py, line 124: intervals = signal_interpolate(intervals_time, intervals, x_new=x_new, **kwargs)
But the definition of signal_interpolate does not allow for **kwargs:
Backstory is, I was trying to use **kwargs when using hrv_frequency, to set parameters for signal_power (e.g., change the windows length for psd computation), like this for example:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File d:\BBSIG\bbsig_hrv.py:3
[1](file:XXX/bbsig_hrv.py:1) #%%
[2](file:XXX/bbsig_hrv.py:2) #Test changing window type
----> [3](file:XXX/bbsig_hrv.py:3) nk.hrv_frequency(rrs_dict, interpolation_rate=4, normalize=False, psd_method='welch', **{'nperseg':4*256, 'window_type':'hann'})
File XXX\Lib\site-packages\neurokit2\hrv\hrv_frequency.py:189, in hrv_frequency(peaks, sampling_rate, ulf, vlf, lf, hf, vhf, psd_method, show, silent, normalize, order_criteria, interpolation_rate, **kwargs)
[186](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:186) rri, rri_time, _ = _hrv_format_input(peaks, sampling_rate=sampling_rate)
[188](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:188) # Process R-R intervals (interpolated at 100 Hz by default)
--> [189](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:189) rri, rri_time, sampling_rate = intervals_process(
[190](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:190) rri, intervals_time=rri_time, interpolate=True, interpolation_rate=interpolation_rate, **kwargs
[191](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:191) )
[193](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:193) if interpolation_rate is None:
[194](file:XXX/Lib/site-packages/neurokit2/hrv/hrv_frequency.py:194) t = rri_time
File XXX\Lib\site-packages\neurokit2\hrv\intervals_process.py:124, in intervals_process(intervals, intervals_time, interpolate, interpolation_rate, detrend, **kwargs)
[117](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:117) # Compute x-values of interpolated interval signal at requested sampling rate.
[118](XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:118) x_new = np.arange(
[119](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:119) start=intervals_time[0],
[120](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:120) stop=intervals_time[-1] + 1 / interpolation_rate,
[121](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:121) step=1 / interpolation_rate,
[122](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:122) )
--> [124](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:124) intervals = signal_interpolate(intervals_time, intervals, x_new=x_new, **kwargs)
[125](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:125) intervals_time = x_new
[126](file:XXX/Lib/site-packages/neurokit2/hrv/intervals_process.py:126) else:
[127](file:XXX/site-packages/neurokit2/hrv/intervals_process.py:127) # check if intervals appear to be already interpolated
TypeError: signal_interpolate() got an unexpected keyword argument 'nperseg'
---------------------------------------------------------------------------
Expected behaviour
In general, I think it would be useful to be able to change the parameters of the psd computation when using hrv_frequency, in case the user wants parameters similar to Kubios or Systole for example.
System Specifications
OS: Windows (WindowsPE 64bit)
Python: 3.11.9
NeuroKit2: 0.2.10
NumPy: 1.26.0
Pandas: 2.2.2
SciPy: 1.14.0
sklearn: 1.5.1
matplotlib: 3.9.1
The text was updated successfully, but these errors were encountered:
Description of the bug
interval_process
is defined as taking **kwargs (to be passed to :func:.signal_interpolate
), andsignal_interpolate
is written as taking **kwargs:In interval_process.py, line 124:
intervals = signal_interpolate(intervals_time, intervals, x_new=x_new, **kwargs)
But the definition of signal_interpolate does not allow for **kwargs:
Replication
Backstory is, I was trying to use **kwargs when using
hrv_frequency
, to set parameters forsignal_power
(e.g., change the windows length for psd computation), like this for example:Though this gave me the following error message:
Expected behaviour
In general, I think it would be useful to be able to change the parameters of the psd computation when using
hrv_frequency
, in case the user wants parameters similar to Kubios or Systole for example.System Specifications
OS: Windows (WindowsPE 64bit)
Python: 3.11.9
NeuroKit2: 0.2.10
NumPy: 1.26.0
Pandas: 2.2.2
SciPy: 1.14.0
sklearn: 1.5.1
matplotlib: 3.9.1
The text was updated successfully, but these errors were encountered: