Skip to content

Commit

Permalink
Put letters in bold/large font & black for peak-picking
Browse files Browse the repository at this point in the history
  • Loading branch information
kif committed Oct 23, 2014
1 parent 7ccbfea commit d02936a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pyFAI-src/peak_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ def peaks_from_area(self, mask, Imin, keep=1000, refine=True, method=None, ring=
pt0x = gpt.points[0][1]
pt0y = gpt.points[0][0]
gpt.annotate = self.ax.annotate(gpt.label, xy=(pt0x, pt0y), xytext=(pt0x + 10, pt0y + 10),
color="white", arrowprops=dict(facecolor='white', edgecolor='white'))
weight="bold", size="large", color="black",
arrowprops=dict(facecolor='white', edgecolor='white'))
update_fig(self.fig)
return points

Expand Down Expand Up @@ -285,7 +286,8 @@ def display_points(self, minIndex=0):
pt0x = gpt.points[0][1]
pt0y = gpt.points[0][0]
gpt.annotate = self.ax.annotate(gpt.label, xy=(pt0x, pt0y), xytext=(pt0x + 10, pt0y + 10),
color="white", arrowprops=dict(facecolor='white', edgecolor='white'))
weight="bold", size="large", color="black",
arrowprops=dict(facecolor='white', edgecolor='white'))

npl = numpy.array(gpt.points)
gpt.plot = self.ax.plot(npl[:, 1], npl[:, 0], "o", scalex=False, scaley=False)
Expand All @@ -303,15 +305,17 @@ def annontate(x, x0=None, idx=None, gpt=None):
TODO
"""
if x0 is None:
annot = self.ax.annotate(".", xy=(x[1], x[0]), color="black")
annot = self.ax.annotate(".", xy=(x[1], x[0]), weight="bold", size="large", color="black")
else:
if gpt:
annot = self.ax.annotate(gpt.label, xy=(x[1], x[0]), xytext=(x0[1], x0[0]), color="white",
arrowprops=dict(facecolor='white', edgecolor='white'),)
annot = self.ax.annotate(gpt.label, xy=(x[1], x[0]), xytext=(x0[1], x0[0]),
weight="bold", size="large", color="black",
arrowprops=dict(facecolor='white', edgecolor='white'),)
gpt.annotate = annot
else:
annot = self.ax.annotate("%i" % (len(self.points)), xy=(x[1], x[0]), xytext=(x0[1], x0[0]), color="white",
arrowprops=dict(facecolor='white', edgecolor='white'),)
annot = self.ax.annotate("%i" % (len(self.points)), xy=(x[1], x[0]), xytext=(x0[1], x0[0]),
weight="bold", size="large", color="black",
arrowprops=dict(facecolor='white', edgecolor='white'),)
update_fig(self.fig)
return annot

Expand Down Expand Up @@ -345,10 +349,9 @@ def new_grp(event):

def single_point(event):
" * Right-click + Ctrl (click+b): create new group with one single point"
points = []
newpeak = self.massif.nearest_peak([event.ydata, event.xdata])
if newpeak:
gpt = common_creation(points)
gpt = common_creation([newpeak])
annontate(newpeak, [event.ydata, event.xdata], gpt=gpt)
logger.info("Create group #%2s with single point x=%5.1f, y=%5.1f" % (gpt.label, newpeak[1], newpeak[0]))
else:
Expand All @@ -361,7 +364,10 @@ def append_more_points(event):
if not gpt:
new_grp(event)
return
self.ax.lines.remove(gpt.plot)
if gpt.plot:
if gpt.plot[0] in self.ax.lines:
self.ax.lines.remove(gpt.plot[0])

update_fig(self.fig)
# need to annotate only if a new group:
listpeak = self.massif.find_peaks([event.ydata, event.xdata],
Expand Down

0 comments on commit d02936a

Please sign in to comment.