fixing particle information for the ellipsoid container
![](https://secure.gravatar.com/avatar/b8340e5ad7f6df5042b7d4a53be72e18.jpg?s=120&d=mm&r=g)
Hi all, Currently the ellipsoid 3D container has a couple short coming that makes it undesirable to use, I think the most major one is that it does not return the particle information (positions, velocities, type etc) I am interested at least in fixing it, because I may use this directly in my research, so I was wondering if anyone has worked on 3D containers to help me out in digging for the cause of this? The code that describes the 3D container is in this file yt-hg/yt/data_objects/data_containers.py Originally, I emulated what was done with the sphere 3D object, and I thought I followed everything that was done, but obviously I missed something. It is possibly very subtle or glaringly visible but I am just blind to it. any thoughts or hints for what to look at/where to dig would be appreciated. From G.S.
![](https://secure.gravatar.com/avatar/840187ceea095b109116d969e49dce3b.jpg?s=120&d=mm&r=g)
Hi Geoffrey,
I am interested at least in fixing it, because I may use this directly in my research, so I was wondering if anyone has worked on 3D containers to help me out in digging for the cause of this?
It is unfortunate that Matt is on vacation because he would be the best equipped to answer this, but I've done some particle stuff in yt for enzo data, so I'll take a shot. One answer is you'll have to add some functions to yt/utilities/hdf5_light_reader.c that can select out particles from an ellipsoid. You can see how it's done for a cylinder, sphere, or right-angled region already. You'll also have to make some commensurate changes in the python interface such that these new functions are called, but for the time being you can study that .c file and decide if that's the route you want to go down, since that is the hardest part! Another answer is to make your changes in yt-3, which is still under heavy development. In particular, it is using a different model of how to read in and process data, which may make your life easier. I am not knowledgable enough to help you with that, you will have to wait on Matt for this. A more hacky route is to kludge it for the time being and do something like this. - For the ellipsoid create a sphere that contains it entirely. - Get the particle positions from the sphere. - Apply the math you use to select cells to these particle positions, keeping particles that are inside. With this you can create a mask which you can use to apply to other fields (e.g. big_enough_sphere['ParticleMassMsun'][mask]) Good luck! -- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice)
![](https://secure.gravatar.com/avatar/b8340e5ad7f6df5042b7d4a53be72e18.jpg?s=120&d=mm&r=g)
Ah this file is it, I guess I didn't know reading the particles for the 3D objects was in a whole different file. Thanks, I'll look into it. From G.S. On Mon, Apr 1, 2013 at 3:39 PM, Stephen Skory <s@skory.us> wrote:
Hi Geoffrey,
I am interested at least in fixing it, because I may use this directly in my research, so I was wondering if anyone has worked on 3D containers to help me out in digging for the cause of this?
It is unfortunate that Matt is on vacation because he would be the best equipped to answer this, but I've done some particle stuff in yt for enzo data, so I'll take a shot.
One answer is you'll have to add some functions to yt/utilities/hdf5_light_reader.c that can select out particles from an ellipsoid. You can see how it's done for a cylinder, sphere, or right-angled region already. You'll also have to make some commensurate changes in the python interface such that these new functions are called, but for the time being you can study that .c file and decide if that's the route you want to go down, since that is the hardest part!
Another answer is to make your changes in yt-3, which is still under heavy development. In particular, it is using a different model of how to read in and process data, which may make your life easier. I am not knowledgable enough to help you with that, you will have to wait on Matt for this.
A more hacky route is to kludge it for the time being and do something like this. - For the ellipsoid create a sphere that contains it entirely. - Get the particle positions from the sphere. - Apply the math you use to select cells to these particle positions, keeping particles that are inside. With this you can create a mask which you can use to apply to other fields (e.g. big_enough_sphere['ParticleMassMsun'][mask])
Good luck!
-- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice) _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
![](https://secure.gravatar.com/avatar/abbf30a6e2a3b5a2641e8c41f75c4e15.jpg?s=120&d=mm&r=g)
Hi Geoffrey, At first I thought particle io would be simple to add, but after reading stephen's response and looking into it more, it seems you will need to either mask the particles after the fact or modify the hdf5_light_reader. Once you do that, you'll need to also modify the particle_io.py file, as I had started to (with a minor adjustment to call the correct type of reader). My failed attempt was taken out by the time I PR'ed the ellipsoid speedup, but you can see the attempt if you look at: https://bitbucket.org/samskillman/yt/commits/8dd9d9819b061bcfa68d2ef962e44f4... Hope that helps. Additionally, if you could test out the PR I just submitted and let me know if you get a speed boost, that'd be great. For the nosetests I got a speedup from about 60 seconds in test_ellipsoids.py to 36 seconds. Cheers, Sam On Mon, Apr 1, 2013 at 4:51 PM, Geoffrey So <gsiisg@gmail.com> wrote:
Ah this file is it, I guess I didn't know reading the particles for the 3D objects was in a whole different file.
Thanks, I'll look into it.
From G.S.
On Mon, Apr 1, 2013 at 3:39 PM, Stephen Skory <s@skory.us> wrote:
Hi Geoffrey,
I am interested at least in fixing it, because I may use this directly in my research, so I was wondering if anyone has worked on 3D containers to help me out in digging for the cause of this?
It is unfortunate that Matt is on vacation because he would be the best equipped to answer this, but I've done some particle stuff in yt for enzo data, so I'll take a shot.
One answer is you'll have to add some functions to yt/utilities/hdf5_light_reader.c that can select out particles from an ellipsoid. You can see how it's done for a cylinder, sphere, or right-angled region already. You'll also have to make some commensurate changes in the python interface such that these new functions are called, but for the time being you can study that .c file and decide if that's the route you want to go down, since that is the hardest part!
Another answer is to make your changes in yt-3, which is still under heavy development. In particular, it is using a different model of how to read in and process data, which may make your life easier. I am not knowledgable enough to help you with that, you will have to wait on Matt for this.
A more hacky route is to kludge it for the time being and do something like this. - For the ellipsoid create a sphere that contains it entirely. - Get the particle positions from the sphere. - Apply the math you use to select cells to these particle positions, keeping particles that are inside. With this you can create a mask which you can use to apply to other fields (e.g. big_enough_sphere['ParticleMassMsun'][mask])
Good luck!
-- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice) _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
_______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (3)
-
Geoffrey So
-
Sam Skillman
-
Stephen Skory