<div dir="ltr"><div>That seems to work for now, thanks!<br><br></div>I'll file a bug report on this.<br><br>Thanks a ton!<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 9, 2013 at 4:36 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Dave,<br>
<br>
Have you tried passing the field_parameters in as a kwargs dict? Something like this:<br>
<br>
field_parameters = {'avg_vx',7}<br>
proj = oober.pf.h.proj(2,'linewidth',source=region, **field_parameters)<br>
<br>
Although as Matt notes, ideally it should be possible to avoid the kwargs construction.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Nathan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On May 9, 2013, at 3:20 PM, david collins <<a href="mailto:dcollins4096@gmail.com">dcollins4096@gmail.com</a>> wrote:<br>
<br>
> Hi, Everybody--<br>
><br>
> I have a field that I have defined that uses a field_parameter, but I don't 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], left_edge=[ 0. 0.00195312 0.63378906], right_edge=[ 1. 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, 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 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% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 00:00:00<br>
> Traceback (most recent call last): | ETA: --:--:--<br>
> File "<stdin>", line 1, in <module><br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1758, in __init__<br>
> self._refresh_data()<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 318, in _refresh_data<br>
> self.get_data()<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1859, in get_data<br>
> self._add_level_to_tree(tree, level, fields)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1981, in _add_level_to_tree<br>
> self._add_grid_to_tree(tree, grid, fields, zero_out, dls)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1925, in _add_grid_to_tree<br>
> for fd in self._get_data_from_grid(grid, fields)]<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 93, in save_state<br>
> tr = func(self, grid, field, *args, **kwargs)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 2003, in _get_data_from_grid<br>
> return [grid[field] * bad_points for field in fields]<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__<br>
> self.get_data(key)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data<br>
> self._generate_field(field)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 132, in _generate_field<br>
> self.pf.field_info[field].check_available(self)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py", line 364, in check_available<br>
> validator(data)<br>
> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py", line 440, in __call__<br>
> raise NeedsParameter(doesnt_have)<br>
> yt.data_objects.field_info_container.NeedsParameter: (['avg_vx'])<br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<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>
</div></div></blockquote></div><br></div>