[yt-users] Strange Behaviour in ProjectionPlot

Patrick Rieser patrick.rieser at uibk.ac.at
Tue Nov 13 04:55:55 PST 2012


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>


More information about the yt-users mailing list