[yt-users] Stars on volume rendering

Andrew Myers atmyers at berkeley.edu
Thu Jan 6 08:04:32 PST 2011


Hi Elizabeth,

There is probably a better way to do this, but since Orion doesn't have
particle support at the moment, I have a routine for drawing the particle at
position "r" onto a volume rendered image with arbitrary orientation.

import numpy as na

def add_star_projected(r,ax,cam,ms):
    """ Adds the particle at position r to Axes ax. Needs information on the
orientation of the image plane contained in cam """
    north_vector = cam.unit_vectors[0]
    east_vector = cam.unit_vectors[1]
    N1 = cam.resolution[0]
    N2 = cam.resolution[1]
    c = cam.center
    r = r - c
    W = cam.width[0]
    y_pixels = floor(na.dot(r,north_vector) * (N2/W) + N2/2.0)
    x_pixels = floor(na.dot(r,east_vector) * (N1/W) + N1/2.0)
    ax.hold(True)
    ax.plot([x_pixels],[y_pixels],'wo', markersize = ms)
    ax.hold(False)
    ax.axis((0,N1,0,N2))

Assuming you're using the Camera interface, that contains all the
information you need to do the conversion. If you can get a list of
particles w/ their positions (we have our own way of doing this that
probably doesn't apply), you can then loop through that and add them at the
correct position on the off-axis projection.

Andrew M

On Thu, Jan 6, 2011 at 6:15 AM, Elizabeth Harper-Clark <
h-clark at astro.utoronto.ca> wrote:

> Hi all,
>
> Thanks for all your help over the last couple of days. One more question:
>     -  Can I plot particles on a volume rendered image?
> I have stars and I want to show where they are!
>
> Thanks,
>
> Libby
>
> --
> Elizabeth Harper-Clark MA MSci
> PhD Candidate, Canadian Institute for Theoretical Astrophysics, UofT
> Sciences and Engineering Coordinator, Teaching Assistants' Training
> Program, UofT
>
> www.astro.utoronto.ca/~h-clark <http://www.astro.utoronto.ca/%7Eh-clark>
> h-clark at cita.utoronto.ca
> Astronomy office phone: +1-416-978-5759
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20110106/dcc36497/attachment.htm>


More information about the yt-users mailing list