[yt-users] projection depth

Britton Smith brittonsmith at gmail.com
Tue Apr 13 08:16:00 PDT 2010


Hi again,

I made a small typo in the example, the second line should read:

pc.add_projection('Density', 0, weight_field='Density',
field_cuts=['grid["x"] > 0.4', 'grid["x"] < 0.6'])

I had a single quote missing after the 0.4.

Britton

On Tue, Apr 13, 2010 at 9:14 AM, Britton Smith <brittonsmith at gmail.com>wrote:

> Hi Luigi,
>
> Here is one more option.  The projection function accepts a keyword called
> "field_cuts", which allows you to only project cells that satisfy certain
> field based criteria.  For example, you could do this:
>
> pc = PlotCollection(pf, center=[0.5,0.5,0.5])
> pc.add_projection('Density', 0, weight_field='Density',
> field_cuts=['grid["x"] > 0.4, 'grid["x"] < 0.6'])
>
> The one advantage I see of doing it this way is that this will work in
> parallel, where supplying a source keyword will not.
>
> Britton
>
> On Tue, Apr 13, 2010 at 9:12 AM, John Wise <jwise at astro.princeton.edu>wrote:
>
>> Hi Matt,
>>
>> I was curious if a PlotCollection could accept an AMRregion, and it could,
>> to my surprise!  However, it mangles the imagenames, and thus you have to
>> specify it manually.  I've always used the source argument before, but kept
>> to Luigi's style on this sample code :)
>>
>> Thanks!
>> John
>>
>>
>> On 04/13/2010 11:06 AM, Matthew Turk wrote:
>>
>>> Hi John, Luigi,
>>>
>>> I think you also will need to specify the region as a data_source to
>>> the add_projection call:
>>>
>>> pc.add_projection("Density", 0,source=reg)
>>>
>>> and I think PlotCollection sitll takes the pf, not the reg variable,
>>> as its argument.  Here's an example script, if you wanted to do it
>>> with a sphere:
>>>
>>> http://paste.enzotools.org/show/441/
>>>
>>> I'll add the scripts you sent with this modification to the cookbook.
>>>  Thanks!
>>>
>>> -Matt
>>>
>>> On Tue, Apr 13, 2010 at 11:04 AM, John Wise<jwise at astro.princeton.edu>
>>>  wrote:
>>>
>>>> Hi,
>>>>
>>>> I would think that you'd have to change the region boundaries, if you
>>>> wanted
>>>> to change the projection depth.  To have L=0.2, you have to change your
>>>> region boundaries to reflect that change, i.e. [0.4,0.4,0.4] ->
>>>> [0.6,0.6,0.6].
>>>>
>>>>
>>>> If I wanted to make projections with a given width and depth, I'd do the
>>>> following.
>>>>
>>>> L = 0.1  # projection width
>>>> d = 0.2  # projection depth
>>>> center = na.array([0.5]*3)
>>>> dim = 0
>>>>
>>>> left_edge = center - 0.5*L
>>>> right_edge = center + 0.5*L
>>>>
>>>> # For the projection dimension, use the depth
>>>> left_edge[dim] = center - 0.5*d
>>>> right_edge[dim] = center + 0.5*d
>>>>
>>>> pf = get_pf()
>>>> reg = pf.h.region(center, left_edge, right_edge)
>>>>
>>>> pc = PlotCollection(reg, center=center)
>>>> pc.add_projection("Density", 0, "Density")
>>>> pc.set_width(L, '1')
>>>> pc.save("test", override=True)
>>>>
>>>> Cheers,
>>>> John
>>>>
>>>> On 04/13/2010 10:21 AM, Luigi Iapichino wrote:
>>>>
>>>>>
>>>>> Dear all,
>>>>>
>>>>> by comparing volume renderings and projections in my simulation I
>>>>> realised
>>>>> that I don't have control on the projection depth, in the latter case.
>>>>> This is the relevant part of my script:
>>>>>
>>>>> ...
>>>>>
>>>>> L = 0.1 # projection width
>>>>>
>>>>> pf = load(data_dir+fn) # load data
>>>>>
>>>>> reg = pf.h.region([0.5, 0.5, 0.5],[0.45,0.45,0.45],[0.55,0.55,0.55]) #
>>>>> a
>>>>> small
>>>>> region
>>>>> #reg = pf.h.region([0.5, 0.5, 0.5],[0,0,0],[1,1,1]) # the whole box
>>>>>
>>>>> pc = PlotCollection(reg, center=[0.5,0.5,0.5])
>>>>>
>>>>> p = pc.add_projection("Density", 0,
>>>>> weight_field="Density",fig_size=(7.5,6))
>>>>>
>>>>> p.modify["contour"]("Density", ncont=5,take_log=True)
>>>>>
>>>>> pc.set_width(L, '1')
>>>>>
>>>>> pc.save("%s_test-proj" % pf,override=True)
>>>>>
>>>>>
>>>>> If I set L = 0.2, I don't see in the central region of the projection
>>>>> more
>>>>> structures than with L=0.1 (only the plot width is, of course, larger).
>>>>> Moreover, the result do not depend on the region that I select (either
>>>>> third
>>>>> or fourth line). It seems to me that, in all cases, the projection is
>>>>> actually performed along the whole simulation box, and not on the
>>>>> region
>>>>> that
>>>>> I select. In other words, I can control the plot width, but not the
>>>>> projection depth. In the volume rendering, on the other hand, the plot
>>>>> width
>>>>> sets the depth, too. Is anything wrong or missing in my script?
>>>>>
>>>>> If needed, I can send you a few explanatory plots and the whole sample
>>>>> script
>>>>> for reproducing my issue.
>>>>> Looking forward to your suggestions,
>>>>>
>>>>>   Luigi
>>>>>
>>>>>  _______________________________________________
>>>> 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/20100413/5028e714/attachment.html>


More information about the yt-users mailing list