def pre_process(self): """ This method is called after the plugin has been created by the pipeline framework as a pre-processing step :param parameters: A dictionary of the parameters for this plugin, or None if no customisation is required :type parameters: dict """ in_dataset, out_datasets = self.get_datasets() mData = self.get_in_meta_data()[0] in_d1 = in_dataset[0] ai = AzimuthalIntegrator() # get me an integrator object ### prep the goemtry bc = [mData.get_meta_data("beam_center_x")[...], mData.get_meta_data("beam_center_y")[...]] distance = mData.get_meta_data('distance')[...] wl = mData.get_meta_data('incident_wavelength')[...] px = mData.get_meta_data('x_pixel_size')[...] orien = mData.get_meta_data( 'detector_orientation')[...].reshape((3, 3)) #Transform yaw = math.degrees(-math.atan2(orien[2, 0], orien[2, 2])) roll = math.degrees(-math.atan2(orien[0, 1], orien[1, 1])) ai.setFit2D(distance, bc[0], bc[1], -yaw, roll, px, px, None) ai.set_wavelength(wl) self.sh = in_d1.get_shape()[-2:] self.npts = self.get_parameters('num_bins') foo = units.to_unit(units.TTH) # preallocate pretenddata = np.zeros(self.sh) pretendfit = ai.xrpd(data=pretenddata, npt=self.npts) twotheta=ai.__getattribute__(foo.center)(ai.detector.max_shape) # get the detector array of Q # preallocate twotheta *= 180.0/np.pi # preallocate twotheta_flat = twotheta.ravel() #pre allocate self.params = [self.npts, mData, ai, twotheta_flat]