[yt-users] Orion Derived Fields

Andrew Myers atmyers at berkeley.edu
Mon Nov 12 18:30:14 PST 2012


Hi Anna,

Check out this<https://bitbucket.org/atmyers/yt/changeset/53fa42c3dbc9c0228203900a1b1a169e732e9a8c>changeset,
which I think fixes the problem. I'm not 100% sure that I
understand the distinction between "fallback" and "known" fields, but I can
confirm that with those changes all the basic orion fields work.

-Andrew

On Mon, Nov 12, 2012 at 4:04 PM, Anna Rosen <rosen at ucolick.org> wrote:

> Hi all,
>
> I am unable to access the derived fields written for Orion such as
> temperature, pressure, etc.
> The definitions are these fields are located here:
> yt-x86_64/src/yt-hg/yt/frontends/orion/fields.py
>
> This is the error that I get if I try to access temperature:
>
> In [14]: mi,ma= dd.quantities["Extrema"]("Temperature")[0]
> ---------------------------------------------------------------------------
> KeyError                                  Traceback (most recent call last)
> <ipython-input-14-c8df716340ab> in <module>()
> ----> 1 mi,ma= dd.quantities["Extrema"]("Temperature")[0]
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc
> in __call__(self, *args, **kwargs)
>      90                           self._data_source.pf.h.io)
>      91         if lazy_reader and not self.force_unlazy:
> ---> 92             return self._call_func_lazy(args, kwargs)
>      93         else:
>      94             return self._call_func_unlazy(args, kwargs)
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc
> in _call_func_lazy(self, args, kwargs)
>      97         self.retvals = [ [] for i in range(self.n_ret)]
>      98         for gi,g in enumerate(self._get_grids()):
> ---> 99             rv = self.func(GridChildMaskWrapper(g,
> self._data_source), *args, **kwargs)
>     100             if not iterable(rv): rv = (rv,)
>     101             for i in range(self.n_ret):
> self.retvals[i].append(rv[i])
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc
> in _Extrema(data, fields, non_zero, filter)
>     586     mins, maxs = [], []
>     587     for field in fields:
> --> 588         if data[field].size < 1:
>     589             mins.append(1e90)
>     590             maxs.append(-1e90)
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc
> in __getitem__(self, item)
>      58     def __getitem__(self, item):
>      59         if item not in self.local_cache:
> ---> 60             data = self.data_source._get_data_from_grid(self.grid,
> item)
>      61             self.local_cache[item] = data
>      62         return self.local_cache[item]
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in
> save_state(self, grid, field, *args, **kwargs)
>      89         old_keys = grid.field_data.keys()
>      90         grid.field_parameters = self.field_parameters
> ---> 91         tr = func(self, grid, field, *args, **kwargs)
>      92         grid.field_parameters = old_params
>      93         grid.field_data = YTFieldData( [(k, grid.field_data[k])
> for k in old_keys] )
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in
> _get_data_from_grid(self, grid, field)
>    2555             return na.array([f[i,:][pointI] for i in range(3)])
>    2556         else:
> -> 2557             tr = grid[field]
>    2558             if tr.size == 1: # dx, dy, dz, cellvolume
>    2559                 tr = tr * na.ones(grid.ActiveDimensions,
> dtype='float64')
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in
> __getitem__(self, key)
>     155         """
>     156         if not self.field_data.has_key(key):
> --> 157             self.get_data(key)
>     158         return self.field_data[key]
>     159
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in
> get_data(self, field, convert)
>     198                     else: raise
>     199             else:
> --> 200                 self._generate_field(field)
>     201         return self.field_data[field]
>     202
>
> /home1/arosen2/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in
> _generate_field(self, field)
>     145                 self[field] = self.pf.field_info[field](self)
>     146         else: # Can't find the field, try as it might
> --> 147             raise exceptions.KeyError(field)
>     148
>     149     def has_key(self, key):
>
> KeyError: 'Temperature'
>
> Thanks!
>
> Anna Rosen
> Graduate Student
> UCSC, Astronomy & Astrophysics
> rosen at ucolick.org
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121112/a96b9506/attachment.htm>


More information about the yt-users mailing list