strange particle field behavior
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
On Fri, May 10, 2013 at 4:44 PM, Britton Smith
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?
No, not really. But there is one thing that I should note, which is that it may be getting caused by using "IsStarParticle" as a boolean index. Which would not work correctly, and would just return the 0th and 1st values of whatever array it's being used as an index into. I think. -Matt
Britton
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Ok, so we should probably remove that field from the code base since it is
not really doing the right thing. It doesn't seem to be in use anywhere.
Does anyone have any thoughts on removing this? +-1?
On Fri, May 10, 2013 at 4:49 PM, Matthew Turk
On Fri, May 10, 2013 at 4:44 PM, Britton Smith
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?
No, not really. But there is one thing that I should note, which is that it may be getting caused by using "IsStarParticle" as a boolean index. Which would not work correctly, and would just return the 0th and 1st values of whatever array it's being used as an index into. I think.
-Matt
Britton
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hey Britton,
I'd say -1
In principle we should be able to define boolean fields. If there's something about the way that handle fields that prevents that, we should fix it.
-Nathan
On May 10, 2013, at 2:13 PM, Britton Smith
Ok, so we should probably remove that field from the code base since it is not really doing the right thing. It doesn't seem to be in use anywhere. Does anyone have any thoughts on removing this? +-1?
On Fri, May 10, 2013 at 4:49 PM, Matthew Turk
wrote: On Fri, May 10, 2013 at 4:44 PM, Britton Smith 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?
No, not really. But there is one thing that I should note, which is that it may be getting caused by using "IsStarParticle" as a boolean index. Which would not work correctly, and would just return the 0th and 1st values of whatever array it's being used as an index into. I think.
-Matt
Britton
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
In my work with the secretive enzo-BW (~1.5) data, I've always just defined
my own derived field using creation time when I needed to check if a
particle is a star. I don't recall using it in the ellipsoid parameter
find. Not sure if Stephen used it in his halo finder, but I thought he
made his own as well.
a quick grep in the source show it being used only in:
frontends/enzo/fields.py:def _IsStarParticle(field, data):
frontends/enzo/fields.py:add_field('IsStarParticle',
function=_IsStarParticle,
But I don't know if others use this or not, and I don't know if I want to
use it in the future if I implement dm or dm+star in ellipsoid halo
calculations. So I'm with Nathan that it's probably better to fix if it's
an easy fix.
From
G.S.
On Fri, May 10, 2013 at 2:17 PM, Nathan Goldbaum
Hey Britton,
I'd say -1
In principle we should be able to define boolean fields. If there's something about the way that handle fields that prevents that, we should fix it.
-Nathan
On May 10, 2013, at 2:13 PM, Britton Smith
wrote: Ok, so we should probably remove that field from the code base since it is not really doing the right thing. It doesn't seem to be in use anywhere. Does anyone have any thoughts on removing this? +-1?
On Fri, May 10, 2013 at 4:49 PM, Matthew Turk
wrote: On Fri, May 10, 2013 at 4:44 PM, Britton Smith
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?
No, not really. But there is one thing that I should note, which is that it may be getting caused by using "IsStarParticle" as a boolean index. Which would not work correctly, and would just return the 0th and 1st values of whatever array it's being used as an index into. I think.
-Matt
Britton
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
I was able to reproduce this behavior on the sample IsolatedGalaxy dataset.
FWIW, the same operations works as expected in yt-3.0.
On Fri, May 10, 2013 at 2:41 PM, Andrew Myers
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (5)
-
Andrew Myers
-
Britton Smith
-
Geoffrey So
-
Matthew Turk
-
Nathan Goldbaum