[yt-users] combining data objects

Christine Simpson csimpson at astro.columbia.edu
Tue Sep 6 13:16:06 PDT 2011


Hmmm... I actually wanted to feed this new object to the star analysis
module so I don't think this will work for me.  But it's very useful to
know for future reference.  Maybe I'll try what Matt suggested or come
up with another solution.

On Tue, 2011-09-06 at 13:54 -0600, Stephen Skory wrote:
> Christine,
> 
> Depending on what you want to do, it could be a simple as something like this:
> 
> sp1 = pf.h.sphere([0.2]*3, 0.1)
> sp2 = pf.h.sphere([0.7]*3, 0.2)
> 
> def spboth(field):
>     one = sp1[field]
>     two = sp2[field]
>     return na.concatenate((one, two))
> 
> and then you could do things like
> 
> spboth('Density')
> 
> Many things will not work with spboth, like quantities. Matt's
> suggestion would probably be a better long-term solution.
> 





More information about the yt-users mailing list