コード例 #1
0
ファイル: CalibrationData.py プロジェクト: kif/Py2DeX
 def find_peaks_automatic(self, x, y, peak_ind):
     massif = Massif(self.img_data.img_data)
     cur_peak_points = massif.find_peaks([x, y])
     if len(cur_peak_points):
         self.points.append(np.array(cur_peak_points))
         self.points_index.append(peak_ind)
     return np.array(cur_peak_points)
コード例 #2
0
ファイル: CalibrationData.py プロジェクト: kif/Py2DeX
 def find_peaks_automatic(self, x, y, peak_ind):
     massif = Massif(self.img_data.img_data)
     cur_peak_points = massif.find_peaks([x, y])
     if len(cur_peak_points):
         self.points.append(np.array(cur_peak_points))
         self.points_index.append(peak_ind)
     return np.array(cur_peak_points)
コード例 #3
0
 def add_points(self, x, y, phi=0.0):
     xc, yc = self.parameters['xc'].value, self.parameters['yc'].value
     idx, idy = self.find_peak(x, y)
     points = [(idy, idx)]
     circles = []
     massif = Massif(self.counts)
     extra_points = massif.find_peaks((idy, idx))
     for point in extra_points:
         points.append(point)
         circles.append(self.circle(point[1], point[0], alpha=0.3))
     phis = np.array([np.arctan2(p[0]-yc, p[1]-xc) for p in points])
     if phi < -0.5*np.pi:
         phis[np.where(phis > 0.0)] -= 2 * np.pi
     self.phi_max = max(*phis, self.phi_max)
     self.points.append([self.circle(idx, idy), points, circles, self.ring])
コード例 #4
0
ファイル: CalibrationModel.py プロジェクト: tmichela/Dioptas
 def find_peaks_automatic(self, x, y, peak_ind):
     """
     Searches peaks by using the Massif algorithm
     :param float x:
         x-coordinate in pixel - should be from original image (not supersampled x-coordinate)
     :param float y:
         y-coordinate in pixel - should be from original image (not supersampled y-coordinate)
     :param peak_ind:
         peak/ring index to which the found points will be added
     :return:
         array of points found
     """
     massif = Massif(self.img_model._img_data)
     cur_peak_points = massif.find_peaks((int(np.round(x)), int(np.round(y))), stdout=DummyStdOut())
     if len(cur_peak_points):
         self.points.append(np.array(cur_peak_points))
         self.points_index.append(peak_ind)
     return np.array(cur_peak_points)
コード例 #5
0
ファイル: CalibrationModel.py プロジェクト: knilav/Dioptas
 def find_peaks_automatic(self, x, y, peak_ind):
     """
     Searches peaks by using the Massif algorithm
     :param x:
         x-coordinate in pixel - should be from original image (not supersampled x-coordinate)
     :param y:
         y-coordinate in pixel - should be from original image (not supersampled y-coordinate)
     :param peak_ind:
         peak/ring index to which the found points will be added
     :return:
         array of points found
     """
     massif = Massif(self.img_model._img_data)
     cur_peak_points = massif.find_peaks([x, y], stdout=DummyStdOut())
     if len(cur_peak_points):
         self.points.append(np.array(cur_peak_points))
         self.points_index.append(peak_ind)
     return np.array(cur_peak_points)
コード例 #6
0
ファイル: calibrate_powder.py プロジェクト: rayosborn/nxpeaks
 def on_button_release(self, event):
     if event.inaxes:
         if abs(event.x - self.xp) > 5 or abs(event.y - self.yp) > 5:
             return
         x, y = self.plotview.inverse_transform(event.xdata, event.ydata)
         for i, point in enumerate(self.points):
             circle = point[0]
             if circle.contains_point(self.plotview.ax.transData.transform((x,y))):
                 circle.remove()
                 for circle in point[2]:
                     circle.remove()
                 del self.points[i]
                 return
         idx, idy = self.find_peak(x, y)
         points = [(idy, idx)]
         circles = []
         massif = Massif(self.counts)
         extra_points = massif.find_peaks((idy, idx))
         for point in extra_points:
             points.append(point)
             circles.append(self.circle(point[1], point[0], alpha=0.3))
         self.points.append([self.circle(idx, idy), points, circles, self.ring])
コード例 #7
0
 def on_button_release(self, event):
     if event.inaxes:
         if abs(event.x - self.xp) > 5 or abs(event.y - self.yp) > 5:
             return
         x, y = self.plotview.inverse_transform(event.xdata, event.ydata)
         for i, point in enumerate(self.points):
             circle = point[0]
             if circle.contains_point(
                     self.plotview.ax.transData.transform((x, y))):
                 circle.remove()
                 for circle in point[2]:
                     circle.remove()
                 del self.points[i]
                 return
         idx, idy = self.find_peak(x, y)
         points = [(idy, idx)]
         circles = []
         massif = Massif(self.counts)
         extra_points = massif.find_peaks((idy, idx))
         for point in extra_points:
             points.append(point)
             circles.append(self.circle(point[1], point[0], alpha=0.3))
         self.points.append(
             [self.circle(idx, idy), points, circles, self.ring])