[yt-users] trouble with callback on phase plot

Christine Simpson csimpson at astro.columbia.edu
Fri Sep 23 15:16:42 PDT 2011


Hi all,

I'm having trouble adding text through a callback onto a phase plot.

I tried this code:

pc.add_phase_sphere(r200[j],'kpc',["Density","Temperature","CellMassMsun"],weight = None)
pc.set_zlim(1.0e-2,1.0e5)
pc.set_xlim(1.0e-30,5.0e-19)
pc.set_ylim(10.0,1.0e7)  
pc.plots[-1].modify["text"]([0.92,0.92],redshift_string)
  
pc.save("output_%(file_num)s_branch_%yt-users at lists.spacepope.org(br)i"
% {"file_num":fn,"axis":ax,"br":branch_index[j]})

And I get this error:

Traceback (most recent call last):
  File "test_phase_plots.py", line 41, in <module>
    pc.save("output_%(file_num)s_branch_%(br)i" %
{"file_num":fn,"axis":ax,"br":branch_index[j]})
  File
"/share/home/01112/tg803911/yt_17May2011/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.py", line 157, in save
    override=override, force_save=force_save))
  File
"/share/home/01112/tg803911/yt_17May2011/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 108, in save_image
    self._redraw_image()
  File
"/share/home/01112/tg803911/yt_17May2011/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 903, in _redraw_image
    self._run_callbacks()
  File
"/share/home/01112/tg803911/yt_17May2011/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 800, in _run_callbacks
    cb(self)
  File
"/share/home/01112/tg803911/yt_17May2011/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py", line 910, in __call__
    y = plot.image._A.shape[1] * self.pos[1]
IndexError: tuple index out of range


The error arises in the save command, but the problem only happens when
I add the modify["text"] command.  Any ideas?

Christine




More information about the yt-users mailing list