Opened 9 years ago
Closed 4 years ago
#15729 closed defect (fixed)
Graphics3d with fractional opacity will not save image
Reported by:  niles  Owned by:  

Priority:  major  Milestone:  sage8.2 
Component:  graphics  Keywords:  IMAPolyGeom, opacity 
Cc:  slelievre  Merged in:  
Authors:  Yuan Zhou  Reviewers:  JeanPhilippe Labbé 
Report Upstream:  N/A  Work issues:  
Branch:  ddf16d5 (Commits, GitHub, GitLab)  Commit:  ddf16d5d9609dfe5447239a11ae65c2de3faebec 
Dependencies:  Stopgaps: 
Description
Giving opacity as a fraction breaks the save method. No error is raised and no image is created.
plot3d(lambda x, y: x^2 + y^2, (2,2), (2,2),opacity=8/10).save('~/tmp.png')
This appears to be a problem with tachyon not handling fractions. Here is another example with an error message (shown with the keyword verbosity=2
):
sage: S = sphere(opacity=8/10, aspect_ratio=[1,1,1], verbosity='2') sage: S.save('~/tmp.png')
tachyon /Users/njohnson/.sage/temp/galileo/2623/tmp_zkpq5K.dat format PNG o ~/tmp.png res 500 500 +V ; rm f "/Users/njohnson/.sage/temp/galileo/2623/tmp_zkpq5K.dat" Tachyon Parallel/Multiprocessor Ray Tracer Version 0.98.9 Copyright 19942010, John E. Stone <john.stone@gmail.com>  Parse Error: Encountered a syntax error in file /Users/njohnson/.sage/temp/galileo/2623/tmp_zkpq5K.dat Expected to find TEXFUNC Actually found: Color Error occured at or prior to file offset 656, line 29 Error position is only approximate, but should be close Parse Error: Encountered a syntax error in file /Users/njohnson/.sage/temp/galileo/2623/tmp_zkpq5K.dat Expected to find an object or other declaration Actually found: .4 Error occured at or prior to file offset 660, line 29 Error position is only approximate, but should be close Parser failed due to an input file syntax error. Aborting render.
Changing opacity to .8 in this example works as expected.
Change History (21)
comment:1 Changed 9 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:2 Changed 8 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:3 Changed 8 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:4 Changed 4 years ago by
 Milestone changed from sage6.4 to sage8.2
comment:5 Changed 4 years ago by
 Branch set to u/yzh/graphics3d_with_fractional_opacity_will_not_save_image
comment:6 Changed 4 years ago by
 Cc slelievre added
 Commit set to 181dddc5444e7755a95a5e3bcd722bd4999926ee
 Status changed from new to needs_review
comment:7 Changed 4 years ago by
Looks good.
Could you add a test to show that the mentioned bug is fixed?
comment:8 Changed 4 years ago by
 Status changed from needs_review to needs_work
comment:9 Changed 4 years ago by
 Commit changed from 181dddc5444e7755a95a5e3bcd722bd4999926ee to d1b3450a21fc6c43eb6ea65d29ede57c46e90400
Branch pushed to git repo; I updated commit sha1. New commits:
d1b3450  add fixed bug example

comment:10 Changed 4 years ago by
 Keywords IMAPolyGeom opacity added
 Status changed from needs_work to needs_review
comment:11 Changed 4 years ago by
 Status changed from needs_review to needs_work
There are 2 failed doctests:
File "src/sage/plot/plot3d/index_face_set.pyx", line 964, in sage.plot.plot3d.index_face_set.IndexFaceSet.json_repr Failed example: G.json_repr(G.default_render_params()) Expected: ['{"vertices":[{"x":0,"y":0,"z":1},{"x":1,"y":1,"z":1},{"x":2,"y":0,"z":1}], "faces":[[0,1,2]], "color":"#0000ff", "opacity":1}'] Got: ['{"vertices":[{"x":0,"y":0,"z":1},{"x":1,"y":1,"z":1},{"x":2,"y":0,"z":1}], "faces":[[0,1,2]], "color":"#0000ff", "opacity":1.0}'] ********************************************************************** File "src/sage/plot/plot3d/index_face_set.pyx", line 976, in sage.plot.plot3d.index_face_set.IndexFaceSet.json_repr Failed example: S.json_repr(S.default_render_params()) Expected: ['{"vertices":[{"x":2,"y":0,"z":0},..., "face_colors":["#ff0000","#ff9900","#cbff00","#33ff00"], "opacity":1}'] Got: ['{"vertices":[{"x":2,"y":0,"z":0},{"x":0,"y":2,"z":0},{"x":0,"y":0,"z":2},{"x":0,"y":1,"z":1},{"x":1,"y":0,"z":1},{"x":1,"y":1,"z":0}], "faces":[[0,4,5],[3,4,5],[2,3,4],[1,3,5]], "face_colors":["#ff0000","#ff9900","#cbff00","#33ff00"], "opacity":1.0}']
comment:12 Changed 4 years ago by
 Reviewers set to JeanPhilippe Labbé
comment:13 Changed 4 years ago by
 Commit changed from d1b3450a21fc6c43eb6ea65d29ede57c46e90400 to e90a2949ee292dd590cd44793f42114d914f31f5
Branch pushed to git repo; I updated commit sha1. New commits:
e90a294  fix bugs in doctests

comment:14 Changed 4 years ago by
Don't forget to set back to needs_review once reviewer comments are dealt with.
comment:15 Changed 4 years ago by
 Status changed from needs_work to needs_review
comment:16 Changed 4 years ago by
Looks good to me. Once the bot give a green light, I would put positive review.
comment:17 Changed 4 years ago by
 Status changed from needs_review to needs_work
See patchbot report:
File "src/sage/plot/plot3d/base.pyx", line 329, in sage.plot.plot3d.base.Graphics3d._rich_repr_canvas3d Failed example: out.canvas3d.get() Expected: '[{"vertices":[{"x":0,"y":0,"z":1},..., "color":"#6666ff", "opacity":1}]' Got: '[{"vertices":[{"x":0,"y":0,"z":1},..., "color":"#6666ff", "opacity":1.0}]'
comment:18 Changed 4 years ago by
 Commit changed from e90a2949ee292dd590cd44793f42114d914f31f5 to ddf16d5d9609dfe5447239a11ae65c2de3faebec
Branch pushed to git repo; I updated commit sha1. New commits:
ddf16d5  fix doctest error

comment:19 Changed 4 years ago by
 Status changed from needs_work to needs_review
comment:20 Changed 4 years ago by
 Status changed from needs_review to positive_review
It looks good to me.
comment:21 Changed 4 years ago by
 Branch changed from u/yzh/graphics3d_with_fractional_opacity_will_not_save_image to ddf16d5d9609dfe5447239a11ae65c2de3faebec
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
fractional opacity