Thanks, Andrew! It works now, I altered my yt-x86_64/src/yt-hg/yt/frontends/orion/fields.py to match yours. Changing add_orion_field to add_field corrects the problem. I'm not quite sure why though. On Nov 13, 2012, at 5:04 AM, yt-users-request@lists.spacepope.org wrote:
Send yt-users mailing list submissions to yt-users@lists.spacepope.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org or, via email, send a message with subject or body 'help' to yt-users-request@lists.spacepope.org
You can reach the person managing the list at yt-users-owner@lists.spacepope.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of yt-users digest..."
Today's Topics:
1. Orion Derived Fields (Anna Rosen) 2. Re: Orion Derived Fields (Andrew Myers) 3. Re: Strange Behaviour in ProjectionPlot (Patrick Rieser)
----------------------------------------------------------------------
Message: 1 Date: Mon, 12 Nov 2012 16:04:00 -0800 From: Anna Rosen <rosen@ucolick.org> To: yt-users@lists.spacepope.org Subject: [yt-users] Orion Derived Fields Message-ID: <64BC5460-361B-441A-A676-CE433376AF3B@ucolick.org> Content-Type: text/plain; charset=us-ascii
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@ucolick.org
------------------------------
Message: 2 Date: Mon, 12 Nov 2012 18:30:14 -0800 From: Andrew Myers <atmyers@berkeley.edu> To: Discussion of the yt analysis package <yt-users@lists.spacepope.org> Subject: Re: [yt-users] Orion Derived Fields Message-ID: <CAB7F9=PN4DL9NfHnj0gBaUBdBkewVGhx7+_g1o5ewwn7Mm+TXg@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1"
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@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@ucolick.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org