Opened 2 years ago

Closed 23 months ago

#24994 closed enhancement (fixed)

convert mandelbrot/julia interact to jupyter notebook

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.3
Component: notebook Keywords:
Cc: bbarros, bhutz, atowsley, kcrisman, embray, jdemeyer, jmantysalo Merged in:
Authors: Frédéric Chapoton, Jeroen Demeyer Reviewers: Frédéric Chapoton, Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: 4de168d (Commits) Commit: 4de168d769d72100f0650192e3370a4080de380b
Dependencies: #25373 Stopgaps:

Description

as another step to python3

Change History (42)

comment:1 Changed 2 years ago by chapoton

  • Branch set to public/24994
  • Commit set to a9e184dddde2c132e3754dc77ff4e07a875eede6

work in progress, not yet working as expected..


New commits:

a9e184dfirst tentative of conversion of mandelbrot interact to jupyter interact

comment:2 Changed 2 years ago by git

  • Commit changed from a9e184dddde2c132e3754dc77ff4e07a875eede6 to 52ce4a55d0b43cf497a347bea977911d494caee7

Branch pushed to git repo; I updated commit sha1. New commits:

52ce4a5second pass at interactive mandelbrot/julia in ipython notebook

comment:3 Changed 2 years ago by git

  • Commit changed from 52ce4a55d0b43cf497a347bea977911d494caee7 to c65a01c21c59d309abed48271439bbd18b675c91

Branch pushed to git repo; I updated commit sha1. New commits:

c65a01cfixing colors and other details

comment:4 Changed 2 years ago by git

  • Commit changed from c65a01c21c59d309abed48271439bbd18b675c91 to 7cbf77bce84be661537eaf9e48d51d057a8b6dc0

Branch pushed to git repo; I updated commit sha1. New commits:

7cbf77btrying to fix doctests..

comment:5 Changed 2 years ago by chapoton

  • Authors set to Frédéric Chapoton
  • Status changed from new to needs_review

ok, working now. Except 3 failing doctests that I just fail to write using ellipsis !

comment:6 Changed 2 years ago by chapoton

  • Cc bbarros bhutz atowsley kcrisman added

comment:7 Changed 2 years ago by git

  • Commit changed from 7cbf77bce84be661537eaf9e48d51d057a8b6dc0 to 4467110694aee29adafa5f136ff026ee0d050d98

Branch pushed to git repo; I updated commit sha1. New commits:

4467110pep8 and pyflakes cleanup

comment:8 Changed 2 years ago by git

  • Commit changed from 4467110694aee29adafa5f136ff026ee0d050d98 to 588ac04e725652d7dc4f6fe7dd86dcc8e3fb1fd6

Branch pushed to git repo; I updated commit sha1. New commits:

588ac04fixing doctests (ugly)

comment:9 Changed 2 years ago by jdemeyer

  • Status changed from needs_review to needs_work

This is bad:

M = mandelbrot_interact
...adjust various attributes of M...
return M

The problem is that you are changing and returning a unique global object. Instead of having

