[yt-users] saving a plot from a plotcollection object

mohammad safarzadeh mtsafarzadeh at gmail.com
Sun Jul 7 15:23:30 PDT 2013


Hi,
When I want to save a plot collection object. I get this error and I would
like to know how to resolve this.
In [3]: pc=pc=PlotCollection(pf,[ 0.5808,0.5398, 0.4504 ])
yt : [INFO     ] 2013-07-07 18:02:49,267 Created plot collection with
default plot-center = [0.58079999999999998, 0.53979999999999995,
0.45040000000000002]

In [4]: pc.add_thin_projection("particle_density",0,0.1)
yt : [INFO     ] 2013-07-07 18:03:19,026 Getting the binary hierarchy
yt : [INFO     ] 2013-07-07 18:03:19,032 Finished with binary hierarchy
reading
yt : [INFO     ] 2013-07-07 18:03:38,125 Projection completed
Out[4]: <yt.visualization.plot_types.PCProjectionPlot at 0x3876550>
In [20]: pc.save()
---------------------------------------------------------------------------
ParseFatalException                       Traceback (most recent call last)
<ipython-input-20-aabd56408a20> in <module>()
----> 1 pc.save()

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.pyc
in save(self, basename, format, override, force_save)
    181         for plot in self.plots:
    182             fn.append(plot.save_image(basename, format=format,
--> 183                       override=override, force_save=force_save))
    184             mylog.info("Saved %s", fn[-1])
    185         if ytcfg.getboolean("yt", "__withinreason"):

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/visualization/plot_types.pyc in
save_image(self, prefix, format, override, force_save, figure_canvas)
    120             canvas.print_figure(fn)
    121         else:
--> 122             only_on_root(canvas.print_figure, fn)
    123         self["Type"] = self._type_name
    124         self["GeneratedAt"] = self.data.pf.unique_identifier

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/funcs.pyc in only_on_root(func,
*args, **kwargs)
    366         cfg_option = "__topcomm_parallel_rank"
    367     if not ytcfg.getboolean("yt","__parallel"):
--> 368         return func(*args,**kwargs)
    369     if ytcfg.getint("yt", cfg_option) > 0: return
    370     return func(*args, **kwargs)

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/backend_bases.pyc
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
   2015                 orientation=orientation,
   2016                 bbox_inches_restore=_bbox_inches_restore,
-> 2017                 **kwargs)
   2018         finally:
   2019             if bbox_inches and restore_bbox:

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc
in print_png(self, filename_or_obj, *args, **kwargs)
    443
    444     def print_png(self, filename_or_obj, *args, **kwargs):
--> 445         FigureCanvasAgg.draw(self)
    446         renderer = self.get_renderer()
    447         original_dpi = renderer.dpi

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc
in draw(self)
    399
    400         self.renderer = self.get_renderer()
--> 401         self.figure.draw(self.renderer)
    402
    403     def get_renderer(self):

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/artist.pyc
in draw_wrapper(artist, renderer, *args, **kwargs)
     53     def draw_wrapper(artist, renderer, *args, **kwargs):
     54         before(artist, renderer)
---> 55         draw(artist, renderer, *args, **kwargs)
     56         after(artist, renderer)
     57

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/figure.pyc
in draw(self, renderer)
    882         dsu.sort(key=itemgetter(0))
    883         for zorder, func, args in dsu:
--> 884             func(*args)
    885
    886         renderer.close_group('figure')

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/artist.pyc
in draw_wrapper(artist, renderer, *args, **kwargs)
     53     def draw_wrapper(artist, renderer, *args, **kwargs):
     54         before(artist, renderer)
---> 55         draw(artist, renderer, *args, **kwargs)
     56         after(artist, renderer)
     57

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/axes.pyc
in draw(self, renderer, inframe)
   1981
   1982         for zorder, a in dsu:
-> 1983             a.draw(renderer)
   1984
   1985         renderer.close_group('axes')

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/artist.pyc
in draw_wrapper(artist, renderer, *args, **kwargs)
     53     def draw_wrapper(artist, renderer, *args, **kwargs):
     54         before(artist, renderer)
---> 55         draw(artist, renderer, *args, **kwargs)
     56         after(artist, renderer)
     57

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/axis.pyc
in draw(self, renderer, *args, **kwargs)
   1047         self._update_label_position(ticklabelBoxes, ticklabelBoxes2)
   1048
-> 1049         self.label.draw(renderer)
   1050
   1051         self._update_offset_text_position(ticklabelBoxes,
ticklabelBoxes2)

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/artist.pyc
in draw_wrapper(artist, renderer, *args, **kwargs)
     53     def draw_wrapper(artist, renderer, *args, **kwargs):
     54         before(artist, renderer)
---> 55         draw(artist, renderer, *args, **kwargs)
     56         after(artist, renderer)
     57

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/text.pyc
in draw(self, renderer)
    524         renderer.open_group('text', self.get_gid())
    525
--> 526         bbox, info = self._get_layout(renderer)
    527         trans = self.get_transform()
    528

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/text.pyc
in _get_layout(self, renderer)
    307                 w, h, d = get_text_width_height_descent(clean_line,
    308
self._fontproperties,
--> 309
ismath=ismath)
    310             else:
    311                 w, h, d = 0, 0, 0

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc
in get_text_width_height_descent(self, s, prop, ismath)
    177         if ismath:
    178             ox, oy, width, height, descent, fonts, used_characters
