sherpa / sherpa

Fit models to your data in Python with Sherpa.
https://sherpa.readthedocs.io
GNU General Public License v3.0
146 stars 49 forks source link

Sherpa model and fit result HTML output render on Github #2082

Open cdeil opened 1 month ago

cdeil commented 1 month ago

Hi, when I use Sherpa in a notebook in VSCode the HTML output for the model and fit result object looks great.

However when I put the notebook on Github it doesn't render the content, just shows a short repr.

See screenshots below.

Any chance to change the rendering so that it works on Github?

(note that lmfit and iminuit have also similar HTML output and they managed somehow to render on Github)

Screenshot 2024-07-16 at 16 59 46 Screenshot 2024-07-16 at 16 59 01
DougBurke commented 1 month ago

I am not sure what we can do here, since there's nothing different (as far as I understand it) between how we create the various "rich text" representations. Maybe there's some HTML/JS setup we do that doesn't get rendered on GitHub?

I note we can use our own notebooks to see this - e.g.

https://github.com/sherpa/sherpa/blob/main/notebooks/NotebookSupport.ipynb

If you view this with nbviewer then you can view the output

https://nbviewer.org/github/sherpa/sherpa/blob/main/notebooks/NotebookSupport.ipynb

Is the raw GitHub view guaranteed to show the Rich-Text output of a notebook?

cdeil commented 1 month ago

I think there must be something in the HTML/JS you generate that the Github Notebook to HTML converter doesn't like and refuses to process. I think that's JS security-related topics and plain HTML should render fine. But I don't know much about it, there's some discussion at https://github.com/jupyter/notebook/issues/3035 but quickly scanning it I didn't find a description what does / doesn't work.

I made a super basic fitting tutorial today which is at https://github.com/cdeil/python-modeling-fitting-tutorial/blob/main/01_meet_the_tools.ipynb where I noticed this.