def register_mark(self, event):
"""Marks a line
Detects where the click was done or m-key was pressed and calls the
corresponding method. It handles the middle button click and m-key being
pressed. There are two regions of interest as for where a click was
done. The raw and reference data respectively. For any of such regions
it will call the method that recenter the line and once the desired
value is returned it will be appended to the list that contains all the
correspondent line positions, raw (pixels) and reference (angstrom)
Args:
event (object): Click or m-key pressed event
"""
if event.xdata is not None and event.ydata is not None:
figure_x, figure_y = \
self.i_fig.transFigure.inverted().transform((event.x, event.y))
if self.reference_bb.contains(figure_x, figure_y):
# self.reference_marks.append([event.xdata, event.ydata])
self.reference_marks_x.append(
self.recenter_line_by_data('reference', event.xdata))
self.reference_marks_y.append(event.ydata)
self.update_marks_plot('reference')
elif self.raw_data_bb.contains(figure_x, figure_y):
# self.raw_data_marks.append([event.xdata, event.ydata])
self.raw_data_marks_x.append(
self.recenter_line_by_data('raw-data', event.xdata))
self.raw_data_marks_y.append(event.ydata)
self.update_marks_plot('raw_data')
else:
self.log.debug('{:f} {:f} Are not contained'.format(figure_x,
figure_y))
else:
self.log.error('Clicked Region is out of boundaries')
评论列表
文章目录