Hi, I'm trying to add text to a particular point in my slice. I've got: position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o') pc.save("%s_tracking" % (fn)) But python complains with: TypeError: text() argument after ** must be a mapping, not NoneType Did I call the modifier incorrectly? Elizabeth
Hi Elizabeth, It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try: p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o') -Matt On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Matt, No, the marker works fine. By itself, it is no problem. Elizabeth On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
This is the full error spiel. If I comment out the point line, then it's fine. Elizabeth TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py") /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228 /home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"): /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix) /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self): /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label): /home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback): TypeError: text() argument after ** must be a mapping, not NoneType On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Elizabeth, Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2. -Matt On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Matt, Thanks! That fixed it. Elizabeth On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi, The error with p.modify["point"] seems to have reappeared with the latest version of yt. It complains when you set the width, or save, but the problem only occurs when marker["point"] is being used. Elizabeth home/tasker/yt_new/src/yt-hg/scripts/iyt in <module>() 261 p.modify["particles"](5e4, p_size=5, col='k', ptype=12) 262 --> 263 p.set_width(width, 'pc') 264 265 #pc.save(fn) /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in set_width(self, width, unit) 456 unit = self.data.pf[str(unit)] 457 self.width = width / unit --> 458 self._refresh_display_width() 459 460 def _refresh_display_width(self, width=None): /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _refresh_display_width(self, width) 474 self.set_xlim(max(l_edge_x,self.xmin), min(r_edge_x,self.xmax)) 475 self.set_ylim(max(l_edge_y,self.ymin), min(r_edge_y,self.ymax)) --> 476 self._redraw_image() 477 478 def autoscale(self): /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(np.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self): /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label): /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 754 755 width,height = plot.image._A.shape --> 756 x,y = self.convert_to_plot(plot, self.pos) 757 x,y = x/width,y/height 758 /home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in convert_to_plot(self, plot, coord, offset) 75 (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0) 76 else: ---> 77 return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0, 78 (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0) 79 TypeError: 'float' object is On Jul 9, 2012, at 7:53 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,
Thanks! That fixed it.
Elizabeth
On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0]) pc = PlotCollection(pf, center=position) p = pc.add_projection("Density", 2) p.set_width(2, 'kpc') for c in range(len(t1clouds)): r = abs(t1clouds[c]['position']-position) if r[0] < 1.0 and r[1] < 1.0: p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Elizabeth, Sorry to hear you're having trouble. This is likely due to changes I had to make the plot modifications so that they work correctly with the new plot window plots. I'm trying to reproduce the error. It would help to see the a shortened version of the script you're running that reproduces the incorrect behavior? Also, was the TypeError at the end of the traceback the full error or did it get cut off when you pasted it into the e-mail? Thanks, Nathan On 10/4/12 9:13 PM, Elizabeth Tasker wrote:
Hi,
The error with p.modify["point"] seems to have reappeared with the latest version of yt.
It complains when you set the width, or save, but the problem only occurs when marker["point"] is being used.
Elizabeth
home/tasker/yt_new/src/yt-hg/scripts/iyt in <module>() 261 p.modify["particles"](5e4, p_size=5, col='k', ptype=12) 262 --> 263 p.set_width(width, 'pc') 264 265 #pc.save(fn)
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in set_width(self, width, unit) 456 unit = self.data.pf[str(unit)] 457 self.width = width / unit --> 458 self._refresh_display_width() 459 460 def _refresh_display_width(self, width=None):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _refresh_display_width(self, width) 474 self.set_xlim(max(l_edge_x,self.xmin), min(r_edge_x,self.xmax)) 475 self.set_ylim(max(l_edge_y,self.ymin), min(r_edge_y,self.ymax)) --> 476 self._redraw_image() 477 478 def autoscale(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(np.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 754 755 width,height = plot.image._A.shape --> 756 x,y = self.convert_to_plot(plot, self.pos) 757 x,y = x/width,y/height 758
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in convert_to_plot(self, plot, coord, offset) 75 (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0) 76 else: ---> 77 return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0, 78 (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0) 79
TypeError: 'float' object is
On Jul 9, 2012, at 7:53 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,
Thanks! That fixed it.
Elizabeth
On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
Hi Elizabeth,
It looks like the error might be in marker (But it's tough to tell from the one error) so maybe try:
p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o')
-Matt
On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote: > Hi, > > I'm trying to add text to a particular point in my slice. I've got: > > position = na.array([20.2, 13.8, 16.0]) > pc = PlotCollection(pf, center=position) > p = pc.add_projection("Density", 2) > p.set_width(2, 'kpc') > for c in range(len(t1clouds)): > r = abs(t1clouds[c]['position']-position) > if r[0] < 1.0 and r[1] < 1.0: > p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) > p.modify["marker"](t1clouds[c]['position'], marker='o') > > > pc.save("%s_tracking" % (fn)) > > > But python complains with: > > > TypeError: text() argument after ** must be a mapping, not NoneType > > > Did I call the modifier incorrectly? > > Elizabeth > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan, Any image creation that uses point should do it. e.g. from yt.mods import * pf = load("DD0200/GT_BTAccel_256AMR4_PeHeat_sf5_SNe_0200") pc = PlotCollection(pf, center=na.array([16.0, 16.0, 16.0])) p = pc.add_projection("Density", 2) p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") pc.save() which gives error: In [6]: execfile("test_marker.py") yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: current_time = 0.2000001 yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_dimensions = [256 256 256] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_left_edge = [ 0. 0. 0.] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_right_edge = [ 32. 32. 32.] yt : [INFO ] 2012-10-05 13:48:52,570 Parameters: cosmological_simulation = 0.0 yt : [INFO ] 2012-10-05 13:48:52,570 Created plot collection with default plot-center = [16.0, 16.0, 16.0] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("test_marker.py") /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 10 p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") 11 ---> 12 pc.save() /home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"): /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix) /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self): /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label): /home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback): TypeError: text() argument after ** must be a mapping, not NoneType Elizabeth On Oct 5, 2012, at 1:40 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Elizabeth,
Sorry to hear you're having trouble. This is likely due to changes I had to make the plot modifications so that they work correctly with the new plot window plots. I'm trying to reproduce the error.
It would help to see the a shortened version of the script you're running that reproduces the incorrect behavior? Also, was the TypeError at the end of the traceback the full error or did it get cut off when you pasted it into the e-mail?
Thanks,
Nathan
On 10/4/12 9:13 PM, Elizabeth Tasker wrote:
Hi,
The error with p.modify["point"] seems to have reappeared with the latest version of yt.
It complains when you set the width, or save, but the problem only occurs when marker["point"] is being used.
Elizabeth
home/tasker/yt_new/src/yt-hg/scripts/iyt in <module>() 261 p.modify["particles"](5e4, p_size=5, col='k', ptype=12) 262 --> 263 p.set_width(width, 'pc') 264 265 #pc.save(fn)
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in set_width(self, width, unit) 456 unit = self.data.pf[str(unit)] 457 self.width = width / unit --> 458 self._refresh_display_width() 459 460 def _refresh_display_width(self, width=None):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _refresh_display_width(self, width) 474 self.set_xlim(max(l_edge_x,self.xmin), min(r_edge_x,self.xmax)) 475 self.set_ylim(max(l_edge_y,self.ymin), min(r_edge_y,self.ymax)) --> 476 self._redraw_image() 477 478 def autoscale(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(np.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 754 755 width,height = plot.image._A.shape --> 756 x,y = self.convert_to_plot(plot, self.pos) 757 x,y = x/width,y/height 758
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in convert_to_plot(self, plot, coord, offset) 75 (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0) 76 else: ---> 77 return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0, 78 (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0) 79
TypeError: 'float' object is
On Jul 9, 2012, at 7:53 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,
Thanks! That fixed it.
Elizabeth
On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
Hi Matt,
No, the marker works fine. By itself, it is no problem.
Elizabeth
On 2012-07-09, at 2:25 AM, Matthew Turk wrote:
> Hi Elizabeth, > > It looks like the error might be in marker (But it's tough to tell > from the one error) so maybe try: > > p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o') > > -Matt > > On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker > <tasker@astro1.sci.hokudai.ac.jp> wrote: >> Hi, >> >> I'm trying to add text to a particular point in my slice. I've got: >> >> position = na.array([20.2, 13.8, 16.0]) >> pc = PlotCollection(pf, center=position) >> p = pc.add_projection("Density", 2) >> p.set_width(2, 'kpc') >> for c in range(len(t1clouds)): >> r = abs(t1clouds[c]['position']-position) >> if r[0] < 1.0 and r[1] < 1.0: >> p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) >> p.modify["marker"](t1clouds[c]['position'], marker='o') >> >> >> pc.save("%s_tracking" % (fn)) >> >> >> But python complains with: >> >> >> TypeError: text() argument after ** must be a mapping, not NoneType >> >> >> Did I call the modifier incorrectly? >> >> Elizabeth >> _______________________________________________ >> yt-users mailing list >> yt-users@lists.spacepope.org >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Elizabeth, There was a bug in the point callback - thanks for pointing it out. I noticed another spot in the arrow callback that could cause issues in the future for the same reason and fixed that one too. I've pushed the fixes in b8175a113d8e. -Nathan On 10/4/12 9:50 PM, Elizabeth Tasker wrote:
Hi Nathan,
Any image creation that uses point should do it. e.g.
from yt.mods import * pf = load("DD0200/GT_BTAccel_256AMR4_PeHeat_sf5_SNe_0200") pc = PlotCollection(pf, center=na.array([16.0, 16.0, 16.0])) p = pc.add_projection("Density", 2) p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") pc.save()
which gives error:
In [6]: execfile("test_marker.py") yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: current_time = 0.2000001 yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_dimensions = [256 256 256] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_left_edge = [ 0. 0. 0.] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_right_edge = [ 32. 32. 32.] yt : [INFO ] 2012-10-05 13:48:52,570 Parameters: cosmological_simulation = 0.0 yt : [INFO ] 2012-10-05 13:48:52,570 Created plot collection with default plot-center = [16.0, 16.0, 16.0] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("test_marker.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 10 p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") 11 ---> 12 pc.save()
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
Elizabeth
On Oct 5, 2012, at 1:40 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Elizabeth,
Sorry to hear you're having trouble. This is likely due to changes I had to make the plot modifications so that they work correctly with the new plot window plots. I'm trying to reproduce the error.
It would help to see the a shortened version of the script you're running that reproduces the incorrect behavior? Also, was the TypeError at the end of the traceback the full error or did it get cut off when you pasted it into the e-mail?
Thanks,
Nathan
On 10/4/12 9:13 PM, Elizabeth Tasker wrote:
Hi,
The error with p.modify["point"] seems to have reappeared with the latest version of yt.
It complains when you set the width, or save, but the problem only occurs when marker["point"] is being used.
Elizabeth
home/tasker/yt_new/src/yt-hg/scripts/iyt in <module>() 261 p.modify["particles"](5e4, p_size=5, col='k', ptype=12) 262 --> 263 p.set_width(width, 'pc') 264 265 #pc.save(fn)
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in set_width(self, width, unit) 456 unit = self.data.pf[str(unit)] 457 self.width = width / unit --> 458 self._refresh_display_width() 459 460 def _refresh_display_width(self, width=None):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _refresh_display_width(self, width) 474 self.set_xlim(max(l_edge_x,self.xmin), min(r_edge_x,self.xmax)) 475 self.set_ylim(max(l_edge_y,self.ymin), min(r_edge_y,self.ymax)) --> 476 self._redraw_image() 477 478 def autoscale(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(np.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 754 755 width,height = plot.image._A.shape --> 756 x,y = self.convert_to_plot(plot, self.pos) 757 x,y = x/width,y/height 758
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in convert_to_plot(self, plot, coord, offset) 75 (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0) 76 else: ---> 77 return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0, 78 (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0) 79
TypeError: 'float' object is
On Jul 9, 2012, at 7:53 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,
Thanks! That fixed it.
Elizabeth
On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
This is the full error spiel. If I comment out the point line, then it's fine.
Elizabeth
TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("cloud_tracking.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 224 225 --> 226 pc.save("%s_tracking" % (fn)) 227 228
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote:
> Hi Matt, > > No, the marker works fine. By itself, it is no problem. > > Elizabeth > > > On 2012-07-09, at 2:25 AM, Matthew Turk wrote: > >> Hi Elizabeth, >> >> It looks like the error might be in marker (But it's tough to tell >> from the one error) so maybe try: >> >> p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o') >> >> -Matt >> >> On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker >> <tasker@astro1.sci.hokudai.ac.jp> wrote: >>> Hi, >>> >>> I'm trying to add text to a particular point in my slice. I've got: >>> >>> position = na.array([20.2, 13.8, 16.0]) >>> pc = PlotCollection(pf, center=position) >>> p = pc.add_projection("Density", 2) >>> p.set_width(2, 'kpc') >>> for c in range(len(t1clouds)): >>> r = abs(t1clouds[c]['position']-position) >>> if r[0] < 1.0 and r[1] < 1.0: >>> p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) >>> p.modify["marker"](t1clouds[c]['position'], marker='o') >>> >>> >>> pc.save("%s_tracking" % (fn)) >>> >>> >>> But python complains with: >>> >>> >>> TypeError: text() argument after ** must be a mapping, not NoneType >>> >>> >>> Did I call the modifier incorrectly? >>> >>> Elizabeth >>> _______________________________________________ >>> yt-users mailing list >>> yt-users@lists.spacepope.org >>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >> _______________________________________________ >> yt-users mailing list >> yt-users@lists.spacepope.org >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan, That's great -- thank you for doing this so quickly. Elizabeth On Oct 5, 2012, at 2:02 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Elizabeth,
There was a bug in the point callback - thanks for pointing it out. I noticed another spot in the arrow callback that could cause issues in the future for the same reason and fixed that one too. I've pushed the fixes in b8175a113d8e.
-Nathan
On 10/4/12 9:50 PM, Elizabeth Tasker wrote:
Hi Nathan,
Any image creation that uses point should do it. e.g.
from yt.mods import * pf = load("DD0200/GT_BTAccel_256AMR4_PeHeat_sf5_SNe_0200") pc = PlotCollection(pf, center=na.array([16.0, 16.0, 16.0])) p = pc.add_projection("Density", 2) p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") pc.save()
which gives error:
In [6]: execfile("test_marker.py") yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: current_time = 0.2000001 yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_dimensions = [256 256 256] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_left_edge = [ 0. 0. 0.] yt : [INFO ] 2012-10-05 13:48:52,569 Parameters: domain_right_edge = [ 32. 32. 32.] yt : [INFO ] 2012-10-05 13:48:52,570 Parameters: cosmological_simulation = 0.0 yt : [INFO ] 2012-10-05 13:48:52,570 Created plot collection with default plot-center = [16.0, 16.0, 16.0] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() ----> 1 execfile("test_marker.py")
/home/tasker/yt/src/yt-hg/scripts/iyt in <module>() 10 p.modify["point"](na.array([18.0, 16.0, 18.0]), "hello!") 11 ---> 12 pc.save()
/home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) 186 for plot in self.plots: 187 fn.append(plot.save_image(basename, format=format, --> 188 override=override, force_save=force_save)) 189 mylog.info("Saved %s", fn[-1]) 190 if ytcfg.getboolean("yt", "__withinreason"):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) 107 prefix. 108 """ --> 109 self._redraw_image() 110 if not override: 111 self._generate_prefix(prefix)
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 640 def __call__(self, plot): 641 x,y = self.convert_to_pixels(plot, self.pos) --> 642 plot._axes.text(x, y, self.text, **self.text_args) 643 644 class MarkerAnnotateCallback(PlotCallback):
TypeError: text() argument after ** must be a mapping, not NoneType
Elizabeth
On Oct 5, 2012, at 1:40 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Elizabeth,
Sorry to hear you're having trouble. This is likely due to changes I had to make the plot modifications so that they work correctly with the new plot window plots. I'm trying to reproduce the error.
It would help to see the a shortened version of the script you're running that reproduces the incorrect behavior? Also, was the TypeError at the end of the traceback the full error or did it get cut off when you pasted it into the e-mail?
Thanks,
Nathan
On 10/4/12 9:13 PM, Elizabeth Tasker wrote:
Hi,
The error with p.modify["point"] seems to have reappeared with the latest version of yt.
It complains when you set the width, or save, but the problem only occurs when marker["point"] is being used.
Elizabeth
home/tasker/yt_new/src/yt-hg/scripts/iyt in <module>() 261 p.modify["particles"](5e4, p_size=5, col='k', ptype=12) 262 --> 263 p.set_width(width, 'pc') 264 265 #pc.save(fn)
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in set_width(self, width, unit) 456 unit = self.data.pf[str(unit)] 457 self.width = width / unit --> 458 self._refresh_display_width() 459 460 def _refresh_display_width(self, width=None):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _refresh_display_width(self, width) 474 self.set_xlim(max(l_edge_x,self.xmin), min(r_edge_x,self.xmax)) 475 self.set_ylim(max(l_edge_y,self.ymin), min(r_edge_y,self.ymax)) --> 476 self._redraw_image() 477 478 def autoscale(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) 421 self.norm.autoscale(np.array((newmin,newmax), dtype='float64')) 422 self._reset_image_parameters() --> 423 self._run_callbacks() 424 425 def _reset_image_parameters(self):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) 261 self._axes.texts = [] 262 for cb in self._callbacks: --> 263 cb(self) 264 265 def set_label(self, label):
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) 754 755 width,height = plot.image._A.shape --> 756 x,y = self.convert_to_plot(plot, self.pos) 757 x,y = x/width,y/height 758
/home/tasker/yt_new/src/yt-hg/yt/visualization/plot_modifications.pyc in convert_to_plot(self, plot, coord, offset) 75 (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0) 76 else: ---> 77 return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0, 78 (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0) 79
TypeError: 'float' object is
On Jul 9, 2012, at 7:53 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,
Thanks! That fixed it.
Elizabeth
On Jul 9, 2012, at 8:48 AM, Matthew Turk wrote:
Hi Elizabeth,
Okay, that helps -- I've pushed a fix. Hash dab58ec7b5e2.
-Matt
On Sun, Jul 8, 2012 at 7:36 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote: > This is the full error spiel. If I comment out the point line, then it's fine. > > Elizabeth > > > > TypeError Traceback (most recent call last) > /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() > ----> 1 execfile("cloud_tracking.py") > > /home/tasker/yt/src/yt-hg/scripts/iyt in <module>() > 224 > 225 > --> 226 pc.save("%s_tracking" % (fn)) > 227 > 228 > > /home/tasker/yt/src/yt-hg/yt/visualization/plot_collection.pyc in save(self, basename, format, override, force_save) > 186 for plot in self.plots: > 187 fn.append(plot.save_image(basename, format=format, > --> 188 override=override, force_save=force_save)) > 189 mylog.info("Saved %s", fn[-1]) > 190 if ytcfg.getboolean("yt", "__withinreason"): > > /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in save_image(self, prefix, format, override, force_save, figure_canvas) > 107 prefix. > 108 """ > --> 109 self._redraw_image() > 110 if not override: > 111 self._generate_prefix(prefix) > > /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _redraw_image(self, *args) > 421 self.norm.autoscale(na.array((newmin,newmax), dtype='float64')) > 422 self._reset_image_parameters() > --> 423 self._run_callbacks() > 424 > 425 def _reset_image_parameters(self): > > /home/tasker/yt/src/yt-hg/yt/visualization/plot_types.pyc in _run_callbacks(self) > 261 self._axes.texts = [] > 262 for cb in self._callbacks: > --> 263 cb(self) > 264 > 265 def set_label(self, label): > > /home/tasker/yt/src/yt-hg/yt/visualization/plot_modifications.pyc in __call__(self, plot) > 640 def __call__(self, plot): > 641 x,y = self.convert_to_pixels(plot, self.pos) > --> 642 plot._axes.text(x, y, self.text, **self.text_args) > 643 > 644 class MarkerAnnotateCallback(PlotCallback): > > TypeError: text() argument after ** must be a mapping, not NoneType > > > > > > On Jul 9, 2012, at 8:04 AM, Elizabeth Tasker wrote: > >> Hi Matt, >> >> No, the marker works fine. By itself, it is no problem. >> >> Elizabeth >> >> >> On 2012-07-09, at 2:25 AM, Matthew Turk wrote: >> >>> Hi Elizabeth, >>> >>> It looks like the error might be in marker (But it's tough to tell >>> from the one error) so maybe try: >>> >>> p.modify["marker"](t1clouds[c]['position'], plot_args = dict(marker = 'o') >>> >>> -Matt >>> >>> On Sun, Jul 8, 2012 at 12:04 PM, Elizabeth Tasker >>> <tasker@astro1.sci.hokudai.ac.jp> wrote: >>>> Hi, >>>> >>>> I'm trying to add text to a particular point in my slice. I've got: >>>> >>>> position = na.array([20.2, 13.8, 16.0]) >>>> pc = PlotCollection(pf, center=position) >>>> p = pc.add_projection("Density", 2) >>>> p.set_width(2, 'kpc') >>>> for c in range(len(t1clouds)): >>>> r = abs(t1clouds[c]['position']-position) >>>> if r[0] < 1.0 and r[1] < 1.0: >>>> p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track'])) >>>> p.modify["marker"](t1clouds[c]['position'], marker='o') >>>> >>>> >>>> pc.save("%s_tracking" % (fn)) >>>> >>>> >>>> But python complains with: >>>> >>>> >>>> TypeError: text() argument after ** must be a mapping, not NoneType >>>> >>>> >>>> Did I call the modifier incorrectly? >>>> >>>> Elizabeth >>>> _______________________________________________ >>>> yt-users mailing list >>>> yt-users@lists.spacepope.org >>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >>> _______________________________________________ >>> yt-users mailing list >>> yt-users@lists.spacepope.org >>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >> _______________________________________________ >> yt-users mailing list >> yt-users@lists.spacepope.org >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Elizabeth Tasker
-
Matthew Turk
-
Nathan Goldbaum