HI All, Is there an easy way to access the x_field and the y_fields in the ProfilePlot function? So for example prof = ProfilePlot(sphere, "radius", "density") print prof.x_field print prof.y_field[0] I inserted a couple of hack functions into the ProfilePlot class to return the x_field and the .items() tuple but there is probably a better way? John
Hi John, ProfilePlot is a wrapper around the Profile1D class, which calculates and stores the histograms. To access the underlying data you need to access the profile object via the profiles attribute of the ProfilePlot: import yt ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') plot = yt.ProfilePlot(ds.all_data(), 'radius', 'density') profile = plot.profiles[0] print profile.x_field, profile.x print profile.field_data.keys(), profile['density'] There are probably a number of ways that the current API can be improved to make it more straightforward to access this data. PRs along this front would be very welcome, I think. -Nathan On Sun, Sep 28, 2014 at 1:05 AM, John Regan <johnanthonyregan@gmail.com> wrote:
HI All,
Is there an easy way to access the x_field and the y_fields in the ProfilePlot function?
So for example
prof = ProfilePlot(sphere, "radius", "density")
print prof.x_field print prof.y_field[0]
I inserted a couple of hack functions into the ProfilePlot class to return the x_field and the .items() tuple but there is probably a better way?
John
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan, Thanks for that. I'll have a look at what helper functions would be useful as I use the ProfilePlot routine and I can issue a PR then. I think it would be worth updating the docs with info like you just sent me. Cheers, John On Sun, Sep 28, 2014 at 11:17 AM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi John,
ProfilePlot is a wrapper around the Profile1D class, which calculates and stores the histograms. To access the underlying data you need to access the profile object via the profiles attribute of the ProfilePlot:
import yt ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') plot = yt.ProfilePlot(ds.all_data(), 'radius', 'density') profile = plot.profiles[0] print profile.x_field, profile.x print profile.field_data.keys(), profile['density']
There are probably a number of ways that the current API can be improved to make it more straightforward to access this data. PRs along this front would be very welcome, I think.
-Nathan
On Sun, Sep 28, 2014 at 1:05 AM, John Regan <johnanthonyregan@gmail.com> wrote:
HI All,
Is there an easy way to access the x_field and the y_fields in the ProfilePlot function?
So for example
prof = ProfilePlot(sphere, "radius", "density")
print prof.x_field print prof.y_field[0]
I inserted a couple of hack functions into the ProfilePlot class to return the x_field and the .items() tuple but there is probably a better way?
John
_______________________________________________ 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
On Sunday, September 28, 2014, John Regan <johnanthonyregan@gmail.com> wrote:
Hi Nathan,
Thanks for that. I'll have a look at what helper functions would be useful as I use the ProfilePlot routine and I can issue a PR then. I think it would be worth updating the docs with info like you just sent me.
Again, please feel free to open a pull request.
Cheers, John
On Sun, Sep 28, 2014 at 11:17 AM, Nathan Goldbaum <nathan12343@gmail.com <javascript:_e(%7B%7D,'cvml','nathan12343@gmail.com');>> wrote:
Hi John,
ProfilePlot is a wrapper around the Profile1D class, which calculates and stores the histograms. To access the underlying data you need to access the profile object via the profiles attribute of the ProfilePlot:
import yt ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') plot = yt.ProfilePlot(ds.all_data(), 'radius', 'density') profile = plot.profiles[0] print profile.x_field, profile.x print profile.field_data.keys(), profile['density']
There are probably a number of ways that the current API can be improved to make it more straightforward to access this data. PRs along this front would be very welcome, I think.
-Nathan
On Sun, Sep 28, 2014 at 1:05 AM, John Regan <johnanthonyregan@gmail.com <javascript:_e(%7B%7D,'cvml','johnanthonyregan@gmail.com');>> wrote:
HI All,
Is there an easy way to access the x_field and the y_fields in the ProfilePlot function?
So for example
prof = ProfilePlot(sphere, "radius", "density")
print prof.x_field print prof.y_field[0]
I inserted a couple of hack functions into the ProfilePlot class to return the x_field and the .items() tuple but there is probably a better way?
John
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:_e(%7B%7D,'cvml','yt-users@lists.spacepope.org');> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:_e(%7B%7D,'cvml','yt-users@lists.spacepope.org');> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
John Regan
-
Nathan Goldbaum