= \
--> 179                 self.mathtext_parser.parse(s, self.dpi, prop)
    180             return width, height, descent
    181

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/mathtext.pyc
in parse(self, s, dpi, prop)
   2972             self.__class__._parser = Parser()
   2973
-> 2974         box = self._parser.parse(s, font_output, fontsize, dpi)
   2975         font_output.set_canvas_size(box.width, box.height,
box.depth)
   2976         result = font_output.get_results(box)

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/mathtext.pyc
in parse(self, s, fonts_object, fontsize, dpi)
   2350         self._state_stack = [self.State(fonts_object, 'default',
'rm', fontsize, dpi)]
   2351         try:
-> 2352             self._expression.parseString(s)
   2353         except ParseException, err:
   2354             raise ValueError("\n".join([

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseString(self, instring, parseAll)
   1046         if not self.keepTabs:
   1047             instring = instring.expandtabs()
-> 1048         loc, tokens = self._parse( instring, 0 )
   1049         if parseAll:
   1050             StringEnd()._parse( instring, loc )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    922             if self.mayIndexError or loc >= len(instring):
    923                 try:
--> 924                     loc,tokens = self.parseImpl( instring, preloc,
doActions )
    925                 except IndexError:
    926                     raise ParseException( instring, len(instring),
self.errmsg, self )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseImpl(self, instring, loc, doActions)
   2557     def parseImpl( self, instring, loc, doActions=True ):
   2558         if self.expr is not None:
-> 2559             return self.expr._parse( instring, loc, doActions,
callPreParse=False )
   2560         else:
   2561             raise ParseException("",loc,self.errmsg,self)

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    922             if self.mayIndexError or loc >= len(instring):
    923                 try:
--> 924                     loc,tokens = self.parseImpl( instring, preloc,
doActions )
    925                 except IndexError:
    926                     raise ParseException( instring, len(instring),
self.errmsg, self )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseImpl(self, instring, loc, doActions)
   2305                     raise ParseSyntaxException(
ParseException(instring, len(instring), self.errmsg, self) )
   2306             else:
-> 2307                 loc, exprtokens = e._parse( instring, loc,
doActions )
   2308             if exprtokens or exprtokens.keys():
   2309                 resultlist += exprtokens

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    922             if self.mayIndexError or loc >= len(instring):
    923                 try:
--> 924                     loc,tokens = self.parseImpl( instring, preloc,
doActions )
    925                 except IndexError:
    926                     raise ParseException( instring, len(instring),
self.errmsg, self )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseImpl(self, instring, loc, doActions)
   2670         tokens = []
   2671         try:
-> 2672             loc, tokens = self.expr._parse( instring, loc,
doActions, callPreParse=False )
   2673             hasIgnoreExprs = ( len(self.ignoreExprs) > 0 )
   2674             while 1:

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    922             if self.mayIndexError or loc >= len(instring):
    923                 try:
--> 924                     loc,tokens = self.parseImpl( instring, preloc,
doActions )
    925                 except IndexError:
    926                     raise ParseException( instring, len(instring),
self.errmsg, self )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseImpl(self, instring, loc, doActions)
   2305                     raise ParseSyntaxException(
ParseException(instring, len(instring), self.errmsg, self) )
   2306             else:
-> 2307                 loc, exprtokens = e._parse( instring, loc,
doActions )
   2308             if exprtokens or exprtokens.keys():
   2309                 resultlist += exprtokens

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    922             if self.mayIndexError or loc >= len(instring):
    923                 try:
--> 924                     loc,tokens = self.parseImpl( instring, preloc,
doActions )
    925                 except IndexError:
    926                     raise ParseException( instring, len(instring),
self.errmsg, self )

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in parseImpl(self, instring, loc, doActions)
   2414         for e in self.exprs:
   2415             try:
-> 2416                 ret = e._parse( instring, loc, doActions )
   2417                 return ret
   2418             except ParseException, err:

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseCache(self, instring, loc, doActions, callPreParse)
    979         else:
    980             try:
--> 981                 value = self._parseNoCache( instring, loc,
doActions, callPreParse )
    982                 ParserElement._exprArgCache[ lookup ] =
(value[0],value[1].copy())
    983                 return value

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/pyparsing.pyc
in _parseNoCache(self, instring, loc, doActions, callPreParse)
    948             else:
    949                 for fn in self.parseAction:
--> 950                     tokens = fn( instring, tokensStart, retTokens )
    951                     if tokens is not None:
    952                         retTokens = ParseResults( tokens,

/home/safarzadeh/yt-x86_64/lib/python2.7/site-packages/matplotlib/mathtext.pyc
in raise_error(s, loc, toks)
   2047     """
   2048     def raise_error(s, loc, toks):
-> 2049         raise ParseFatalException(msg + "\n" + s)
   2050
   2051     empty = Empty()

ParseFatalException: Expected end of math '$'
$\rm{$\mathrm{Particle}\/\mathrm{Density}$}$ (at char 0), (line:1, col:1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130707/2a5bcd0f/attachment.htm>


More information about the yt-users mailing list