[yt-users] Accessing Information Stored in Plot.Profile.Field_Data

Nathan Goldbaum nathan12343 at gmail.com
Mon Oct 19 11:15:14 PDT 2015


You probably don't want to print it if you're using it in a script, I was
just printing it it to illustrate what the data look like. You can use it
like any other YTArray instance. You can also cast it to ndarray by doing
e.g.:

import numpy as np

data = np.array(phase_data)

-Nathan

On Mon, Oct 19, 2015 at 11:13 AM, Madison Fitzgerald <fitzg152 at msu.edu>
wrote:

> Yes, that’s exactly what I’ve been trying to do!
>
> So looking at phase_data, how do I expand it so I can see all of the
> information in it? print phase_data only gives so much information, where a
> lot of it is hidden with the line of periods. Is there a way I can print it
> so it will show all of the data (I know this will be very large)?
>
> Thanks,
> Madison
>
>
> Madison Fitzgerald
>
> Astrophysics | Lyman Briggs College
> Women’s & Gender Studies | College of Arts & Letters
> LGBTQ and Sexuality Studies Specialization
> Women in Science, President
> Undergraduate Teaching Assistant
> Department of Physics and Astronomy
> Honors College
> Michigan State University
>
> On Oct 19, 2015, at 2:03 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
> Hi Madison,
>
> Take a look at this example here:
>
> https://gist.github.com/f1f0d5c1b2ff2037e7d2
>
> I think the main problem you're having is accessing the profile data using
> `field_data`. The profile object is designed to have a dictionary-like
> interface like other yt data objects, so you access the data by doing
> "profile[bin_field_name]". In your example, the bin field is 'cell_mass',
> so you would do "profile['cell_mass']".
>
> See also this page in the docs:
> http://yt-project.org/doc/analyzing/generating_processed_data.html?highlight=create_profile#profiles-and-histograms
>
> HTH,
>
> Nathan
>
> On Mon, Oct 19, 2015 at 10:52 AM, Madison Fitzgerald <fitzg152 at msu.edu>
> wrote:
>
>> I apologize, it had a lot of unnecessary information that I didn’t know
>> was in that document—I’ve updated my script with comments that highlights
>> more about what I’m trying to do (http://paste.yt-project.org/show/5987/
>> ).
>>
>> Essentially, what I’m trying to do is to take the data stored in
>> plot.profile.field_data.values() and treat it like a YTArray, so I can
>> manipulate it and use it in the same ways that we use other YTArrays. What
>> I ultimately want to do with this is to find the mass at a specific
>> location of radius and entropy on the plot using the plot data output.
>> However, in the current format, I’m not able to do that, and I haven’t been
>> able to figure out a way to make the data within the plot.profile object
>> more accessible.
>>
>> Thank you,
>> Madison Fitzgerald
>>
>> Astrophysics | Lyman Briggs College
>> Women’s & Gender Studies | College of Arts & Letters
>> LGBTQ and Sexuality Studies Specialization
>> Women in Science, President
>> Undergraduate Teaching Assistant
>> Department of Physics and Astronomy
>> Honors College
>> Michigan State University
>>
>> On Oct 19, 2015, at 1:27 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>> wrote:
>>
>>
>>
>> On Mon, Oct 19, 2015 at 9:45 AM, Madison Fitzgerald <fitzg152 at msu.edu>
>> wrote:
>>
>>> Hello,
>>>
>>> I’m working on accessing the information stored by a phase plot in
>>> plot.profile.field_data, but yt recognizes this as a list, so I can’t seem
>>> to get the information out of this list to use.
>>>
>>> I’ve attached the script with how I’ve been attempting to access the
>>> data (http://paste.yt-project.org/show/5985/), and then the output and
>>> various procedures I’ve tried (http://paste.yt-project.org/show/5986/).
>>>
>>
>> Hi Madison,
>>
>> I'm sorry, I'm having a tough time inferring the issue you're having
>> reading the second pastebin.
>>
>> Can you explain in words a little bit more exactly what the issue is? It
>> would also help if you expand the first script to get it to the point where
>> you are having your issue, and then explain what information you are trying
>> to get out of the profile object.
>>
>> -Nathan
>>
>>
>>>
>>> I’ve been working on a MacBook Pro, OS X 10.10.5, with yt version 3.2
>>> (installed using miniconda, so no changeset).
>>>
>>> I appreciate any help you might be able to give me.
>>>
>>> Thank you,
>>> Madison Fitzgerald
>>>
>>> Astrophysics | Lyman Briggs College
>>> Women’s & Gender Studies | College of Arts & Letters
>>> LGBTQ and Sexuality Studies Specialization
>>> Women in Science, President
>>> Undergraduate Teaching Assistant
>>> Department of Physics and Astronomy
>>> Honors College
>>> Michigan State University
>>>
>>>
>>> _______________________________________________
>>> 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/20151019/923014e9/attachment.htm>


More information about the yt-users mailing list