[yt-users] questions on projection

Geoffrey So gsiisg at gmail.com
Mon Aug 19 23:53:26 PDT 2013


I think my first guess attempt was off, for a 8x8 projection I got

proj2['x']/pf.units['cm']*8 = proj2['px']

so I think the px is center x coordinate of each pixel in the projection.

From
G.S.


On Mon, Aug 19, 2013 at 11:30 PM, Geoffrey So <gsiisg at gmail.com> wrote:

> Hi, I just tried your script on a small enzo dataset of 64 cube in size
>
> "
> 1. What exactly is returned in proj2? Why does it span from 0. to 1. when
> I specified source=cube?"
>
> - proj2['Density'] got values of a 2D matrix showing the results of the
> unweighted projection of 'Density' along z in the x,y plane, in my case the
> projection was 2x2 pixels.  I think the reason it span from 0 to 1 is
> because you ran a simulation with normalized code units the left edge being
> 0 and right edge being 1.
>
>
> "2. I also tried 'data_source=cube' instead of 'source=cube'. It did not
> raise any error, and returned
> something different: array of same shape, but with different data values.
> Is this keyword also used
>  for projection object? Is there a consistent difference between the two
> keywords in yt?"
>
> - I tried
> >pf.h.proj(2, 'Density', center=center, data_source=cube)
> and got:
> KeyError: 'No field named px'
>
> I'm not familiar with the different versions of yt so if you can reply
> with the results of
> >yt instinfo
> I'm sure someone more knowledgable can pinpoint the version you're using
> and come up with why there's a discrepancy (I'm using an slightly outdated
> developer's version).  I could be wrong so someone please correct me, but
> if I recall correctly I think the data_source newer form for specifying the
> input in the newer ProjectionPlot API.
>
> "3. I could not find documentation on some fields like 'px', 'py' that
> seem to be generated for certain data containers
> (e.g., 't' for ray objects). Is there an exhaustive list of such fields in
> the documentation?"
>
> - You might have gotten different px, py because you were able to do a
> different data_source, if you left it with source=cube, what I got in
> return for >proj2['px'] and >proj2['py'], were
>  the x y edges of cells that are in the projection proj2 in the
> normalized code units.
>
> - doing a
> >help(proj2)
> revealed that proj2 is an 'AMRProj' object, putting it into the search in
> the documentation revealed the API page for that base object at the
> following link
>
> http://yt-project.org/doc/api/generated/yt.data_objects.data_containers.AMRProjBase.html?highlight=amrproj
> from there I only see 'source' as a kwarg and not data_source, so that's
> probably why I'm getting an error when I tried it.
>
> - doing a
> >proj2.fields
> lists the different fields, some like x, dx are in cgs, and px and pdx are
> in your simulation code units, in this case normalized to 1.  I believe the
> x, dx are the cell-center, and cell-center-distance.  I'm not sure about
> px, pdx, but looking at the values (I changed halfwidth=0.05 to have a
> bigger than 2x2 projection to play with), I'm going to guess px is the
> distance of each cell to the center of the projection parallel to x, and
> pdx is the x-spacing between each cell center.
>
> Hope this helps.
>
> From
> G.S.
>
> PS. The documentation is being actively improved upon by the developers,
> so I believe feedback are always welcomed.
>
>
>
> On Mon, Aug 19, 2013 at 9:22 PM, Semyeong Oh <semyeongoh at gmail.com> wrote:
>
>> Hi all,
>>
>> I'm new to yt. I have questions about making projections of certain
>> region, and inspecting the data returned.
>>
>> I made a cube as follows:
>>
>> import pylab as pl
>>
>> center = [0.5, 0.5, 0.5]
>> halfwidth = 0.005
>> cube = pf.h.region(center, center-pl.ones(3)*halfwidth,
>> center+pl.ones(3)*halfwidth, ['Density'])
>>
>> print min(cube['x']), max(cube['x'])
>> 0.494873046875 0.505126953125
>>
>> When I print cube['x'].shape, I get (10728,).
>> I tried to make a projection of this cube along z-axis as follows:
>>
>> proj2 = pf.h.proj(2, 'Density', center=center, source=cube)
>>
>> But I could not understand what is returned.
>>
>> print min(proj2['p
>> x']), max(proj2['py']), proj2['px'].shape
>> 0.00390625 0.99609375 (19648,)
>>
>> print proj2['Density']
>> [ 0.  0.  0. ...,  0.  0.  0.]
>>
>> My questions are:
>> 1. What exactly is returned in proj2? Why does it span from 0. to 1. when
>> I specified source=cube?
>>
>> 2. I also tried 'data_source=cube' instead of 'source=cube'. It did not
>> raise any error, and returned
>> something different: array of same shape, but with different data values.
>> Is this keyword also used
>> for projection object? Is there a consistent difference between the two
>> keywords in yt?
>>
>> 3. I could not find documentation on some fields like 'px', 'py' that
>> seem to be generated for certain data containers
>> (e.g., 't' for ray objects). Is there an exhaustive list of such fields
>> in the documentation?
>>
>> Thanks in advance.
>>
>> Semyeong
>>
>> _______________________________________________
>> 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/20130819/806c0afc/attachment.htm>


More information about the yt-users mailing list