[yt-users] strange particle field behavior
Andrew Myers
atmyers at berkeley.edu
Fri May 10 14:41:23 PDT 2013
Hi Britton,
FWIW, I've done things like this before with Orion data and it seems to
work:
def _IsStar(field, data):
is_star = (data['ParticleMassMsun'] > 0.05).astype('float64')
return is_star
add_field("IsStar", function=_IsStar, take_log=False, particle_type=True)
Then:
all_data = pf.h.all_data()
print all_data['IsStar']
yt : [INFO ] 2013-05-10 14:35:27,252 Getting field ParticleMassMsun
from 3611
[ 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]
Maybe this is something specific to the Enzo frontend?
-Andrew
On Fri, May 10, 2013 at 1:44 PM, Britton Smith <brittonsmith at gmail.com>wrote:
> Hi all,
>
> I am seeing something odd with a field called "IsStarParticle". This is
> an Enzo field defined in the following way:
>
> def _IsStarParticle(field, data):
> is_star = (data['creation_time'] > 0).astype('float64')
> return is_star
>
> When I do the following:
> print pf.h.grids[0]['IsStarParticle']
>
> I get the expected field of 1s and 0s.
>
> When I do this:
> all_data = pf.h.all_data()
> print all_data['IsStarParticle']
>
> I get the values that correspond to the creation_time field. It does not
> matter in what order I do this. Whenever I try to access the field from a
> geometric object, I get the actual creation time and not the field I
> expect. Whenever I access it from a grid object, I get the right thing.
>
> Does anyone know what's going on here?
>
> Britton
>
> _______________________________________________
> 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/20130510/2b9f0c05/attachment.html>
More information about the yt-users
mailing list