[yt-users] Field extraction from arbitrary grids

Carla Bernhardt carla.j.bernhardt at gmail.com
Fri Jul 21 08:15:19 PDT 2017


Hi Nathan,

Now that you mention it, it seems so obvious! Thank you for helping me out.
That seems to work just fine.

Cheers,
Carla

2017-07-21 16:13 GMT+02:00 Nathan Goldbaum <nathan12343 at gmail.com>:

> Hi Carla,
>
> You could use the ('enzo', 'HI_Density') and ('enzo', 'HII_Density')
> fields.
>
> The reasons there aren't 'gas' fields for those field names is that yt has
> a different internal naming convention for species fields. If you take a
> look at ds.derived_field_list, I bet you have ('gas', 'H_p0_density') and
> ('gas', 'H_p1_density') fields. These are the "universal" alias fields for
> the Enzo fields you are looking for.
>
> -Nathan
>
>
> On Fri, Jul 21, 2017 at 6:13 AM Carla Bernhardt <
> carla.j.bernhardt at gmail.com> wrote:
>
>> Hi Matthew,
>>
>> Thank you for the suggestion. That works much better for the temperature
>> field. I also need, however, HI_Density and HII_Density and these do not
>> seem to be within the "gas" (here is the Traceback
>> <https://pastebin.com/CKHsXDd5> from when I try that). This is the field
>> list <https://pastebin.com/44ZtK8JU> from my data, do you have any
>> suggestions for how I could also extract the HI_Density and HII_Density
>> successfully?
>>
>> Thanks,
>> Carla
>>
>> 2017-07-20 16:38 GMT+02:00 Matthew Turk <matthewturk at gmail.com>:
>>
>>> Hi Carla,
>>>
>>> It's possible that it's writing out the particle values.  If you
>>> explicitly ask for ["gas", "temperature"] it may write that value out.
>>> You can control how the values are deposited on the grid by specifying
>>> smoothed, deposited, etc fields.
>>>
>>> On Thu, Jul 20, 2017 at 5:03 AM, Carla Bernhardt
>>> <carla.j.bernhardt at gmail.com> wrote:
>>> > Hi yt-users,
>>> >
>>> > I was able to get the arbitrary grid working by updating yt to the
>>> newest
>>> > version. I am quite confused, however, by the output. If I extract my
>>> > arbitrary grid:
>>> >
>>> > obj = ds.arbitrary_grid(left_edge, right_edge, dims=[256, 256, 256])
>>> >
>>> > and extract the desired fields:
>>> >
>>> > temp = obj["temperature"]
>>> > HIdens = obj["HI_Density"]
>>> >
>>> > (which all works successfully), I then want to write this to a file and
>>> > would expect that such a file would have 256^3 = 16777216 lines, but I
>>> not
>>> > only don't get this number of lines for my outputs, I even get
>>> different
>>> > number of lines for different fields. Here is the part of my code that
>>> > writes the file. Ideas? Thanks in advance.
>>> >
>>> > Cheers,
>>> > Carla
>>> >
>>> > 2017-07-12 12:35 GMT+02:00 Carla Bernhardt <
>>> carla.j.bernhardt at gmail.com>:
>>> >>
>>> >> Hi Matthew,
>>> >>
>>> >> Thank you for your reply. I was using yt Version 3.2.3 and am working
>>> out
>>> >> some installation issues on our server with version 3.3.5. As for the
>>> type
>>> >> of data, I have an enzo simulation with static nested grids as well
>>> as up to
>>> >> 6 levels AMR grids. I will have to get back to you once I get past the
>>> >> issues with the newest installation of yt.... Thanks for the initial
>>> >> pointers.
>>> >>
>>> >> Cheers,
>>> >> Carla
>>> >>
>>> >>
>>> >> 2017-07-11 14:15 GMT+02:00 Matthew Turk <matthewturk at gmail.com>:
>>> >>>
>>> >>> Hi Carla,
>>> >>>
>>> >>> Interesting.  It's possible, for the call to "temperature" (which
>>> >>> raises NotImplementedError) that the version of yt you're on doesn't
>>> >>> yet support mesh fields in arbitrary grids; that was added reasonably
>>> >>> recently.  For the others, I'm not totally sure why it's breaking --
>>> >>> which version of yt are you using, and what type of data?  It may
>>> just
>>> >>> be that they aren't deposit fields.  In that case, try explicitly
>>> >>> stating obj["gas","temperature"] or obj["gas","HI_Density"].  It may
>>> >>> also be that the aliasing is getting in the way, in which case
>>> instead
>>> >>> of "HI_Density" you might need to try "Hp0_density".
>>> >>>
>>> >>> On Tue, Jul 11, 2017 at 5:42 AM, Carla Bernhardt
>>> >>> <carla.j.bernhardt at gmail.com> wrote:
>>> >>> > Dear yt-users,
>>> >>> >
>>> >>> > I am trying to extract a unigrid data cube within a specific
>>> region and
>>> >>> > specified dimensions, thus I am using arbitrary_grid(), however,
>>> beyond
>>> >>> > the
>>> >>> > example given in the docs, my field extractions all fail. I would
>>> like
>>> >>> > to
>>> >>> > extract temperature, HI_Density and HII_Density. Here is a snippet
>>> from
>>> >>> > my
>>> >>> > code:
>>> >>> >
>>> >>> > obj = ds.arbitrary_grid(left_edge, right_edge, dims=[256, 256,
>>> 256])
>>> >>> > print(obj["deposit", "all_density"])
>>> >>> > print(obj["temperature"])
>>> >>> > print(obj["HI_Density"])
>>> >>> >
>>> >>> > The line print(obj["deposit", "all_density"]) works, but the two
>>> lines
>>> >>> > after
>>> >>> > both fail. Here is the traceback from the temperature, and I even
>>> tried
>>> >>> > out
>>> >>> > deposited temperature and deposited HI_Density. Am I formatting
>>> this
>>> >>> > incorrectly, or is there a different way to extract the fields?
>>> >>> >
>>> >>> > Kind regards,
>>> >>> > Carla Bernhardt
>>> >>> > PhD Student
>>> >>> > ZAH Institut für Theoretische Astrophysik
>>> >>> > Universität Heidelberg
>>> >>> >
>>> >>> > _______________________________________________
>>> >>> > 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
>>> >
>>> _______________________________________________
>>> 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/20170721/621399ae/attachment-0001.htm>


More information about the yt-users mailing list