[yt-users] camera and boolean object

Sam Skillman samskillman at gmail.com
Tue Oct 23 07:11:25 PDT 2012


Hi Ryan, Stephen,

The main issue here is that the cameras are explicitly fed a parameter
file, not a data object.  For some of the cameras, this was done because we
don't currently (though it is in the works) have a brick homogenization
routine that acts on a data object instead of a parameter file.  For others
(off-axis and allsky in particular), there would be a way to get around
this, but it will require modifying the source.

Around line 1530 of yt/visualization/volume_rendering/camera.py, there are
the following lines:

    grids = pf.h.sphere(center, radius)._grids
    sampler = ProjectionSampler(positions, vs, center, (0.0, 0.0, 0.0, 0.0),
                                image, uv, uv, np.zeros(3, dtype='float64'))
    pb = get_pbar("Sampling ", len(grids))
    for i,grid in enumerate(grids):
        data = [grid[field] * grid.child_mask.astype('float64')
                for field in fields]

I think what you would want to do is add a source= keyword argument to the
allsky projection call, and then use the object to get the grids in
question. How to get the boolean regions to work correctly, which might
need modification of the above loop, I'll leave up to Stephen.

Ryan, If you get this to work, please feel free to fork the repository and
issue a pull request with the new feature.

Cheers,
Sam


On Tue, Oct 23, 2012 at 7:28 AM, Stephen Skory <s at skory.us> wrote:

> Hi Ryan,
>
> > I have a question about volume rendering.  I'd like to run
> camera.allsky_projection on a data object with a particular shape, in this
> case a sphere with a cylindrical hole in the center.  I was able to define
> such an object using the boolean operator "NOT".  But feeding it to
> camera.allsky_projection leads to an error, with the traceback below.
>
> I think I might have an idea on how to address this, but since I'd
> like to A) test the fix myself before pushing it and B) have a better
> understanding of what you're doing in the first place, would you mind
> sharing the script you're using? That would be most helpful, thanks!
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> 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/20121023/3f04c422/attachment.html>


More information about the yt-users mailing list