[yt-users] Questions about yt

Nathan Goldbaum nathan12343 at gmail.com
Wed Jun 22 20:30:11 PDT 2016


On Wed, Jun 22, 2016 at 11:23 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

>
>
> On Wed, Jun 22, 2016 at 2:03 PM, Hansheng Chen <jasonhs1221 at gmail.com>
> wrote:
>
>> Dear yt-users,
>>
>> I got a image of projected gas density of a galaxy, and from this
>> projected image, I could get a image array of projected gas density with a
>> resolution of (800, 800). Now, I would like to set the center at (400, 400)
>> and to get a profile that shows the relationship between the projected gas
>> density and radius in 2-D. Could some one give me any help in getting a
>> radial profile from the image array?
>>
>
> There isn't anything in yt 3.2.3 that does this directly, although one can
> straightforwardly accomplish this using numpy's histogram function if you
> bin pixels according to radius.
>

Although, if you're willing to install the development version of yt, you
can use the ytdata frontend to save a projection data object and reload it
as a dataset:

http://yt-project.org/docs/dev/analyzing/saving_data.html#spatial-plots

Here's a small example that illustrates this workflow using a test dataset
from yt-project.org/data:

    import yt

    ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
    prj = ds.proj(['density', 'radius'], 0)
    prj.save_as_dataset()

    ds2 = yt.load('galaxy0030_proj.h5')
    plot = yt.ProfilePlot(ds2.all_data(), 'radius', 'density',
weight_field=None)
    plot.save()

Which produces the following image:

http://i.imgur.com/L0nxEyy.png

-Nathan


>
>
>>
>> Thank you!
>>
>> Sincerely,
>> Hansheng
>>
>> _______________________________________________
>> 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/20160622/3c65644c/attachment.html>


More information about the yt-users mailing list