[yt-users] white background instead of black, for rendered images.

Agarwal, Shankar sagarwal at ku.edu
Tue Apr 26 17:00:16 PDT 2011


Hi,

Not a very smart question but... I downloaded the http://hg.enzotools.org/yt/raw/stable/doc/install_script.sh
and after having built+installed yt, I can't locate the source code !

[sagarwal at ember yt-x86_64]$ pwd
/gpfs1/u/ac/sagarwal/software/yt/yt-x86_64
[sagarwal at ember yt-x86_64]$ ls
bin  include  lib  man  share  src  yt_install.log
[sagarwal at ember yt-x86_64]$ echo $YT_DEST
/u/ac/sagarwal/software/yt/yt-x86_64


Shankar



________________________________________
From: yt-users-bounces at lists.spacepope.org [yt-users-bounces at lists.spacepope.org] on behalf of Matthew Turk [matthewturk at gmail.com]
Sent: Tuesday, April 26, 2011 4:50 PM
To: Discussion of the yt analysis package
Subject: Re: [yt-users] white background instead of black,      for rendered images.

Hi Shankar,

I think it's hard to do this in a general case.  You could try
changing yt/visualization/volume_rendering/camera.py line 338 to
na.ones instead of na.zeros, but note that if you do anything other
than layered (i.e., non-physical) renderings this will give weird
results.

-Matt

On Tue, Apr 26, 2011 at 4:52 PM, Agarwal, Shankar <sagarwal at ku.edu> wrote:
> Hi,
>
>
>
> While volume rendering, is it possible to choose a white background instead of black? It may not look good on white but I just thought of trying that. I looked briefly at the source code but could not figure out where to make a change.
>
> Thanks
> Shankar
> ________________________________
> From: yt-users-bounces at lists.spacepope.org [yt-users-bounces at lists.spacepope.org] on behalf of Britton Smith [brittonsmith at gmail.com]
> Sent: Monday, April 18, 2011 12:36 PM
> To: Discussion of the yt analysis package
> Subject: Re: [yt-users] VR: colorbar and camera
>
> Hi Shankar,
>
> Omega_baryon is not stored in the Enzo parameter file.  You'll have to set it manually.
>
> Britton
>
> On Mon, Apr 18, 2011 at 12:44 PM, Agarwal, Shankar <sagarwal at ku.edu<mailto:sagarwal at ku.edu>> wrote:
> Hi,
>
> Thanks for the scripts, Britton.
>
> Also, in the following piece, I am getting an error : KeyError: 'CosmologyOmegaBaryonNow'
>
>  def _Baryon_Overdensity(field, data):
>    return data['Density'] / \
>        (data.pf<http://data.pf>['CosmologyOmegaBaryonNow'] * rho_crit_now * (data.pf<http://data.pf>['CosmologyHubbleConstantNow']**2) *
>         ((1+data.pf<http://data.pf>['CosmologyCurrentRedshift'])**3))
>  add_field("Baryon_Overdensity",function=_Baryon_Overdensity,units=r"")
>
>
> I tried data.pf<http://data.pf>['CosmologySimulationOmegaBaryonNow'] but got the same error. Would I need to hard code these parameters in the python scripts?
>
>
> Shankar
>
> ________________________________________
> From: yt-users-bounces at lists.spacepope.org<mailto:yt-users-bounces at lists.spacepope.org> [yt-users-bounces at lists.spacepope.org<mailto:yt-users-bounces at lists.spacepope.org>] on behalf of Britton Smith [brittonsmith at gmail.com<mailto:brittonsmith at gmail.com>]
> Sent: Sunday, April 17, 2011 1:28 PM
> To: Discussion of the yt analysis package
> Subject: Re: [yt-users] VR: colorbar and camera
>
> Hi Shankar,
>
> The image_writer was an integral part of making the movie you refer to in your email.  In brief, I made the frames for the images and colorbars separately, then grafted them together using another script.  I have pasted an example of a script I used to make the colorbar portion of the frames here:
> http://paste.enzotools.org/show/1580/
> I then used the script below to attach the colorbar image to the volume render frame.
> http://paste.enzotools.org/show/1581/
> Note the line in this script:
> cmap = cmap[1:,:,:]
> I am chopping off one pixel from the colorbar image so that it has the same dimension as the rendering image on the side that they are being attached.  If you look at the script, the images are just arrays that are being concatenated so you have to make sure that your image dimension work.
>
> I hope this helps.
>
> Britton
>
> p.s. - Thanks again to Matt and Sam who made all of that possible!
>
> On Sun, Apr 17, 2011 at 1:01 PM, Agarwal, Shankar <sagarwal at ku.edu<mailto:sagarwal at ku.edu><mailto:sagarwal at ku.edu<mailto:sagarwal at ku.edu>>> wrote:
> Hi,
>
> I recently made some volume rendered images using the following script (along the lines of Britton's http://paste.enzotools.org/show/1472/). Basically, it loops over all the redshifts, creating a snapshot - each snapshot rotated a bit using the YT-camera object. I wanted to know how can I add a colorbar (something as in http://vimeo.com/17100442)? Also, I would like to display a few cosmology variables like:
>
>  pf['CosmologyCurrentRedshift']
>  pf['CosmologyOmegaBaryonNow']
>
> My attempts with the image_writer are a disaster. I found that Libby had the same question a few months back, where she had a separate colorbar image and she joined 2 images. Please let me know how to modify the following script.
>
> Regards
> Shankar
>
>
> my_script.py
> -----------------
>
> from yt.mods import *
> import yt.visualization.volume_rendering.api as vr
>
> output_dir = 'movie'
> c = [0.5]*3 # Center
> L = [1.0,1.0,1.0] # Viewpoint
> W = na.sqrt(4.0) # Width
> N = 1024 # Pixels
> up = [0.,0.,1.] # Set the north vector
> n_colors = 3
> angle = 4 * na.pi / 360.0
>
> for n in range(0,112): # each n is a unique redshift dump
>  fin = 'lp7/seed1/RD%04i/RedshiftOutput%04i' % (n,n)  # parameter file to load
>  pf = load(fin) # load data
>  dd = pf.h.all_data()
>  min, max = na.log10(dd.quantities["Extrema"]("Density")[0])
>  print min, max
>
>  fout = "%s/%04i.png" % (output_dir,n)
>
>  width = 0.3 * (max - min) / float(n_colors)
>  alpha = na.logspace(-3.5, -1, n_colors)
>
>  tf = vr.ColorTransferFunction((min-3, max+1))
>  tf.add_layers(n_colors,w=width, alpha=alpha, min=min, max=max, col_bounds=(min,max), colormap='gist_ncar')
>
>  cam = vr.Camera(c, L, W, (N,N), fields=['Density'], transfer_function=tf, pf=pf, use_kd=True, l_max=None,
>               north_vector=up, tree_type='domain',no_ghost=True, steady_north=True)
>
>  cam.rotate((n * angle))
>  cam.snapshot(fout)
>  del cam
>  del tf
>  del alpha
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org<mailto:yt-users at lists.spacepope.org><mailto:yt-users at lists.spacepope.org<mailto:yt-users at lists.spacepope.org>>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org<mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org




More information about the yt-users mailing list