Blank images for simple volume rendering
Hello, I'm new to yt, and am having some trouble volume rendering my Castro simulation data (3D). The simulation is of two stars orbiting the center of the domain, the domain being defined by defined by [0.0, 0.0, 0.0], [1.e10, 1.e10, 1.e10], in cgs. When I run the following script, I get an image that is either all black or all white, depending on which field I use. Does anyone see anything wrong with my script?: from yt.mods import * pf = load("plt_derr_perr_grav_00020") field = "density" dd = pf.h.all_data() mi, ma = dd.quantities["Extrema"](field)[0] tf = ColorTransferFunction((mi, ma)) c = [5.0e9, 5.0e9, 5.0e9] L = [1., 1., 1.] W = pf.domain_right_edge - pf.domain_left_edge Nvec = 512 cam = pf.h.camera(c, L, W, (Nvec,Nvec), transfer_function = tf, fields=[field], pf=pf) tf.add_layers(4, colormap="hsv") cam.snapshot("v1.png") Any advice would be greatly appreciated. Best, Noel Scudder
Hi Noel, My guess is that your density field spans several orders of magnitude in value, and that the transfer function is being set up in linear space, causing all sorts of havoc. I think you added the following before the tf = ColorTransferFuctiont((mi,ma)) call: mi, ma = np.log10(mi), np.log10(ma) pf.h pf.field_info['density'].take_log=True and use tf = ColorTransferFuctiont((mi-1,ma+1)) then use: tf.add_layers(4, colormap="hsv", col_bounds=[mi,ma]) This will pad the TF with a bit extra space on the lower/upper bounds. When you add the layers, the col_bounds keyword will restrict the gaussians of emission to be within the range mi to ma. Please let us know whether or not that works. Best, Sam On Thu, Jun 27, 2013 at 3:26 PM, Noel Scudder <noel.scudder@stonybrook.edu>wrote:
Hello,
I'm new to yt, and am having some trouble volume rendering my Castro simulation data (3D). The simulation is of two stars orbiting the center of the domain, the domain being defined by defined by [0.0, 0.0, 0.0], [1.e10, 1.e10, 1.e10], in cgs. When I run the following script, I get an image that is either all black or all white, depending on which field I use. Does anyone see anything wrong with my script?:
from yt.mods import * pf = load("plt_derr_perr_grav_00020") field = "density" dd = pf.h.all_data() mi, ma = dd.quantities["Extrema"](field)[0]
tf = ColorTransferFunction((mi, ma))
c = [5.0e9, 5.0e9, 5.0e9] L = [1., 1., 1.] W = pf.domain_right_edge - pf.domain_left_edge Nvec = 512 cam = pf.h.camera(c, L, W, (Nvec,Nvec), transfer_function = tf, fields=[field], pf=pf)
tf.add_layers(4, colormap="hsv") cam.snapshot("v1.png")
Any advice would be greatly appreciated.
Best, Noel Scudder
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Sam, You were correct. My density did span quite a few orders of magnitude, and restricting the data and transfer function to log space made the stars appear. Actually, the fix worked for all of my other data fields, as they also had large spans. Now all I need to do is tweak the script to make the stars appear best. I appreciate your quick and helpful support. Cheers, Noel On Thu, Jun 27, 2013 at 11:04 PM, Sam Skillman <samskillman@gmail.com>wrote:
Hi Noel,
My guess is that your density field spans several orders of magnitude in value, and that the transfer function is being set up in linear space, causing all sorts of havoc. I think you added the following before the tf = ColorTransferFuctiont((mi,ma)) call:
mi, ma = np.log10(mi), np.log10(ma) pf.h pf.field_info['density'].take_log=True
and use tf = ColorTransferFuctiont((mi-1,ma+1))
then use: tf.add_layers(4, colormap="hsv", col_bounds=[mi,ma])
This will pad the TF with a bit extra space on the lower/upper bounds. When you add the layers, the col_bounds keyword will restrict the gaussians of emission to be within the range mi to ma.
Please let us know whether or not that works.
Best, Sam
On Thu, Jun 27, 2013 at 3:26 PM, Noel Scudder <noel.scudder@stonybrook.edu
wrote:
Hello,
I'm new to yt, and am having some trouble volume rendering my Castro simulation data (3D). The simulation is of two stars orbiting the center of the domain, the domain being defined by defined by [0.0, 0.0, 0.0], [1.e10, 1.e10, 1.e10], in cgs. When I run the following script, I get an image that is either all black or all white, depending on which field I use. Does anyone see anything wrong with my script?:
from yt.mods import * pf = load("plt_derr_perr_grav_00020") field = "density" dd = pf.h.all_data() mi, ma = dd.quantities["Extrema"](field)[0]
tf = ColorTransferFunction((mi, ma))
c = [5.0e9, 5.0e9, 5.0e9] L = [1., 1., 1.] W = pf.domain_right_edge - pf.domain_left_edge Nvec = 512 cam = pf.h.camera(c, L, W, (Nvec,Nvec), transfer_function = tf, fields=[field], pf=pf)
tf.add_layers(4, colormap="hsv") cam.snapshot("v1.png")
Any advice would be greatly appreciated.
Best, Noel Scudder
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Noel Scudder
-
Sam Skillman