[yt-users] ProjectionTransferFunction with Camera

Sam Skillman samskillman at gmail.com
Wed Jan 29 08:20:58 PST 2014


Hi again,

I think I figured out why the Camera wasn't liking the Projection transfer
function. I don't necessarily want this to be the fix, but I think this
diff will at least let Camera work, and in principle I think that will
filter down to the PerspectiveCamera.

http://paste.yt-project.org/show/4258/

Can you give that a shot?  If that works, I can spend some time thinking
about how this should actually be plugged in.


On Wed, Jan 29, 2014 at 7:58 AM, Munier Azzam Salem <
msalem at astro.columbia.edu> wrote:

> Hi Sam,
>
>      Thanks for the options! Ultimately, I'd like to use a
> PerspectiveCamera object to do these projections (I'd like to do a
> non-orthographic projection, using rays that converge to a focal point ...
> which is what pulled me away from standard OffAxisProjections in the first
> place).
>
> Do you think it's easy for me to copy and modify the ProjectionCamera
> class to either inherit from ProjectionCamera, rather than Camera?
>
> Munier
>
>
> On Wed, Jan 29, 2014 at 10:42 AM, Sam Skillman <samskillman at gmail.com>wrote:
>
>> Hi Munier,
>>
>> I can reproduce the issue you see there using the Camera interface, and
>> am not sure at the moment why that doesn't work. However, there are several
>> alternate methods that may be more useful that are constructed specifically
>> for off axis projections.
>>
>> The first is the off_axis_projection function:
>>
>> http://yt-project.org/docs/dev/visualizing/plots.html#off-axis-projection-plots
>>
>> A while back this was wrapped with an OffAxisProjectionPlot Plot-window
>> interface, which can been seen just below the example linked to above.
>>
>> Finally, you could use the ProjectionCamera class, which inherits a lot
>> of characteristics from the Camera class.  Here's an example on how to run
>> it (modified version of your code above):
>> http://paste.yt-project.org/show/4257/
>>
>> Note that the off_axis_projection function actually just wraps the
>> ProjectionCamera class, and OffAxisProjectionPlot wraps
>> off_axis_projection, so it's all the same underneath.
>>
>> Let us know if that works. I'd suggest you go with the
>> OffAxisProjectionPlot interface since it is meant to be similar to the
>> SlicePlot/ProjectionPlot.
>>
>> Sam
>>
>>
>> On Wed, Jan 29, 2014 at 7:13 AM, Munier Azzam Salem <
>> msalem at astro.columbia.edu> wrote:
>>
>>> Hey Guys,
>>>
>>>      I'm trying to get simple projections, but using the Camera
>>> interface, to allow skewed perspectives. I've tried simply allowing the
>>> camera to use the default ProjectionTransferFunction, in lieu of prettier
>>> color transfer functions ... this seems to yield an all-black image. I've
>>> also tried explicitly setting it's bounds (both with log and non-log
>>> limits). This doesn't seem to help. I see this issue came up about a year
>>> ago here<http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2013-January/003285.html>
>>> .
>>>
>>>        My script's included below. I'm tempted to just tweak my inputs
>>> to the color trasnfer function to mimic a simple projection.
>>>
>>>          thanks!
>>>              Munier
>>>
>>> My script:
>>>
>>> *from yt.mods import **
>>> *import yt.visualization.volume_rendering.api as vr*
>>> *from yt.visualization.volume_rendering.transfer_functions import
>>> ProjectionTransferFunction as PTF*
>>>
>>> *pf = load("DD0179/DD0179")*
>>> *field = 'Density'*
>>> *use_log = True*
>>>
>>> *# Find the bounds in log space of for your field*
>>> *dd = pf.h.all_data()*
>>> *limits = np.array(dd.quantities["Extrema"](field)[0]) * pf.units['cm']*
>>>
>>> *#if use_log:*
>>> *#    limits = np.log(limits)*
>>>
>>> *# Set up the camera parameters: center, looking direction, width,
>>> resolution*
>>>  *c = np.array([.333]*3)*
>>> *L = np.array([1.0, 1.0, 1.0])*
>>> *W = 0.3 / pf["unitary"]*
>>> *N = 1028*
>>>
>>> *# Create a camera object*
>>> *cam = vr.Camera(c, L, W, (N,N), transfer_function=PTF(limits),pf=pf)*
>>> *im = cam.snapshot('density.png')*
>>>
>>> --
>>> Munier A. Salem // 845.489.6450
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> Munier A. Salem // 845.489.6450
>
> _______________________________________________
> 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/20140129/262dc68a/attachment.html>


More information about the yt-users mailing list