[yt-users] fixed resolution projections

Matthew Turk matthewturk at gmail.com
Tue Dec 7 19:16:44 PST 2010


Hi Britton,

This was two bugs in one.  I have pushed a fix for both.

The first bug was an import bug: the FillBuffer issue was just a
missing import, which I have fixed.  This fixes both issues you've
reported.

The second was how the FillBuffer routine worked, which I noticed upon
testing the results.  The procedure is to deposit grid values inside a
buffer, summing them up and ultimately multiplying by dx to get the
projection we all know and love.  I ran some tests and saw that the
fixed res projection was, simply, incorrect -- the images output
looked terrible and were obviously wrong.  I looked further, and what
seemed to be happening was that the child mask for all grids was being
passed in, and used as a criteria for deposition.

What this meant was that if you were taking the projection at level 1,
it would only deposit those grid cells from levels 0 and 1 that had no
child cells.  So you'd just see gigantic chunks taken out where there
were regions of greater refinement.  (Cells from level > 1 would not
contribute.)

I have modified it, so that now rather than just checking if the child
mask is 1 (i.e., no further cells are available) the FillBuffer
routine checks if *either* child mask is 1 *or* the refinement ratio
between the image buffer and the currently examine grid is 1.  (i.e.,
this is the finest grid that we will be considering.)  If either is
true, it deposits values.

Now I'm getting images that look roughly reasonable.

I've pushed these changes (along with an unrelated FLASH units change)
to the repository in hash e6bd204c661f.  To update, run:

yt instinfo -u

Let me know if there are any other issues.

-Matt

On Tue, Dec 7, 2010 at 6:26 PM, Britton Smith <brittonsmith at gmail.com> wrote:
> Hi all,
>
> I'm having some problems with AMRFixedResProjectionBase.
>
> I was at first getting this error:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/Users/britton/Documents/work/yt/yt/yt/data_objects/data_containers.py",
> line 339, in __repr__
>     for i in self._con_args])
> AttributeError: 'AMRFixedResProjection' object has no attribute
> 'weight_field'
>
> So I added a weight_field kwarg to the __init__ function and a
> self.weight_field attribute.  That took care of the first error, but now if
> I do
>
> proj = pf.h.fixed_res_proj(0, 0, na.array([0,0,0]), 32, fields=['Density'])
> proj['Density']
>
> I get this:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/Users/britton/Documents/work/yt/yt/yt/data_objects/data_containers.py",
> line 276, in __getitem__
>     self.get_data(key)
>   File
> "/Users/britton/Documents/work/yt/yt/yt/data_objects/data_containers.py",
> line 1816, in get_data
>     self._get_data_from_grid(grid, fields_to_get, dls)
>   File
> "/Users/britton/Documents/work/yt/yt/yt/data_objects/data_containers.py",
> line 1836, in _get_data_from_grid
>     FillBuffer(ref_ratio,
> NameError: global name 'FillBuffer' is not defined
>
> If instead I do this:
> proj.data['Density']
> I simply get an array full of zeros.
>
> Does anyone have any advice or examples on using fixed resolution
> projections?
>
> Thanks,
> Britton
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>



More information about the yt-users mailing list