def process_imageset(self, imageset): rec_range = 1 / self.max_resolution panel = imageset.get_detector()[0] beam = imageset.get_beam() s0 = beam.get_s0() pixel_size = panel.get_pixel_size() xlim, ylim = imageset.get_raw_data(0)[0].all() # cache transformation xy = recviewer.get_target_pixels(panel, s0, xlim, ylim, self.max_resolution) s1 = panel.get_lab_coord(xy * pixel_size[0]) # FIXME: assumed square pixel s1 = s1 / s1.norms() * (1 / beam.get_wavelength()) S = s1 - s0 npoints = self.grid.all()[0] for i in xrange(len(imageset)): step = 2 * rec_range / npoints axis = imageset.get_goniometer().get_rotation_axis() osc_range = imageset.get_scan(i).get_oscillation_range() print "Oscillation range: %.1f - %.1f" % (osc_range[0], osc_range[1]) angle = (osc_range[0] + osc_range[1]) / 2 / 180 * math.pi if not self.reverse_phi: # FIXME: ??? angle *= -1 rotated_S = S.rotate_around_origin(axis, angle) recviewer.fill_voxels( imageset.get_raw_data(i)[0], self.grid, self.cnts, rotated_S, xy, rec_range)
def process_imageset(self, imageset): rec_range = 1 / self.max_resolution panel = imageset.get_detector()[0] beam = imageset.get_beam() s0 = beam.get_s0() pixel_size = panel.get_pixel_size() xlim, ylim = imageset.get_raw_data(0)[0].all() # cache transformation xy = recviewer.get_target_pixels(panel, s0, xlim, ylim, self.max_resolution) s1 = panel.get_lab_coord(xy * pixel_size[0]) # FIXME: assumed square pixel s1 = s1 / s1.norms() * (1 / beam.get_wavelength()) S = s1 - s0 npoints = self.grid.all()[0] for i in xrange(len(imageset)): step = 2 * rec_range / npoints axis = imageset.get_goniometer().get_rotation_axis() osc_range = imageset.get_scan(i).get_oscillation_range() print "Oscillation range: %.1f - %.1f" % (osc_range[0], osc_range[1]) angle = (osc_range[0] + osc_range[1]) / 2 / 180 * math.pi if self.reverse_phi == False: # FIXME: ??? angle *= -1 rotated_S = S.rotate_around_origin(axis, angle) recviewer.fill_voxels(imageset.get_raw_data(i)[0], self.grid, self.cnts, rotated_S, xy, rec_range)
def process_imageset(self, imageset): rec_range = 1 / self.max_resolution if len(imageset.get_detector()) != 1: raise Sorry("This program does not support multi-panel detectors.") panel = imageset.get_detector()[0] beam = imageset.get_beam() s0 = beam.get_s0() pixel_size = panel.get_pixel_size() xlim, ylim = imageset.get_raw_data(0)[0].all() if pixel_size[0] != pixel_size[1]: raise Sorry("This program does not support non-square pixels.") # cache transformation xy = recviewer.get_target_pixels(panel, s0, xlim, ylim, self.max_resolution) s1 = panel.get_lab_coord(xy * pixel_size[0]) s1 = s1 / s1.norms() * (1 / beam.get_wavelength()) S = s1 - s0 for i in range(len(imageset)): axis = imageset.get_goniometer().get_rotation_axis() osc_range = imageset.get_scan(i).get_oscillation_range() print( f"Oscillation range: {osc_range[0]:.2f} - {osc_range[1]:.2f}") angle = (osc_range[0] + osc_range[1]) / 2 / 180 * math.pi if not self.reverse_phi: # the pixel is in S AFTER rotation. Thus we have to rotate BACK. angle *= -1 rotated_S = S.rotate_around_origin(axis, angle) data = imageset.get_raw_data(i)[0] if not self.ignore_mask: mask = imageset.get_mask(i)[0] data.set_selected(~mask, 0) recviewer.fill_voxels(data, self.grid, self.counts, rotated_S, xy, rec_range)