[yt-users] pc.save with old Enzo

Matthew Turk matthewturk at gmail.com
Thu Sep 22 04:10:31 PDT 2011


To get it to work with .grid.cpu*, put this at the top of your script:

import yt.frontends.enzo.api
yt.frontends.enzo.api.EnzoHierarchy._bn = "%s.grid.cpu%%04i"

The error thrown by quiver looks like an out-of-date matplotlib
installation.  Sam, Jeff and JC have been improving the quiver plots,
one aspect of which is adding the ability to scale the arrows to a
given length.  That uses the scale_units parameter to quiver, which is
definitely part of matplotlib 1.0.0 (the version that ships with the
current yt, and has done so for quite a while).  They may be able to
provide more insight, but upgrading matplotlib or re-running the
install script should fix it.

-Matt

On Thu, Sep 22, 2011 at 6:34 AM, Elizabeth Tasker <taskere at mcmaster.ca> wrote:
> Sorry -- correction: this problem also occurs with a new data set from Enzo 2.0. It doesn't happen, however, with the older version of yt.
>
> The version it fails on is 9cb628620da6 (yt). Unfortunately, the version it works on gives an error linked with finding the mercurial libraries when I run yt instinfo, so I'm not sure which version it is.
>
> Elizabeth
>
>
>
>
>
> On Sep 22, 2011, at 6:50 PM, Elizabeth Tasker wrote:
>
>> Hi,
>>
>> I'm trying to analyse an older Enzo simulation which writes its output in hdf5 but with files that look like:
>>
>> GT_RotFrame_128AMR8_stars_0200.grid.cpu0029
>>
>> the script runs fine until it reaches pc.save(fn), then I get:
>>
>> AttributeError                            Traceback (most recent call last)
>>
>> /home/taskere/yt/src/yt-hg/scripts/iyt in <module>()
>> ----> 1
>>      2
>>      3
>>      4
>>      5
>>
>> /home/taskere/yt/src/yt-hg/scripts/iyt in <module>()
>>     55
>>     56
>> ---> 57 pc.save(fn)
>>     58
>>     59
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save)
>>    155         for plot in self.plots:
>>    156             fn.append(plot.save_image(basename, format=format,
>> --> 157                       override=override, force_save=force_save))
>>    158             mylog.info("Saved %s", fn[-1])
>>    159         if ytcfg.getboolean("yt", "__withinreason"):
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas)
>>    106         prefix.
>>    107         """
>> --> 108         self._redraw_image()
>>    109         if not override:
>>    110             self._generate_prefix(prefix)
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args)
>>    399             self.norm.autoscale(na.array((newmin,newmax), dtype='float64'))
>>    400         self._reset_image_parameters()
>> --> 401         self._run_callbacks()
>>    402
>>    403     def _reset_image_parameters(self):
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self)
>>    256         self._axes.texts = []
>>    257         for cb in self._callbacks:
>> --> 258             cb(self)
>>    259
>>    260     def set_label(self, label):
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot)
>>     83             yv = "%s-velocity" % (y_names[plot.data.axis])
>>     84             qcb = QuiverCallback(xv, yv, self.factor, scale=self.scale, scale_units=self.scale_units)
>> ---> 85         return qcb(plot)
>>     86
>>     87 class MagFieldCallback(PlotCallback):
>>
>> /home/taskere/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot)
>>    148         X = na.mgrid[0:plot.image._A.shape[0]-1:nx*1j]# + 0.5*factor
>>    149         Y = na.mgrid[0:plot.image._A.shape[1]-1:ny*1j]# + 0.5*factor
>> --> 150         plot._axes.quiver(X,Y, pixX, pixY, scale=self.scale, scale_units=self.scale_units)
>>    151         plot._axes.set_xlim(xx0,xx1)
>>    152         plot._axes.set_ylim(yy0,yy1)
>>
>> /home/taskere/yt/lib/python2.6/site-packages/matplotlib/axes.pyc in quiver(self, *args, **kw)
>>   5873     def quiver(self, *args, **kw):
>>   5874         if not self._hold: self.cla()
>> -> 5875         q = mquiver.Quiver(self, *args, **kw)
>>   5876         self.add_collection(q, False)
>>   5877         self.update_datalim(q.XY)
>>
>> /home/taskere/yt/lib/python2.6/site-packages/matplotlib/quiver.pyc in __init__(self, ax, *args, **kw)
>>    392                                             transOffset=ax.transData,
>>    393                                             closed=False,
>> --> 394                                             **kw)
>>    395         self.polykw = kw
>>    396         self.set_UVC(U, V, C)
>>
>> /home/taskere/yt/lib/python2.6/site-packages/matplotlib/collections.pyc in __init__(self, verts, sizes, closed, **kwargs)
>>    664         %(Collection)s
>>    665         """
>> --> 666         Collection.__init__(self,**kwargs)
>>    667         self._sizes = sizes
>>    668         self.set_verts(verts, closed)
>>
>> /home/taskere/yt/lib/python2.6/site-packages/matplotlib/collections.pyc in __init__(self, edgecolors, facecolors, linewidths, linestyles, antialiaseds, offsets, transOffset, norm, cmap, pickradius, urls, **kwargs)
>>    106
>>    107         self._pickradius = pickradius
>> --> 108         self.update(kwargs)
>>    109
>>    110
>>
>> /home/taskere/yt/lib/python2.6/site-packages/matplotlib/artist.pyc in update(self, props)
>>    624             func = getattr(self, 'set_'+k, None)
>>    625             if func is None or not callable(func):
>> --> 626                 raise AttributeError('Unknown property %s'%k)
>>    627             func(v)
>>    628             changed = True
>>
>> AttributeError: Unknown property scale_units
>>
>>
>>
>>
>>
>> Is there an easy fix for this? If it helps, an example data set is at:
>>
>> http://www.physics.mcmaster.ca/~taskere/GT_RotFrame_128AMR8_stars_0200.tar.gz
>>
>> (about 650 Mb) and the yt script:
>>
>> http://paste.yt-project.org/show/1816/
>>
>> Elizabeth
>> _______________________________________________
>> yt-users mailing list
>> 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
>



More information about the yt-users mailing list