soft-matter / mr

particle tracking and microrheology toolkit
GNU General Public License v3.0
3 stars 7 forks source link

Labelling #6

Closed vallard1 closed 11 years ago

vallard1 commented 11 years ago

The label option of function ptraj doesn't seem to be working anymore.

The issue arises when I type: ptraj(data,label=True)

I get an error and nothing happens.

I don't think it is an data-dependent issue, although it might be. In some cases, the trajectories are still plotted, but without the labels, and I get the same error. In those cases, when I close the figure window, ipython shuts down. ipython doesn't shut down when there's just an error and no plot.

I think we've seen this error before and dealt with it somehow, but I don't remember how.

Error detail:

Input: ptraj(t,label=True) mr.core.plots.plot_traj: Using units of px, not microns

KeyError Traceback (most recent call last) /home/victor/Videos/T84_Dry_IPA_Comparison/ in () ----> 1 ptraj(t,label=True)

/home/victor/mr/mr/core/plots.pyc in wrapper(_args, _kwargs) 44 if 'ax' not in kwargs: 45 kwargs['ax'] = plt.gca() ---> 46 func(_args, _kwargs) 47 if not kwargs['ax'].get_legend_handles_labels() == ([], []): 48 plt.legend(loc='best')

/home/victor/mr/mr/core/plots.pyc in plot_traj(traj, colorby, mpp, label, superimpose, cmap, ax) 124 coords = DataFrame(unstacked.fillna(method='backfill').stack().ix[1]) 125 for probe_id, coord in coords.iterrows(): --> 126 plt.text(coord['x'], coord['y'], str(probe_id), 127 horizontalalignment='center', 128 verticalalignment='center')

/home/victor/pandas/pandas/core/series.pyc in getitem(self, key) 607 def getitem(self, key): 608 try: --> 609 return self.index.get_value(self, key) 610 except InvalidIndexError: 611 pass

/home/victor/pandas/pandas/core/index.pyc in get_value(self, series, key) 769 raise InvalidIndexError(key) 770 else: --> 771 raise e1 772 except Exception: # pragma: no cover 773 raise e1

KeyError: 'x'

PS: The documentation for ptraj could stand to be updated a little when you find the time, if only to include a word about the possibility of using label=True.

danielballan commented 11 years ago

Closed by this commit