Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: "Unknown key: 'ar_order'." #7

Closed
mehdifirouz opened this issue Jun 28, 2019 · 6 comments
Closed

KeyError: "Unknown key: 'ar_order'." #7

mehdifirouz opened this issue Jun 28, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@mehdifirouz
Copy link

Thanks for your great work. I got the following error, running
results = pyhrv.hrv(nni=nni_base) on Python3.7

Would you please help me.


KeyError Traceback (most recent call last)
in
----> 1 results = pyhrv.hrv(nni=nni_base)

~/venv/lib/python3.7/site-packages/pyhrv/hrv.py in hrv(nni, rpeaks, signal, sampling_rate, interval, plot_ecg, plot_tachogram, show, fbands, kwargs_ecg_plot, kwargs_tachogram, kwargs_time, kwargs_nonlinear, kwargs_welch, kwargs_lomb, kwargs_ar)
284 # COMPUTE FREQUENCY DOMAIN RESULTS (kwargs are verified by the frequency_domain() function)
285 f_results = fd.frequency_domain(nni=nn, fbands=fbands, kwargs_welch=kwargs_welch, kwargs_lomb=kwargs_lomb,
--> 286 kwargs_ar=kwargs_ar, show=False)
287
288 # COMPUTE NONLINEAR PARAMETERS

~/venv/lib/python3.7/site-packages/pyhrv/frequency_domain.py in frequency_domain(nni, rpeaks, signal, sampling_rate, fbands, show, show_param, legend, kwargs_welch, kwargs_lomb, kwargs_ar)
1125 else:
1126 # Compute Autoregressive PSD with default values
-> 1127 ar_results = ar_psd(nn, show=False, fbands=fbands, legend=legend, show_param=show_param)
1128
1129 # If plots should be shown (show all plots at once)

~/venv/lib/python3.7/site-packages/pyhrv/frequency_domain.py in ar_psd(nni, rpeaks, fbands, nfft, order, show, show_param, legend, mode)
497
498 # Plot PSD
--> 499 figure = _plot_psd('ar', frequencies, powers, freq_i, params, show, show_param, legend)
500 figure = utils.ReturnTuple((figure, ), ('ar_plot', ))
501

~/venv/lib/python3.7/site-packages/pyhrv/frequency_domain.py in _plot_psd(method, freq, power, freq_indices, parameters, show, show_param, legend)
904 ax.set_title("PSD - Welch's Method")
905 elif method == 'ar':
--> 906 ax.set_title("PSD - Autoregressive (Order %i)" % parameters['ar_order'])
907 elif method == 'lomb':
908 ax.set_title("PSD - Lomb-Scargle Periodogram")

~/venv/lib/python3.7/site-packages/biosppy/utils.py in getitem(self, key)
405 if isinstance(key, six.string_types):
406 if key not in self._names:
--> 407 raise KeyError("Unknown key: %r." % key)
408
409 key = self._names.index(key)

KeyError: "Unknown key: 'ar_order'."

@PGomes92
Copy link
Owner

Thanks for submitting the issue! I already fixed this malfunction and it will be available int he next pyHRV available which I am planning to release over the next couple of days.

@PGomes92 PGomes92 added this to Bugs & Corrections Backlog in pyHRV Development via automation Jul 4, 2019
@PGomes92 PGomes92 moved this from Bugs & Corrections Backlog to Done in pyHRV Development Jul 4, 2019
@tgterra
Copy link

tgterra commented Aug 14, 2019

Hello Pedro, thank you for your work! When do you plan to release this new fix?

@PGomes92
Copy link
Owner

Hi Thiago, thanks for the positive feedback, I am glad to hear that pyHRV has left a good impression!

Unfortunately, I am a bit behind my planned scheduled update for pyHRV but I am trying to get the new update with a lot of new features and bug fixes (incl. this one) over the next week.

@PGomes92 PGomes92 self-assigned this Aug 30, 2019
@PGomes92 PGomes92 added the bug Something isn't working label Aug 30, 2019
@phiradd
Copy link

phiradd commented Sep 4, 2019

Hi Pedro!

first of all thank you for your great work. Unfortunately I have been getting the same error as in this issue. Can you please tell me when you will be able to fix this?

Thanks again
Philipp

@kra5h
Copy link

kra5h commented Sep 30, 2019

For those who interested in a quick and dirty fix: replace the line 906 of frequency_domain.py with something like:
ax.set_title("PSD - Autoregressive (DIRTY FIX)")

PGomes92 added a commit that referenced this issue Nov 12, 2019
@PGomes92
Copy link
Owner

Closed with update v.0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

5 participants