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

Invalid escape sequences in docstrings #23

Open
MitchellAcoustics opened this issue Aug 2, 2024 · 5 comments · May be fixed by #35
Open

Invalid escape sequences in docstrings #23

MitchellAcoustics opened this issue Aug 2, 2024 · 5 comments · May be fixed by #35
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@MitchellAcoustics
Copy link
Collaborator

Upon import (from acoustic_toolbox import Signal), several warnings are raised about invalid escape sequences in the standards docstrings, but otherwise it imports fine. Looks like it's related to the math sections. Need to check through sphinx to see if we're missing a math extension or something.

/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_tr_25417_2007.py:14: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_tr_25417_2007.py:51: SyntaxWarning: invalid escape sequence '\m'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_tr_25417_2007.py:96: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_tr_25417_2007.py:184: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iec_61260_1_2014.py:153: SyntaxWarning: invalid escape sequence '\l'
  """Determine the band index `x` from a given frequency.
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_9613_1_1993.py:54: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_9613_1_1993.py:92: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_9613_1_1993.py:118: SyntaxWarning: invalid escape sequence '\c'
  """
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_1996_2_2007.py:70: SyntaxWarning: invalid escape sequence '\l'
  """Total sound pressure level of the tones in a critical band given the level of each of the tones.
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_1996_2_2007.py:82: SyntaxWarning: invalid escape sequence '\D'
  """Masking noise level :math:`L_{pn}`
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_1996_2_2007.py:124: SyntaxWarning: invalid escape sequence '\D'
  """Tonal audibility.
/Users/mitch/Documents/Trials/acoustic_toolbox_test2/.venv/lib/python3.12/site-packages/acoustic_toolbox/standards/iso_1996_2_2007.py:248: SyntaxWarning: invalid escape sequence '\D'
  """Effective analysis bandwidth.
@MitchellAcoustics MitchellAcoustics added bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers labels Aug 2, 2024
@MitchellAcoustics MitchellAcoustics self-assigned this Aug 2, 2024
@Nitnelav
Copy link
Collaborator

Nitnelav commented Aug 2, 2024

Yeah I saw that too, but the math equations don't seem to be affected, so I left it as is. There might be a way to remove those warnings though

@MitchellAcoustics
Copy link
Collaborator Author

I was considering switching the documentation over to mkdocs rather than sphinx - I find it much nicer to write and work in and the mkdocs-material theme looks really nice (although rtd-theme is also available). I used mkdocs for my circumplex package: https://circumplex.readthedocs.io/en/latest/. A big part is I just hate writing ReST/sphinx docstrings and find Google/Numpy style with straightforward markdown in the docs nicer. But that's very much personal taste, so I didn't want to just go ahead with it.

What do you think? It'd handle this issue at the same time.

@Nitnelav
Copy link
Collaborator

Nitnelav commented Aug 2, 2024

I am quite new to this way of writing docs so I'm fine with anything you might prefer.
Maybe I'm wrong but isn't rst/sphinx the only/best way to get Latex Math equations ?

@MitchellAcoustics
Copy link
Collaborator Author

Looks like mkdocs-material has support for Latex equations via MathJax or Katex - https://squidfunk.github.io/mkdocs-material/reference/math/.

Okay, I'll keep it in mind if I decide to dive into the documentation more. But it's not the most important thing, so probably not a priority.

@MitchellAcoustics MitchellAcoustics removed the bug Something isn't working label Aug 2, 2024
@Nitnelav
Copy link
Collaborator

Nitnelav commented Aug 2, 2024

Yeah not the priority for sure, but I'll support the endeavor if you go for it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants