[yt-users] yt-users Digest, Vol 57, Issue 7
Anna Rosen
rosen at ucolick.org
Tue Nov 13 17:18:20 PST 2012
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 at lists.spacepope.org wrote:
> Send yt-users mailing list submissions to
> yt-users at 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 at lists.spacepope.org
>
> You can reach the person managing the list at
> yt-users-owner at 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 at ucolick.org>
> To: yt-users at lists.spacepope.org
> Subject: [yt-users] Orion Derived Fields
> Message-ID: <64BC5460-361B-441A-A676-CE433376AF3B at 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 at ucolick.org
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 12 Nov 2012 18:30:14 -0800
> From: Andrew Myers <atmyers at berkeley.edu>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Orion Derived Fields
> Message-ID:
> <CAB7F9=PN4DL9NfHnj0gBaUBdBkewVGhx7+_g1o5ewwn7Mm+TXg at 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 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-0001.htm>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 13 Nov 2012 13:55:55 +0100
> From: Patrick Rieser <patrick.rieser at uibk.ac.at>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Strange Behaviour in ProjectionPlot
> Message-ID: <50A2435B.4080005 at uibk.ac.at>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> When I try
>
> pc.set_width((28,'mpccm'))
>
> it raises a key error:
>
>
> Traceback (most recent call last):
> File "projections.py", line 89, in <module>
> pc.set_width((28,'mpccm'))
> File
> "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
> line 81, in newfunc
> rv = f(*args, **kwargs)
> File
> "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
> line 458, in set_width
> width = [w / self.pf[unit] for w in width]
> File
> "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py",
> line 143, in __getitem__
> raise KeyError(key)
> KeyError: 'mpccm'
>
>
> Also when I search through the yt source code, "mpccm" is only found in
> universal_fields.py (in the WeakLensingConvergence field) and in
> light_ray.py.
>
> Best wishes,
> Patrick
>
>
> Am 12.11.2012 20:32, schrieb Britton Smith:
>> Patrick,
>>
>> Don't worry about it. I do that stuff all the time.
>>
>> Britton
>>
>>
>> On Mon, Nov 12, 2012 at 2:26 PM, Patrick Rieser
>> <patrick.rieser at uibk.ac.at <mailto:patrick.rieser at uibk.ac.at>> wrote:
>>
>> Ah damn, now I feel stupid. I should have realized that. I will
>> try it tomorrow, but yes, that should fix it!
>>
>> Thanks a lot!
>>
>> Best wishes,
>> Patrick
>>
>> Am 12.11.2012 19:38, schrieb Nathan Goldbaum:
>>
>> If Britton is correct (and looking closely at your script, I
>> suspect he is) you'll likely fix the issue by specifying the
>> width of the image in comoving units:
>>
>> pc.set_width((28,'mpccm'))
>>
>> Right now the plot axes will still choose to annotate the x
>> and y axes using physical units, even though the width of the
>> image will be the comoving width you requested. Sorry for
>> that bit of nonintuitiveness. Sam Skillman just filed a bug
>> about this issue which I will fix soon:
>> https://bitbucket.org/yt_analysis/yt/issue/463/plotwindow-axes-unit-defaults
>>
>> -Nathan
>>
>> On 11/12/12 10:25 AM, Britton Smith wrote:
>>
>> Hi Patrick,
>>
>> Is this a cosmology simulation? If so, I think the issue
>> is that the window is in physical coordinates, which are
>> increasing with time.
>>
>> Britton
>>
>>
>> On Mon, Nov 12, 2012 at 1:21 PM, Nathan Goldbaum
>> <nathan12343 at gmail.com <mailto:nathan12343 at gmail.com>
>> <mailto:nathan12343 at gmail.com
>> <mailto:nathan12343 at gmail.com>>> wrote:
>>
>> Hi Patrick,
>>
>> I'm unable to reproduce the issue you're seeing. I'm
>> running the
>> following script:
>>
>> from yt.mods import * # set up our namespace
>> from yt.analysis_modules.level_sets.api import *
>>
>> pf = load("galaxy0030/galaxy0030")
>>
>> master_clump = pf.h.load_object('My_Clumps')
>>
>> all_clumps = get_lowest_clumps(master_clump)
>>
>> for i in range(1,3):
>>
>> prj = ProjectionPlot(pf,2,'Density',center='c')
>>
>> prj.set_width((20,'kpc'))
>>
>> slc.annotate_text([0.0,1.05], "Clump %s" % i)
>>
>> slc.annotate_clumps([all_clumps[i]])
>>
>> slc.save(str(i))
>>
>> I've previously saved the clump objects in the file
>> "My_clumps".
>> I did this following Britton's recipe from the workshop:
>>
>> https://bitbucket.org/brittonsmith/yt.workshop2012.clump-finding/src/1e7af99cec95fb307bb79055f908d39a200b7091/scripts/find_clumps_and_save.py?at=default
>>
>> When I run the script, I get the following two images:
>>
>> http://i.imgur.com/MhkaQ.png
>> http://i.imgur.com/ZGzTl.png
>>
>> This script uses the IsolatedGalaxy dataset stored at
>> yt-project.org/data <http://yt-project.org/data>
>> <http://yt-project.org/data>
>>
>> It would help me track down what's going wrong if you
>> could come
>> up with a somewhat simpler script that reproduces the
>> error,
>> preferably using one of the datasets on yt-project.org
>> <http://yt-project.org>
>> <http://yt-project.org>. Please feel free to e-mail
>> me in private
>> or join us on irc so we can iterate on this.
>>
>> Cheers,
>>
>> Nathan
>>
>>
>> On 11/12/12 9:50 AM, Patrick Rieser wrote:
>>
>> Hey all,
>>
>> So I still get some strange behaviour with the
>> ProjectionPlot.
>> If I use the projection.set_width() with the
>> clumps callback
>> method I get the real image shrinked inside the
>> the plot
>> window. Strange thing is, that it grows with each
>> step! Here
>> is a demonstration how it looks (you have to look
>> closely as
>> it doesn't grow that much each step):
>>
>> http://www.flickr.com/photos/87912862@N05/sets/72157631990474435/
>>
>> If I don't use the set_width() then the image
>> itself looks
>> fine, but the scale on the axis grows with each
>> step. So it
>> seems to be the same error than with fixed width.
>>
>>
>> Best wishes,
>> Patrick
>>
>>
>>
>> Here is the code that I am using:
>>
>> # ID is just a list of tuples with clumps/their
>> position in an
>> array
>> # sim_files and clump_files is a list containing
>> the filenames
>> # get_myclump() simply returns a specific clump
>>
>> for j, series in enumerate(ID):
>> for i in series:
>> pf = load(sim_files[i[0]])
>> myclump = get_myclump(clump_files[i[0]], i[1])
>>
>> pc = ProjectionPlot(pf, axis, my_field,
>> center =
>> pf.domain_center, weight_field = my_wfield)
>> pc.set_width(28, "mpc")
>> pc.annotate_text([0.0,1.05], "Clump %s" % j)
>>
>> if redshift:
>> pc.annotate_text([0.917,1.05], "z =
>> %0.4f" %
>> pf.current_redshift)
>> if grid:
>> pc.annotate_grids()
>> if fix_scale:
>> pc.set_zlim(my_field,boundaries[0],boundaries[1])
>>
>> pc.set_cmap("Density", "idl01")
>> pc.annotate_clumps(myclump)
>>
>> pc.save('%s/Clump_%s_File_%s_Nr_%s_%s_Projection.png'
>> % (myBASEDIR, j, i[0], i[1], axis))
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> <mailto:yt-users at lists.spacepope.org>
>> <mailto:yt-users at lists.spacepope.org
>> <mailto:yt-users at lists.spacepope.org>>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> <mailto:yt-users at lists.spacepope.org>
>> <mailto:yt-users at lists.spacepope.org
>> <mailto:yt-users at lists.spacepope.org>>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> <mailto:yt-users at lists.spacepope.org>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.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/20121113/aee5a61c/attachment.htm>
>
> ------------------------------
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> End of yt-users Digest, Vol 57, Issue 7
> ***************************************
>
> !DSPAM:10193,50a243648133710432571!
>
Anna Rosen
Graduate Student
UCSC, Astronomy & Astrophysics
rosen at ucolick.org
More information about the yt-users
mailing list