<div dir="ltr">Hi, Everybody--<div><br></div><div>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.</div><div><br></div><div>
<div>>>> region</div><div>AMRRegion (time0050): center=[ 0.5 0.03369141 0.68457031], left_edge=[ 0. 0.00195312 0.63378906], right_edge=[ 1. 0.06542969 0.73535156]</div><div><br></div>
</div><div><div>def linewidth(field,data):</div><div> avg_vx = data.get_field_parameter('avg_vx')</div><div> return (data['x-velocity']-avg_vx)**2</div><div>add_field('linewidth',function=linewidth, validators=[ValidateParameter('avg_vx')])</div>
<div>avg_vx = 7</div><div>region.set_field_parameter('avg_vx',avg_vx)</div><div>print region['linewidth'].min()</div><div>print region.get_field_parameter('avg_vx')</div><div><br></div><div>which yields expected output,</div>
<div><div>1.15751883639e-07</div><div>7</div><div><br></div><div>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.</div>
<div><br></div><div>Thanks!</div><div><br></div></div><div>>>> proj = oober.pf.h.proj(2,'linewidth',source=region)<br></div></div><div><div>Initializing tree 0 / 4100% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 00:00:00 </div>
<div>Traceback (most recent call last): | ETA: --:--:-- </div><div> File "<stdin>", line 1, in <module></div>
<div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1758, in __init__</div><div> self._refresh_data()</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 318, in _refresh_data</div>
<div> self.get_data()</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 1859, in get_data</div><div> self._add_level_to_tree(tree, level, fields)</div>
<div> 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</div><div> self._add_grid_to_tree(tree, grid, fields, zero_out, dls)</div><div>
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</div><div> for fd in self._get_data_from_grid(grid, fields)]</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py", line 93, in save_state</div>
<div> tr = func(self, grid, field, *args, **kwargs)</div><div> 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</div><div> return [grid[field] * bad_points for field in fields]</div>
<div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__</div><div> self.get_data(key)</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data</div>
<div> self._generate_field(field)</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py", line 132, in _generate_field</div><div> self.pf.field_info[field].check_available(self)</div>
<div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py", line 364, in check_available</div><div> validator(data)</div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py", line 440, in __call__</div>
<div> raise NeedsParameter(doesnt_have)</div><div>yt.data_objects.field_info_container.NeedsParameter: (['avg_vx'])</div><div><br></div></div><div><br></div><div></div></div>