@interact.widget
def mandelbrot_interact(...

it would be better to just define mandelbrot_interact as an ordinary function and call interact.widget() inside the mandelbrot_plot function. That way, you end up with non-unique widgets.

Can you explain the <CSI-2K> appearing in the doctests? I feel uncomfortable accepting that without knowing where it comes from.

comment:10 Changed 2 years ago by git

  • Commit changed from 588ac04e725652d7dc4f6fe7dd86dcc8e3fb1fd6 to 8bdbb0dcaff0e35ff37d7132f9194c90560f1b80

Branch pushed to git repo; I updated commit sha1. New commits:

8bdbb0dmade the suggested changes

comment:11 Changed 2 years ago by chapoton

  • Status changed from needs_work to needs_review

Better like that ?

comment:12 Changed 2 years ago by chapoton

ping ?

comment:13 Changed 2 years ago by chapoton

*ping* ?

comment:14 Changed 2 years ago by chapoton

review, please ?

comment:15 Changed 2 years ago by chapoton

ping again

comment:16 Changed 2 years ago by chapoton

  • Cc embray jdemeyer added

Could please someone have a look at the result here ? This seems to work well, and is a good step in getting rid of the dependencies to sagenb.

comment:17 Changed 2 years ago by embray

It looks good to me. I had just moved the imports from sagenb inline, but this is obviously a more complete approach. I haven't tested it, but if you say it works it's good enough for me.

comment:18 Changed 2 years ago by chapoton

It seems not to be working anymore.. :(

comment:19 Changed 2 years ago by chapoton

Jeroen, any idea of what should be done, please ?

comment:20 Changed 2 years ago by chapoton

Here is the message I get (once disactivating the image):

Failed to display Jupyter Widget of type sage_interactive.

If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.

If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.

This is not specific to the widget built here. Simple basic widgets have the same issue. Could someone confirm this issue ?

import ipywidgets as widgets
widgets.Checkbox()

comment:21 Changed 2 years ago by jmantysalo

  • Cc jmantysalo added

comment:22 Changed 2 years ago by jmantysalo

I can see no problem with mandelbrot_plot(interact=True) on sage --notebook=ipython; another thing is sage --notebook=sagenb which just says "Interactive function <function mandelbrot_interact . . ."

But the main idea of fractal does not work when there is no widget for infinite zooming.

comment:23 follow-up: Changed 2 years ago by chapoton

If it works for you (in which version of sage ?), then one can probably set this to positive review. My install should be somehow broken.

Yes, this is a pity that there is no good clickable-picture widget. But the main aim here is to move towards python3 by geeting rid of all imports of sagenb.

comment:24 in reply to: ↑ 23 ; follow-up: Changed 2 years ago by jmantysalo

Replying to chapoton:

If it works for you (in which version of sage ?), then one can probably set this to positive review. My install should be somehow broken.

I had 8.2rc4, and with git trac checkout... of this ticket I got 8.2beta8. So should I try to merge this to newest beta/rc version?

Yes, this is a pity that there is no good clickable-picture widget. But the main aim here is to move towards python3 by geeting rid of all imports of sagenb.

OK.

comment:25 in reply to: ↑ 24 Changed 2 years ago by jmantysalo

Replying to jmantysalo:

So should I try to merge this to newest beta/rc version?

I did this. No changes, it wotks.

comment:26 Changed 2 years ago by chapoton

Thanks a lot. Feel free to set to positive, then.

comment:27 follow-up: Changed 2 years ago by jmantysalo

Hmm... I don't know about those widgets. The code seems clear. Jeroen, have you checked this?

comment:28 in reply to: ↑ 27 Changed 2 years ago by jdemeyer

Replying to jmantysalo:

Jeroen, have you checked this?

No, but I guess I should...

comment:29 Changed 2 years ago by jdemeyer

  • Authors changed from Frédéric Chapoton to Frédéric Chapoton, Jeroen Demeyer
  • Component changed from python3 to notebook
  • Dependencies set to #25074
  • Status changed from needs_review to needs_work

I'm not so happy that the input to mandelbrot_plot() is now completely ignored when interact=True is given. I'll try to work on this.

I will rebase on #25074. That's not strictly needed, but it's good to test against the newest version of ipywidgets.

comment:30 Changed 2 years ago by git

  • Commit changed from 8bdbb0dcaff0e35ff37d7132f9194c90560f1b80 to 4b925be17c667135e4de428f2b08ed81054a37ba

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ad085dcupgrade to ipywidgets 7.2.0 and widgetsnbextension 3.20
4b925befirst tentative of conversion of mandelbrot interact to jupyter interact

comment:31 Changed 2 years ago by chapoton

Is this still "needing work", Jeroen ?

This is the place where docbuild currently fails on the python3 patchbot. See

https://patchbot.sagemath.org/log/0/Ubuntu/18.04/x86_64/4.15.0-20-generic/petitbonum/2018-05-15%2012:37:45?plugin=docbuild

comment:32 Changed 2 years ago by chapoton

  • Dependencies #25074 deleted
  • Milestone changed from sage-8.2 to sage-8.3

comment:33 Changed 2 years ago by chapoton

This is working fine, the only issue is comment:29

comment:34 Changed 2 years ago by git

  • Commit changed from 4b925be17c667135e4de428f2b08ed81054a37ba to 8143016b1e0f07ef8baa899cd79434f426cec244

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8143016first tentative of conversion of mandelbrot interact to jupyter interact

comment:35 Changed 2 years ago by jdemeyer

OK, I'll work on this today.

comment:36 Changed 2 years ago by jdemeyer

  • Dependencies set to #25373

comment:37 Changed 2 years ago by git

  • Commit changed from 8143016b1e0f07ef8baa899cd79434f426cec244 to e4523c40d839aeb3eaa6c775beb446c5961c164b

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

2e75d4cAdd IPython support for Cython functions
f25a0e8first tentative of conversion of mandelbrot interact to jupyter interact
e4523c4Improve Mandelbrot/Julia interact

comment:38 Changed 2 years ago by git

  • Commit changed from e4523c40d839aeb3eaa6c775beb446c5961c164b to 56b571f3b501359e87481f047004d75826d60db7

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

56b571fImprove Mandelbrot/Julia interact

comment:39 Changed 2 years ago by git

  • Commit changed from 56b571f3b501359e87481f047004d75826d60db7 to 4de168d769d72100f0650192e3370a4080de380b

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

4de168dImprove Mandelbrot/Julia interact

comment:40 Changed 2 years ago by jdemeyer

  • Status changed from needs_work to needs_review

comment:41 Changed 23 months ago by chapoton

  • Reviewers set to Frédéric Chapoton, Jeroen Demeyer
  • Status changed from needs_review to positive_review

I think I can reasonably set this to positive now.

comment:42 Changed 23 months ago by vbraun

  • Branch changed from public/24994 to 4de168d769d72100f0650192e3370a4080de380b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.