[yt-users] Extracting a list of star particles, their positions and masses from enzo
Ari Maller
AMaller at citytech.cuny.edu
Tue Mar 14 10:20:09 PDT 2017
Hi Carla,
You want to do something like the following
import yt.mods as ytm
from yt.data_objects.particle_filters import add_particle_filter
def enzo_stars(pfilter,data):
filter = data[('io', 'particle_type')] == 2 # DM = 1, Stars = 2
return filter
ds=ytm.load(my_snapshot_name))
add_particle_filter("stars",function=enzo_stars,filtered_type='io',requires=["particle_type"])
ds.add_particle_filter("stars”)
ad = ds.all_data()
x=ad[(‘stars’,’particle_position_x’)]
etc…
using stars will now just return star particles. The fields will have to be fields in your file which you can check with ds.field_list.
Ari
> On Mar 14, 2017, at 11:32 AM, yt-users-request at lists.spacepope.org wrote:
>
> Send yt-users mailing list submissions to
> yt-users at lists.spacepope.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> or, via email, send a message with subject or body 'help' to
> yt-users-request at lists.spacepope.org
>
> You can reach the person managing the list at
> yt-users-owner at lists.spacepope.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of yt-users digest..."
>
>
> Today's Topics:
>
> 1. Re: yt-users Digest, Vol 109, Issue 27 (Slavin, Jonathan)
> 2. Re: Extracting a list of star particles, their positions and
> masses from enzo (Carla Bernhardt)
> 3. Re: Extracting a list of star particles, their positions and
> masses from enzo (Nathan Goldbaum)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 14 Mar 2017 11:27:18 -0400
> From: "Slavin, Jonathan" <jslavin at cfa.harvard.edu>
> To: yt-users at lists.spacepope.org
> Subject: Re: [yt-users] yt-users Digest, Vol 109, Issue 27
> Message-ID:
> <CACcRS=fSRQ=4THnqMR3jCDiup1rRcvfAEFPYaATup_92Df=DCQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> ?Hi Nathan,
>
> I finally uploaded the data file to the curldrop site:
> ?> curl -T
> /data/plato/mmsnr/flash_data/run-3f818dc2/sedov_hdf5_plt_cnt_0200
> http://use.yt/upload/
> Stream body handler: received 467741048 bytes
> http://use.yt/upload/147aa558
>
> Tell me if you need more information about reproducing my issue.
>
> Thanks a lot,
> Jon
>
> On Fri, Mar 10, 2017 at 4:05 PM, <yt-users-request at lists.spacepope.org>
> wrote:
>
>> Date: Fri, 10 Mar 2017 12:14:55 -0800
>> From: Nathan Goldbaum <nathan12343 at gmail.com>
>> To: Discussion of the yt analysis package
>> <yt-users at lists.spacepope.org>
>> Subject: Re: [yt-users] cutting plane not working or changed behavior
>> Message-ID:
>> <CAJXewOmWwY1CU4nrafG5_=GrAScGBnq=VMNxxh3s0OUzDzaGVw@
>> mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Jonathan,
>>
>> I'm not able to reproduce the behavior you're seeing with a test dataset
>> (e.g. see http://paste.yt-project.org/show/7080/, this uses a dataset from
>> yt-project.org/data).
>>
>> Is there any chance you can share a dataset that triggers this?
>> Alternatively, can you reproduce this using one of the test datasets on
>> yt-project.org/data?
>>
>> The yt curldrop might be useful to share a dataset that triggers the issue
>> you're seeing, see docs.hub.yt. If you're not comfortable sharing the
>> dataset publicly, feel free to share it with me off-list.
>>
>> -Nathan
>>
>
>
>
>
> --
> ________________________________________________________
> Jonathan D. Slavin Harvard-Smithsonian CfA
> jslavin at cfa.harvard.edu 60 Garden Street, MS 83
> phone: (617) 496-7981 Cambridge, MA 02138-1516
> cell: (781) 363-0035 USA
> ________________________________________________________
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170314/8866e7a4/attachment-0001.htm>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 14 Mar 2017 16:28:17 +0100
> From: Carla Bernhardt <carla.j.bernhardt at gmail.com>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Extracting a list of star particles, their
> positions and masses from enzo
> Message-ID:
> <CAKQMXAVTzJ9Y2D7xXWHHg+2HXpWY4=7RzSfHoJPwosYGSMsx-g at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Nathan,
>
> Yes, of course. Here is what I tried
> <http://paste.yt-project.org/show/7082/> and here is the error message
> <http://paste.yt-project.org/show/7084/> I get. What I tried might not be
> the right way to get this list, but I was hoping someone else has done this
> before and has some insight.
>
> Best,
> Carla
>
> 2017-03-14 16:00 GMT+01:00 Nathan Goldbaum <nathan12343 at gmail.com>:
>
>> Hi Carla,
>>
>> Can you share the script you're running and the full error message and
>> traceback you're seeing? If you can, it helps if you can make your script
>> that triggers your issue as minimal as possible.
>>
>> We have the yt pastebin set up for sharing snippets of code and text:
>> paste.yt-project.org.
>>
>> -Nathan
>>
>> On Tue, Mar 14, 2017 at 2:30 AM, Carla Bernhardt <
>> carla.j.bernhardt at gmail.com> wrote:
>>
>>> Dear yt users,
>>>
>>> I am trying to extract a list of star particles and their positions and
>>> masses from enzo. This seems to be right along the lines of this tutorial
>>> <http://yt-project.org/doc/analyzing/fields.html>, but I am still stuck.
>>> If I try
>>>
>>> print(ad["dark_matter", "particle_position"])
>>> print(ad["stars", "particle_position"])
>>> print(ad["black_holes", "particle_position"])
>>>
>>> I get that none of these fields are available in my provided data. I am
>>> using Stochastic Star Formation with a MBH inserted (i.e.
>>> StarParticleCreation=514).
>>>
>>> Thanks in advance,
>>> Carla Bernhardt
>>> PhD Student
>>> Universit?t Heidelberg
>>> ZAH Institut f?r Theoretische Astrophysik
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> 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/20170314/55c36072/attachment-0001.htm>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 14 Mar 2017 10:32:00 -0500
> From: Nathan Goldbaum <nathan12343 at gmail.com>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Extracting a list of star particles, their
> positions and masses from enzo
> Message-ID:
> <CAJXewO=sCXCpFn1bpsSL3vK9AjiA7OMwPy5SRAmb8Lp09XDhzQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> You need to define some particle filters. Enzo only has one on-disk
> particle type. Particle filters let you define new particle types based on
> some filtering criterion. For Enzo it's usually sufficient to filter on the
> ('io', 'particle_type') field.
>
> There is an example of adding a particle filter with enzo data in the docs
> here:
>
> http://yt-project.org/docs/dev/cookbook/calculating_information.html#using-particle-filters-to-calculate-star-formation-rates
>
> And more information on particle filters here:
>
> http://yt-project.org/docs/dev/analyzing/filtering.html?highlight=filter#filtering-particle-fields
>
> The Enzo frontend does not predefine any particle fields since we don't
> want to accidentally cause users to generate anaylsis or visualization
> results based on a particle filter definition that does not apply to all
> data types.
>
> -Nathan
>
> On Tue, Mar 14, 2017 at 10:28 AM, Carla Bernhardt <
> carla.j.bernhardt at gmail.com> wrote:
>
>> Nathan,
>>
>> Yes, of course. Here is what I tried
>> <http://paste.yt-project.org/show/7082/> and here is the error message
>> <http://paste.yt-project.org/show/7084/> I get. What I tried might not be
>> the right way to get this list, but I was hoping someone else has done this
>> before and has some insight.
>>
>> Best,
>> Carla
>>
>> 2017-03-14 16:00 GMT+01:00 Nathan Goldbaum <nathan12343 at gmail.com>:
>>
>>> Hi Carla,
>>>
>>> Can you share the script you're running and the full error message and
>>> traceback you're seeing? If you can, it helps if you can make your script
>>> that triggers your issue as minimal as possible.
>>>
>>> We have the yt pastebin set up for sharing snippets of code and text:
>>> paste.yt-project.org.
>>>
>>> -Nathan
>>>
>>> On Tue, Mar 14, 2017 at 2:30 AM, Carla Bernhardt <
>>> carla.j.bernhardt at gmail.com> wrote:
>>>
>>>> Dear yt users,
>>>>
>>>> I am trying to extract a list of star particles and their positions and
>>>> masses from enzo. This seems to be right along the lines of this
>>>> tutorial <http://yt-project.org/doc/analyzing/fields.html>, but I am
>>>> still stuck. If I try
>>>>
>>>> print(ad["dark_matter", "particle_position"])
>>>> print(ad["stars", "particle_position"])
>>>> print(ad["black_holes", "particle_position"])
>>>>
>>>> I get that none of these fields are available in my provided data. I am
>>>> using Stochastic Star Formation with a MBH inserted (i.e.
>>>> StarParticleCreation=514).
>>>>
>>>> Thanks in advance,
>>>> Carla Bernhardt
>>>> PhD Student
>>>> Universit?t Heidelberg
>>>> ZAH Institut f?r Theoretische Astrophysik
>>>>
>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> 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/20170314/aaf0d92e/attachment.htm>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> End of yt-users Digest, Vol 109, Issue 33
> *****************************************
More information about the yt-users
mailing list