本文整理汇总了Python中nexpy.gui.datadialogs.GridParameters.set_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python GridParameters.set_parameters方法的具体用法?Python GridParameters.set_parameters怎么用?Python GridParameters.set_parameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nexpy.gui.datadialogs.GridParameters
的用法示例。
在下文中一共展示了GridParameters.set_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CalibrateDialog
# 需要导入模块: from nexpy.gui.datadialogs import GridParameters [as 别名]
# 或者: from nexpy.gui.datadialogs.GridParameters import set_parameters [as 别名]
#.........这里部分代码省略.........
self.plotview.cidrelease = self.plotview.mpl_connect(
'button_release_event', self.on_button_release)
def find_peak(self, x, y):
s = self.search_size
left = int(np.round(x - s * 0.5))
if left < 0:
left = 0
top = int(np.round(y - s * 0.5))
if top < 0:
top = 0
region = self.counts[top:(top+s),left:(left+s)]
idy, idx = np.where(region == region.max())
idx = left + idx[0]
idy = top + idy[0]
return idx, idy
def clear_peaks(self):
self.points = []
@property
def calibrant(self):
return ALL_CALIBRANTS[self.parameters['calibrant'].value]
@property
def point_array(self):
points = []
for point in self.points:
for p in point[1]:
points.append((p[0], p[1], point[3]))
return np.array(points)
def prepare_parameters(self):
self.parameters.set_parameters()
self.wavelength = self.parameters['wavelength'].value * 1e-10
self.distance = self.parameters['distance'].value * 1e-3
self.yaw = np.radians(self.parameters['yaw'].value)
self.pitch = np.radians(self.parameters['pitch'].value)
self.roll = np.radians(self.parameters['roll'].value)
self.pixel_size = self.entry['instrument/detector/pixel_size'].nxvalue * 1e-3
self.xc = self.parameters['xc'].value
self.yc = self.parameters['yc'].value
def calibrate(self):
self.prepare_parameters()
self.orig_pixel1 = self.pixel_size
self.orig_pixel2 = self.pixel_size
self.pattern_geometry = GeometryRefinement(self.point_array,
dist=self.distance,
wavelength=self.wavelength,
pixel1=self.pixel_size,
pixel2=self.pixel_size,
calibrant=self.calibrant)
self.refine()
self.create_cake_geometry()
self.pattern_geometry.reset()
def refine(self):
self.pattern_geometry.data = self.point_array
if self.parameters['wavelength'].vary:
self.pattern_geometry.refine2()
fix = []
else:
fix = ['wavelength']
if not self.parameters['distance'].vary: