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

Remove double-backslashes from latex labels passed to matplotlib. #837

Merged

Conversation

AlexandreGoettel
Copy link
Collaborator

Addresses #836
As far as I can tell, the issue is due to a bug in bilby_pipe, but I noticed that there is already a function to remove matplotlib errors in bilby/core/result.py.

This PR simply adds a line to this function to convert "\" into "".

Either way I think this is a good thing to have, as I can't think of a scenario where having "\" in a matplotlib latex string is a good idea.

Copy link
Collaborator

@mj-will mj-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked to see how this interacts with raw strings (e.g. r"$\mathcal{M}$")?

@AlexandreGoettel
Copy link
Collaborator Author

Have you checked to see how this interacts with raw strings (e.g. r"$\mathcal{M}$")?

Not 100% what you mean but afaik a variable defined as a raw string just becomes a string (with different creation rules) i.e.:
r"$\mathcal{M}$" == "$\\mathcal{M}$" will return True. The code above will work in both cases.

@mj-will
Copy link
Collaborator

mj-will commented Oct 25, 2024

Not 100% what you mean but afaik a variable defined as a raw string just becomes a string (with different creation rules) i.e.: r"$\mathcal{M}$" == "$\\mathcal{M}$" will return True. The code above will work in both cases.

Ah, I didn't know that, makes sense then :)

@ColmTalbot ColmTalbot merged commit 0d4b91f into bilby-dev:main Oct 25, 2024
10 checks passed
@AlexandreGoettel AlexandreGoettel deleted the fix_bilby_pipe_latex_plots branch October 25, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants