Skip to content

gh.plot_hypothesis1 error in windows python conda #517

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

Open
cesar-moya opened this issue Nov 19, 2024 · 2 comments
Open

gh.plot_hypothesis1 error in windows python conda #517

cesar-moya opened this issue Nov 19, 2024 · 2 comments

Comments

@cesar-moya
Copy link

cesar-moya commented Nov 19, 2024

First off, thank you for such an an amazing book. I am experiencing this issue where some plots (not all) throw the below error in a windows environment using conda. Not sure if it's a bug or an issue on my side, if possible please let me know:

File: 01-g-h-filter.ipynb
Cell: 8

import kf_book.gh_internal as gh
gh.plot_hypothesis1()

Error:

c:\Kalman-and-Bayesian-Filters-in-Python\kf_book\gh_internal.py:140: SyntaxWarning: invalid escape sequence '\h'
  plt.text (0.0, 159.8, "last estimate ($\hat{x}_{t-1}$)", ha='left', va='top',fontsize=18)

Thanks,

@fnndyl
Copy link

fnndyl commented Jan 13, 2025

I am also having this issue, may be something to do with an update since this was written 3/4 years ago in matplotlib? But I am not an expert.

@cm-1
Copy link

cm-1 commented Jan 19, 2025

It looks like a change happened in a recent version of Python. When I run x = "last estimate ($\hat{x}_{t-1}$)" in a Python 3.11 environment, everything's fine, while in 3.13, I get the SyntaxWarning (and I haven't tested 3.12 or looked through release info to see what's changed).

In any event, the fix is easy. Just go into gh_internal.py and put an r in front of the offending strings to make them raw strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants