[yt-users] plot with source region and field parameters
david collins
dcollins4096 at gmail.com
Thu May 9 15:20:29 PDT 2013
Hi, Everybody--
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.
>>> region
AMRRegion (time0050): center=[ 0.5 0.03369141 0.68457031],
left_edge=[ 0. 0.00195312 0.63378906], right_edge=[ 1.
0.06542969 0.73535156]
def linewidth(field,data):
avg_vx = data.get_field_parameter('avg_vx')
return (data['x-velocity']-avg_vx)**2
add_field('linewidth',function=linewidth,
validators=[ValidateParameter('avg_vx')])
avg_vx = 7
region.set_field_parameter('avg_vx',avg_vx)
print region['linewidth'].min()
print region.get_field_parameter('avg_vx')
which yields expected output,
1.15751883639e-07
7
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.
Thanks!
>>> proj = oober.pf.h.proj(2,'linewidth',source=region)
Initializing tree 0 / 4100%
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Time: 00:00:00
Traceback (most recent call last):
| ETA: --:--:--
File "<stdin>", line 1, in <module>
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",
line 1758, in __init__
self._refresh_data()
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",
line 318, in _refresh_data
self.get_data()
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",
line 1859, in get_data
self._add_level_to_tree(tree, level, fields)
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
self._add_grid_to_tree(tree, grid, fields, zero_out, dls)
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
for fd in self._get_data_from_grid(grid, fields)]
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/data_containers.py",
line 93, in save_state
tr = func(self, grid, field, *args, **kwargs)
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
return [grid[field] * bad_points for field in fields]
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",
line 157, in __getitem__
self.get_data(key)
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",
line 200, in get_data
self._generate_field(field)
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/grid_patch.py",
line 132, in _generate_field
self.pf.field_info[field].check_available(self)
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py",
line 364, in check_available
validator(data)
File
"/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/data_objects/field_info_container.py",
line 440, in __call__
raise NeedsParameter(doesnt_have)
yt.data_objects.field_info_container.NeedsParameter: (['avg_vx'])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130509/946115fc/attachment.htm>
More information about the yt-users
mailing list