On Tue, Jun 20, 2017 at 1:00 AM, Nathan Goldbaum <nathan12343@gmail.com> wrote:


On Tue, Jun 20, 2017 at 12:42 AM, Stephanie Tonnesen <stonnes@gmail.com> wrote:
Hi Nathan (and yt-users),

Thanks!  Yes, 
arr_in_cm = ndarray_in_centimeters * cm

got yt to see that I was talking about cm.

The problem is that I still don't see the points.  Is there any example of putting points on a volume rendering?  I am trying to mix the "Volume Rendering with Lines" cookbook recipe with the PointSource api description, but am not sure what I am hoping my result will look like--for example, how big can I expect my points to be?  Is that something I can set?

Yup:


It looks like PontSource optionally takes either a scalar or ndarray of radii (one radius value for each point):


And the radii must be given in pixels. I guess we should probably improve this API to handle units better.
 
 

Thanks,

Stephanie




--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes@gmail.com

On Mon, Jun 19, 2017 at 5:48 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Stephanie,

If you have a loaded dataset, you can convert an ndarray that you know is in centimeters to a YTArray in code_length units like so:

arr_in_code_length = ds.arr(ndarray_in_centimeters, 'cm').to('code_length')

In addition, I don't think you actually need to convert to code_length units if you are passing this array to yt, since yt will internally do the conversion if you hand it a YTArray with units, so just creating an array like this is sufficient:

from yt.units import cm

arr_in_cm = ndarray_in_centimeters * cm

And then pass arr_in_cm to some yt function.

If all you want is the conversion factor from CGS to code length units, then you can inspect ds.length_unit. For example, the conversion from code length units to CGS is ds.length_unit.in_cgs(). There are a number of unit attributes that are attached to datasets (ds.mass_unit, ds.velocity_unit, ds.pressure_unit) that are useful for this sort of thing.

Hope that helps!

-Nathan

On Mon, Jun 19, 2017 at 7:38 PM, Stephanie Tonnesen <stonnes@gmail.com> wrote:
Hi yt-users!

I have what I think should be a relatively simple question.  I am trying to make a 3D image of a region of a cosmological simulation, and plot points in the image.  I define my region with box(left_edge,right_edge) where left_edge and right_edge are in code units.  However, the points that I read in from an earlier file are in cgs units.  Since the file was written using yt output, I would like to just let yt do the conversions, but nothing has units attached.  I want the 3d image to get everything into the same units.  I feel like there are a few ways I could fix this problem--1)  tell yt that my points are in cgs units, 2) force the create_scene to be in cgs units, 3) get yt to tell me the conversion factor from code units to cgs units.  

Unfortunately, I don't know how to do any of these things!  

Can someone give me some advice on what to do here?

Thanks!

Stephanie

--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes@gmail.com

_______________________________________________
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



_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org