posible bug in Tachyon.show() at aleph/sagecell?

45 views
Skip to first unread message

share the sage

unread,
Apr 19, 2014, 4:02:28 PM4/19/14
to sage-s...@googlegroups.com
Hi sage-support community!

Recently I've tried the following code at sagecell (permalink here):

t = Tachyon(xres=400,yres=400, camera_center=(2,0,0))
t
.light((4,3,2), 0.2, (1,1,1))
t
.texture('t2', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(1,0,0))
t
.texture('t3', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(0,1,0))
t
.texture('t4', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(0,0,1))
t
.sphere((0,0.5,0), 0.2, 't2')
t
.sphere((0.5,0,0), 0.2, 't3')
t
.sphere((0,0,0.5), 0.2, 't4')
t
.show()

And this was the result:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-d6c906df5871> in <module>()
      7
t.sphere((RealNumber('0.5'),Integer(0),Integer(0)), RealNumber('0.2'), 't3')
      8 t.sphere((Integer(0),Integer(0),RealNumber('0.5')), RealNumber('0.2'), 't4')
----> 9 t.show()

/home/sageserver/sage/local/lib/python2.7/site-packages/sage/plot/plot3d/tachyon.pyc in show(self, verbose, extra_opts)
    320            
filename = graphics_filename()
    321             self.save(filename, verbose=verbose, extra_opts=extra_opts)
--> 322             sage.misc.misc.display_image(filename)
    323             return
    324         filename = tmp_filename(ext='.png')

AttributeError: 'module' object has no attribute 'display_image'

Same code works fine at www.sagenb.org: it shows the three spheres

I've searched sage-support, ask sage and trac sage, but couldn't find any similar issue.

Checking the source code I coded the following workaround within the cell (permalink):

# t is as above
# t.show() replaced by:
filename
= sage.misc.temporary_file.graphics_filename()
t
.save(filename)
sage
.misc.display.display_image(filename)

Is this a bug in the method show() from the Tachyon class?

Thanks in advance,

Share_The_Sage!


kcrisman

unread,
Apr 19, 2014, 10:45:17 PM4/19/14
to sage-s...@googlegroups.com

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-d6c906df5871> in <module>()
      7
t.sphere((RealNumber('0.5'),Integer(0),Integer(0)), RealNumber('0.2'), 't3')
      8 t.sphere((Integer(0),Integer(0),RealNumber('0.5')), RealNumber('0.2'), 't4')
----> 9 t.show()

/home/sageserver/sage/local/lib/python2.7/site-packages/sage/plot/plot3d/tachyon.pyc in show(self, verbose, extra_opts)
    320            
filename = graphics_filename()
    321             self.save(filename, verbose=verbose, extra_opts=extra_opts)
--> 322             sage.misc.misc.display_image(filename)
    323             return
    324         filename = tmp_filename(ext='.png')

AttributeError: 'module' object has no attribute 'display_image'

Same code works fine at www.sagenb.org: it shows the three spheres

I've searched sage-support, ask sage and trac sage, but couldn't find any similar issue.

Checking the source code I coded the following workaround within the cell (permalink):

# t is as above
# t.show() replaced by:
filename
= sage.misc.temporary_file.graphics_filename()
t
.save(filename)
sage
.misc.display.display_image(filename)

Is this a bug in the method show() from the Tachyon class?


I like your screen name.  Share that Sage!

I can't find this display_image thing anywhere in the Sage source, and perhaps this is a Sage cell specific thing so that Tachyon things work in that context (it's neither the command line nor the notebook server, so some custom code may be necessary).  I'm not sure where you found the display_image, though; even in the Sage cell patches to Sage [1] ... but presumably this is a Sage cell specific thing, given their custom code, and I encourage you to report it there [2].  Thanks for the report!

- kcrisman

share the sage

unread,
Apr 21, 2014, 9:49:17 PM4/21/14
to sage-s...@googlegroups.com
Hi kcrisman!


On Saturday, April 19, 2014 11:45:17 PM UTC-3, kcrisman wrote:
I like your screen name.  Share that Sage!

When I first found out Sage (a year or two ago), it blew my mind. I'm still telling everyone about it ^_^

I've been learning slowly. Recently I've found the cell server. It's ideal for sharing my stuff with my friends, without nagging them to sign up at cloud or sagenb.
 
kcrisman wrote:
I can't find this display_image thing anywhere in the Sage source, and perhaps this is a Sage cell specific thing so that Tachyon things work in that context (it's neither the command line nor the notebook server, so some custom code may be necessary).  I'm not sure where you found the display_image, though; even in the Sage cell patches to Sage [1] ...


Following the track trace, I typed in the following in the cell and press tab:
sage.plot.plot3d.tachyon??

Then I checked the show() method...
def show(self, verbose=0, extra_opts=''):
# ... ommitted ...
if sage.misc.display.is_registered('image'):
            filename
= graphics_filename()
             
self.save(filename, verbose=verbose, extra_opts=extra_opts)
            sage
.misc.misc.display_image(filename)
           
return


... and I found that  sage.misc.display.is_registered() curious. Then I also used tab for...
 sage.misc.display.

... and there I found the function display_image(). Then I guessed that sage.misc.misc.display_image(filename)
had mistaken the second "misc" . From there I figured out the mentioned workaround.

kcrisman wrote:
but presumably this is a Sage cell specific thing, given their custom code, and I encourage you to report it there [2].
 
Thanks for the advice! I'll be visiting [2] soon.

kcrisman wrote:
Thanks for the report!

 Thanks to you too!

- Share_The_Sage!

share the sage

unread,
May 8, 2014, 7:31:33 PM5/8/14
to sage-s...@googlegroups.com
Hi kcrisman and sage community!

I've just reported this issue at https://github.com/sagemath/sagecell/issues/444

Best regards,

-- Share_The_Sage!
Reply all
Reply to author
Forward
0 new messages