[yt-users] EPS Multiplot
John Wise
jwise at physics.gatech.edu
Tue Dec 3 11:36:13 PST 2013
Hi John,
I figured out the problem. When the multiplot routine is called, it
re-renders the image, using the pf weak reference inside of the
PlotWindow. However in the your script, the pf reference is overwritten
every loop. Here's a script that worked for me with two timesteps,
fnum = [20,21]
center = None
plots = []
pf = []
L = [0.5, 0.5, 1.0]
for f in fnum:
pf.append(load("DD%4.4d/output_%4.4d" % (f,f)))
if center == None:
value, center = pf[-1].h.find_max('Density')
p = OffAxisSlicePlot(pf[-1], L, "Density", center=center,
axes_unit='unitary', width=(5.0, 'kpc'),
fontsize=12)
plots.append(p)
mp = eps.multiplot_yt(1, 2, plots, bare_axes=False, margins=(1,1))
mp.save_fig('multi', format='eps')
Can anyone determine a better workaround than storing the parameter file
objects in some variable?
Cheers,
John
On 12/03/2013 11:23 AM, John Regan wrote:
> Hi John,
>
> OK I think I have it running now. I rebuilt YT and re pulled your PR and
> it looks like everything is good now.
> Unfortunately the code fails in the same way as before
>
> Traceback (most recent call last):
> File "OffAxisProjection_MultiPlot.py", line 63, in <module>
> mp = eps.multiplot_yt(1, 2, proj, bare_axes=False, margins=(0.75,0.75))
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py",
> line 1132, in multiplot_yt
> figure = multiplot(ncol, nrow, yt_plots=plots, fields=fields, **kwargs)
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py",
> line 980, in multiplot
> field=fields[index])
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py",
> line 453, in insert_image_yt
> plot.refresh()
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py",
> line 32, in newfunc
> args[0]._recreate_frb()
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
> line 266, in _recreate_frb
> periodic=self._periodic)
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/fixed_resolution.py",
> line 96, in __init__
> h.plots.append(weakref.proxy(self))
> ReferenceError: weakly-referenced object no longer exists
>
>
> The guts of my script is fairly simple:
>
>
> GetFileNames(FileNames)
> proj = []
> for i, fn in enumerate(FileNames):
> fn = Path + fn
> pf = load(fn) # load data
> sp = pf.h.sphere('max', (0.5,'pc'))
> L = sp.quantities["AngularMomentumVector"]()
> proj.append(OffAxisSlicePlot(pf, L, "Density", center="max",
> axes_unit='unitary', width=width,
> fontsize=12))
> proj[i].set_zlim('all', 1e-13, 1e-8)
>
> mp = eps.multiplot_yt(1, 2, proj, bare_axes=False, margins=(0.75,0.75))
> mp.save_fig('multi', format='eps')
>
> Rolling back the pull gets me back to the original error with
> multiplot_yt (so the changes are being brought in it seems):
>
> Traceback (most recent call last):
> File "OffAxisProjection_MultiPlot.py", line 63, in <module>
> mp = eps.multiplot_yt(1, 2, proj, bare_axes=False, margins=(0.75,0.75))
> File
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py",
> line 1043, in multiplot_yt
> if len(plot_col.plots) < nrow*ncol:
> AttributeError: 'list' object has no attribute 'plots'
>
> John
>
>
> On Tue, Dec 3, 2013 at 5:05 PM, John Regan <johnanthonyregan at gmail.com
> <mailto:johnanthonyregan at gmail.com>> wrote:
>
> No worries. I'll let you know if I figure it out. For some reason
> that module is missing from my version after the pull. I'm trying to
> figure out why now....
>
>
> On Tue, Dec 3, 2013 at 5:02 PM, John Wise <jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>> wrote:
>
> Hi John,
>
> Hmmm, that's odd. I'm currently in meetings until mid-afternoon, so
> I'll look at this problem then.
>
> Cheers,
> John
>
> On Tue, 03 Dec 2013 at 16:26 +0200, John Regan wrote:
> > Hi John,
> >
> > I'm getting a problem with the profile_plotter.py file.
> >
> > Traceback (most recent call last):
> > � File "OffAxisProjection_MultiPlot.py", line 12, in <module>
> > ��� import yt.visualization.eps_writer as eps
> > � File
> >
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py",
> > line 31, in <module>
> > ��� from .profile_plotter import PhasePlot
> > � File
> >
> "/homeappl/home/regan/appl_taito/YT/Dev/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py",
> > line 31, in <module>
> > ��� from .plot_container import \
> > ImportError: No module named plot_container
> >
> > John
> >
> > On Tue, Dec 3, 2013 at 4:09 PM, John Wise
> <[1]jwise at physics.gatech.edu <mailto:jwise at physics.gatech.edu>>
> > wrote:
> >
> > Hi John,
> >
> > Not a stupid question at all.
> >
> > You can get my changes by doing
> >
> > hg pull -r e7aebae [2]https://bitbucket.org/jwise77/yt
> >
> > Cheers,
> > John
> >
> > On 12/03/2013 08:28 AM, John Regan wrote:
> >
> > Hi John,
> >
> > Stupid question now - but how do I get my hands on
> that PR?
> > Is there a link somewhere where I can pull from?
> >
> > John
> >
> > On Tue, Dec 3, 2013 at 3:10 PM, John Regan
> > <[3]johnanthonyregan at gmail.com
> <mailto:johnanthonyregan at gmail.com>
> > <mailto:[4]johnanthonyregan at gmail.com
> <mailto:johnanthonyregan at gmail.com>>> wrote:
> >
> > � � Excellent - I'll pull the changeset and let you know!
> >
> > � � On Tue, Dec 3, 2013 at 3:06 PM, John Wise
> > <[5]jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > � � <mailto:[6]jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>>> wrote:
> >
> > � � � � Hi,
> >
> > � � � � It's funny that you emailed right now because
> I was just
> > putting
> > � � � � the final touches on my changes this morning!
> �I've just
> > � � � � submitted a pull request
> >
> > � � � �
> [7]https://bitbucket.org/yt___analysis/yt/pull-request/661/
> > � � � �
> <[8]https://bitbucket.org/yt_analysis/yt/pull-request/661/>
> >
> > � � � � which has an example in the description. �If
> you could test it
> > � � � � out, that would be great!
> >
> > � � � � Cheers,
> > � � � � John
> >
> > � � � � On 12/03/2013 07:48 AM, John Regan wrote:
> >
> > � � � � � � Hi John,
> >
> > � � � � � � Cool. Sounds good.
> >
> > � � � � � � Let me know if there is anything I can
> help with.
> >
> > � � � � � � Cheers,
> > � � � � � � John
> >
> > � � � � � � On Tue, Dec 3, 2013 at 2:44 PM, John Wise
> > � � � � � � <[9]jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > <mailto:[10]jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>>
> > � � � � � � <mailto:[11]jwise at physics.gatech.__edu
> > � � � � � � <mailto:[12]jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>>>> wrote:
> >
> > � � � � � � � � �Hi John,
> >
> > � � � � � � � � �Last week, I discovered that I didn't
> extend the
> > � � � � � � capabilities of
> > � � � � � � � � �eps_writer's multiplot to handle
> PlotWindows. �I'm
> > � � � � � � working on this
> > � � � � � � � � �right now, and hopefully I'll have
> something soon.
> >
> > � � � � � � � � �Cheers,
> > � � � � � � � � �JOhn
> >
> > � � � � � � � � �On 12/03/2013 07:43 AM, John Regan wrote:
> >
> > � � � � � � � � � � �Hi All,
> >
> > � � � � � � � � � � �Not sure whether this is
> currently possible but
> > I'd
> > � � � � � � like to create a
> > � � � � � � � � � � �multiplot eps figure containing a
> selection of
> > � � � � � � projections.
> >
> > � � � � � � � � � � �I first of all create my list of
> > � � � � � � OffAxisProjectionPlots (proj)
> > � � � � � � � � � � �and then
> > � � � � � � � � � � �call
> >
> > � � � � � � � � � � �ep = eps.multiplot(1, 2, proj,
> bare_axes=True).
> >
> > � � � � � � � � � � �where proj is a list of
> plot_window objects.
> >
> > � � � � � � � � � � �I'm using the YT dev branch and
> it's falling over
> > � � � � � � with the error:
> >
> > � � � � � � � � � � �Traceback (most recent call last):
> > � � � � � � � � � � � � �File
> "OffAxisProjection_MultiPlot.____py",
> > line
> > � � � � � � 64, in <module>
> >
> > � � � � � � � � � � � � � �ep = eps.multiplot(1, 2, proj,
> > bare_axes=True)
> > � � � � � � � � � � � � �File
> >
> > � � � � � �
> >
> "/homeappl/home/regan/appl_____taito/YT/Dev/yt-x86_64/src/yt-____hg/yt/visualization/eps_____writer.py",
> > � � � � � � � � � � �line 934, in multiplot
> > � � � � � � � � � � � � �
> �d.insert_image_yt(yt_plots[____index],
> > � � � � � � pos=(xpos, ypos))
> > � � � � � � � � � � � � �File
> >
> > � � � � � �
> >
> "/homeappl/home/regan/appl_____taito/YT/Dev/yt-x86_64/src/yt-____hg/yt/visualization/eps_____writer.py",
> >
> > � � � � � � � � � � �line 424, in insert_image_yt
> > � � � � � � � � � � � � � �plot.refresh()
> > � � � � � � � � � � � � �File
> >
> > � � � � � �
> >
> "/homeappl/home/regan/appl_____taito/YT/Dev/yt-x86_64/src/yt-____hg/yt/visualization/plot_____container.py",
> >
> > � � � � � � � � � � �line 32, in newfunc
> > � � � � � � � � � � � � � �args[0]._recreate_frb()
> > � � � � � � � � � � � � �File
> >
> > � � � � � �
> >
> "/homeappl/home/regan/appl_____taito/YT/Dev/yt-x86_64/src/yt-____hg/yt/visualization/plot_____window.py",
> >
> > � � � � � � � � � � �line 266, in _recreate_frb
> > � � � � � � � � � � � � � �periodic=self._periodic)
> > � � � � � � � � � � � � �File
> >
> > � � � � � �
> >
> "/homeappl/home/regan/appl_____taito/YT/Dev/yt-x86_64/src/yt-____hg/yt/visualization/fixed_____resolution.py",
> > � � � � � � � � � � �line 96, in __init__
> > � � � � � � � � � � � � �
> �h.plots.append(weakref.proxy(____self))
> >
> > � � � � � � � � � � �ReferenceError: weakly-referenced
> object no
> > longer
> > � � � � � � exists
> >
> > � � � � � � � � � � �If anyone knows what's happening
> let me know.
> >
> > � � � � � � � � � � �Thanks in advance!
> >
> > � � � � � � � � � � �John
> >
> > � � � � � � � � � �
> > �___________________________________________________
> > � � � � � � � � � � �yt-users mailing list
> > � � � � � � [13]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > � � � � � � <mailto:[14]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>
> > � � � � � �
> <mailto:[15]yt-users at lists.__[16]spacepope.org
> <http://spacepope.org>
> > � � � � � � <mailto:[17]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>>
> > � � � � � �
> >
> [18]http://lists.spacepope.org/____listinfo.cgi/yt-users-____spacepope.org
> > � � � � � �
> >
> <[19]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org>
> >
> > � � � � � �
> >
> <[20]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > � � � � � �
> >
> <[21]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>>
> >
> > � � � � � � � � �--
> > � � � � � � � � �John Wise
> > � � � � � � � � �Assistant Professor of Physics
> > � � � � � � � � �Center for Relativistic Astrophysics,
> Georgia Tech
> > � � � � � � [22]http://cosmo.gatech.edu
> > � � � � � � � �
> �___________________________________________________
> > � � � � � � � � �yt-users mailing list
> > � � � � � � [23]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > � � � � � � <mailto:[24]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>
> > � � � � � �
> <mailto:[25]yt-users at lists.__[26]spacepope.org
> <http://spacepope.org>
> > � � � � � � <mailto:[27]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>>
> > � � � � � �
> >
> [28]http://lists.spacepope.org/____listinfo.cgi/yt-users-____spacepope.org
> > � � � � � �
> >
> <[29]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org>
> >
> > � � � � � �
> >
> <[30]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > � � � � � �
> >
> <[31]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>>
> >
> > � � � � � �
> _________________________________________________
> > � � � � � � yt-users mailing list
> > � � � � � � [32]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > � � � � � � <mailto:[33]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>
> > � � � � � �
> >
> [34]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > � � � � � �
> >
> <[35]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> >
> > � � � � --
> > � � � � John Wise
> > � � � � Assistant Professor of Physics
> > � � � � Center for Relativistic Astrophysics, Georgia Tech
> > � � � � [36]http://cosmo.gatech.edu
> > � � � � _________________________________________________
> > � � � � yt-users mailing list
> > � � � � [37]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > <mailto:[38]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>>
> > � � � �
> >
> [39]http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > � � � �
> >
> <[40]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> >
> > _______________________________________________
> > yt-users mailing list
> > [41]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> >
> [42]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> > --
> > John Wise
> > Assistant Professor of Physics
> > Center for Relativistic Astrophysics, Georgia Tech
> > [43]http://cosmo.gatech.edu
> > _______________________________________________
> > yt-users mailing list
> > [44]yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> >
> [45]http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> > References
> >
> > Visible links
> > 1. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 2. https://bitbucket.org/jwise77/yt
> > 3. mailto:johnanthonyregan at gmail.com
> <mailto:johnanthonyregan at gmail.com>
> > 4. mailto:johnanthonyregan at gmail.com
> <mailto:johnanthonyregan at gmail.com>
> > 5. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 6. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 7. https://bitbucket.org/yt___analysis/yt/pull-request/661/
> > 8. https://bitbucket.org/yt_analysis/yt/pull-request/661/
> > 9. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 10. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 11. mailto:jwise at physics.gatech <mailto:jwise at physics.gatech>
> > 12. mailto:jwise at physics.gatech.edu
> <mailto:jwise at physics.gatech.edu>
> > 13. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 14. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 15. mailto:yt-users at lists <mailto:yt-users at lists>
> > 16. http://spacepope.org/
> > 17. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 18.
> http://lists.spacepope.org/____listinfo.cgi/yt-users-____spacepope.org
> > 19.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 20.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 21.
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> > 22. http://cosmo.gatech.edu/
> > 23. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 24. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 25. mailto:yt-users at lists <mailto:yt-users at lists>
> > 26. http://spacepope.org/
> > 27. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 28.
> http://lists.spacepope.org/____listinfo.cgi/yt-users-____spacepope.org
> > 29.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 30.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 31.
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> > 32. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 33. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 34.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 35.
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> > 36. http://cosmo.gatech.edu/
> > 37. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 38. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 39.
> http://lists.spacepope.org/__listinfo.cgi/yt-users-__spacepope.org
> > 40.
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> > 41. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 42.
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> > 43. http://cosmo.gatech.edu/
> > 44. mailto:yt-users at lists.spacepope.org
> <mailto:yt-users at lists.spacepope.org>
> > 45.
> 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
>
>
> --
> John Wise
> Assistant Professor of Physics
> Center for Relativistic Astrophysics, Georgia Tech
> _______________________________________________
> 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
>
--
John Wise
Assistant Professor of Physics
Center for Relativistic Astrophysics, Georgia Tech
http://cosmo.gatech.edu
More information about the yt-users
mailing list