<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you do the projection of the region, it correctly gets the region right?<br>
<br></blockquote><div><br></div><div>pf.h.proj(2,'Density',source=region)<br></div><div><br></div><div>does the correct thing for that region, if that's what you mean.<br><br>d.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If so, file a bug, assign it to me, and I will correct it when I can<br>
get back to the computer. I think I know what's going on -- I suspect<br>
during the _get_data_from_grid call (or whatever it is in the<br>
quadtree) it's not passing field parameters through. As a backup for<br>
the moment you might be able to use overlap_proj, but this is 100% a<br>
bug and needs to be fixed, so file a bug assigned to me and I'll get<br>
at it asap.<br>
<br>
-Matt<br>
<div><div class="h5"><br>
On Thu, May 9, 2013 at 6:20 PM, david collins <<a href="mailto:dcollins4096@gmail.com">dcollins4096@gmail.com</a>> wrote:<br>
> Hi, Everybody--<br>
><br>
> I have a field that I have defined that uses a field_parameter, but I don't<br>
> seem to be able to get it to work with a projection.<br>
><br>
>>>> region<br>
> AMRRegion (time0050): center=[ 0.5 0.03369141 0.68457031],<br>
> left_edge=[ 0. 0.00195312 0.63378906], right_edge=[ 1.<br>
> 0.06542969 0.73535156]<br>
><br>
> def linewidth(field,data):<br>
> avg_vx = data.get_field_parameter('avg_vx')<br>
> return (data['x-velocity']-avg_vx)**2<br>
> add_field('linewidth',function=linewidth,<br>
> validators=[ValidateParameter('avg_vx')])<br>
> avg_vx = 7<br>
> region.set_field_parameter('avg_vx',avg_vx)<br>
> print region['linewidth'].min()<br>
> print region.get_field_parameter('avg_vx')<br>
><br>
> which yields expected output,<br>
> 1.15751883639e-07<br>
> 7<br>
><br>
> But trying to make a projection of that source gives the error below. Is it<br>
> obvious what I'm doing wrong? I can plot 'Density' just fine.<br>
><br>
> Thanks!<br>
><br>
>>>> proj = oober.pf.h.proj(2,'linewidth',source=region)<br>
> Initializing tree 0 / 4100%<br>
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||<br>
> Time: 00:00:00<br>
> Traceback (most recent call last):<br>
> | ETA: --:--:--<br>
> File "<stdin>", line 1, in <module><br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 1758, in __init__<br>
> self._refresh_data()<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 318, in _refresh_data<br>
> self.get_data()<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 1859, in get_data<br>
> self._add_level_to_tree(tree, level, fields)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 1981, in _add_level_to_tree<br>
> self._add_grid_to_tree(tree, grid, fields, zero_out, dls)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 1925, in _add_grid_to_tree<br>
> for fd in self._get_data_from_grid(grid, fields)]<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 93, in save_state<br>
> tr = func(self, grid, field, *args, **kwargs)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",<br>
> line 2003, in _get_data_from_grid<br>
> return [grid[field] * bad_points for field in fields]<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",<br>
> line 157, in __getitem__<br>
> self.get_data(key)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",<br>
> line 200, in get_data<br>
> self._generate_field(field)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",<br>
> line 132, in _generate_field<br>
> self.pf.field_info[field].check_available(self)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py",<br>
> line 364, in check_available<br>
> validator(data)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py",<br>
> line 440, in __call__<br>
> raise NeedsParameter(doesnt_have)<br>
> yt.data_objects.field_info_container.NeedsParameter: (['avg_vx'])<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br></div></div>