ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 20 Sep 2010 16:40:56 +0200Importing saved 3d plothttps://ask.sagemath.org/question/7704/importing-saved-3d-plot/Hi everyone,
I generated a bunch of 3d plots to produce an animation and I saved them both as png and sobj files, because I wanted to keep the objects for later manipulations. However, when loading back an sobj file, I find them to be unusable. More precesily,
*p=plot3d(lambda x1,y1: h(t0,x1,y1), (-5,5),(-5,5),plot_points=100);* #t0 fixed and h(t,x,y) a procedure<br>
*p.save('bump003.sobj');*<br>
*p.save('bump003.png');*<br>
*a = load('bump003.sobj');*<br>
*a.show()*;
returns the error
*NotImplementedError: You must override the get_grid method.*
while the png image files get correctly generated.
There is no mention of this kind of error in the Plot3D doc, except for parametric surfaces<br>
*http://www.sagemath.org/doc/reference/sage/plot/plot3d/parametric_surface.html*<br>
where it is mentioned that get___grid should indeed be overriden for subclasses of parametric_surface.
Any idea why this error shows up only after importing the object ?
Many thanks,
BenhuardSun, 19 Sep 2010 15:45:43 +0200https://ask.sagemath.org/question/7704/importing-saved-3d-plot/Answer by kcrisman for <p>Hi everyone,</p>
<p>I generated a bunch of 3d plots to produce an animation and I saved them both as png and sobj files, because I wanted to keep the objects for later manipulations. However, when loading back an sobj file, I find them to be unusable. More precesily,</p>
<p><em>p=plot3d(lambda x1,y1: h(t0,x1,y1), (-5,5),(-5,5),plot_points=100);</em> #t0 fixed and h(t,x,y) a procedure<br/>
<em>p.save('bump003.sobj');</em><br/>
<em>p.save('bump003.png');</em><br/>
<em>a = load('bump003.sobj');</em><br/>
<em>a.show()</em>;</p>
<p>returns the error</p>
<p><em>NotImplementedError: You must override the get_grid method.</em></p>
<p>while the png image files get correctly generated. </p>
<p>There is no mention of this kind of error in the Plot3D doc, except for parametric surfaces<br/></p>
<p><em><a href="http://www.sagemath.org/doc/reference/sage/plot/plot3d/parametric_surface.html">http://www.sagemath.org/doc/reference...</a></em><br/></p>
<p>where it is mentioned that get___grid should indeed be overriden for subclasses of parametric_surface.
Any idea why this error shows up only after importing the object ?</p>
<p>Many thanks,
Benhuard</p>
https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?answer=11678#post-id-11678I can confirm this with an easier example:
>sage: var('x,y')
>(x, y)
>sage: f(x,y)=x^2+y^2
>sage: p=plot3d(f,(-5,5),(-5,5))
> sage: p # works fine
>sage: p.save('test.sobj')
>sage: q = load('test.sobj')
>sage: q
>NotImplementedError: You must override the get_grid method.
I will try to look into this later; it's puzzling to me, since we get
>sage: type(q)
>`<type 'sage.plot.plot3d.parametric_surface.ParametricSurface'>`
> sage: type(p)
>`<type 'sage.plot.plot3d.parametric_surface.ParametricSurface'>`
as expected.Mon, 20 Sep 2010 12:20:31 +0200https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?answer=11678#post-id-11678Comment by kcrisman for <p>I can confirm this with an easier example:</p>
<blockquote>
<p>sage: var('x,y')</p>
<p>(x, y)</p>
<p>sage: f(x,y)=x^2+y^2</p>
<p>sage: p=plot3d(f,(-5,5),(-5,5))</p>
<p>sage: p # works fine</p>
<p>sage: p.save('test.sobj')</p>
<p>sage: q = load('test.sobj')</p>
<p>sage: q</p>
<p>NotImplementedError: You must override the get_grid method.</p>
</blockquote>
<p>I will try to look into this later; it's puzzling to me, since we get </p>
<blockquote>
<p>sage: type(q)</p>
<p><code><type 'sage.plot.plot3d.parametric_surface.ParametricSurface'></code></p>
<p>sage: type(p)</p>
<p><code><type 'sage.plot.plot3d.parametric_surface.ParametricSurface'></code></p>
</blockquote>
<p>as expected.</p>
https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?comment=22614#post-id-22614This is now #9957; I don't think this will be immediate to fix.Mon, 20 Sep 2010 16:40:56 +0200https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?comment=22614#post-id-22614Answer by niles for <p>Hi everyone,</p>
<p>I generated a bunch of 3d plots to produce an animation and I saved them both as png and sobj files, because I wanted to keep the objects for later manipulations. However, when loading back an sobj file, I find them to be unusable. More precesily,</p>
<p><em>p=plot3d(lambda x1,y1: h(t0,x1,y1), (-5,5),(-5,5),plot_points=100);</em> #t0 fixed and h(t,x,y) a procedure<br/>
<em>p.save('bump003.sobj');</em><br/>
<em>p.save('bump003.png');</em><br/>
<em>a = load('bump003.sobj');</em><br/>
<em>a.show()</em>;</p>
<p>returns the error</p>
<p><em>NotImplementedError: You must override the get_grid method.</em></p>
<p>while the png image files get correctly generated. </p>
<p>There is no mention of this kind of error in the Plot3D doc, except for parametric surfaces<br/></p>
<p><em><a href="http://www.sagemath.org/doc/reference/sage/plot/plot3d/parametric_surface.html">http://www.sagemath.org/doc/reference...</a></em><br/></p>
<p>where it is mentioned that get___grid should indeed be overriden for subclasses of parametric_surface.
Any idea why this error shows up only after importing the object ?</p>
<p>Many thanks,
Benhuard</p>
https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?answer=11677#post-id-11677Hi Benhuard,
This isn't an answer to your question, but I wanted to point out that @mhampton seems to have alternate ways of producing 3D animations, which maybe you could use to work around your problem. He mentioned them in his answer to my question [animate 3d plots][1].
[1]: http://ask.sagemath.org/question/99/animate-3d-plotsMon, 20 Sep 2010 09:57:46 +0200https://ask.sagemath.org/question/7704/importing-saved-3d-plot/?answer=11677#post-id-11677