def conv_to_Iq(self, qidi, mask, dz=True, w=3, tol=3, cor=0): """ convert solution scattering/powder diffraction data into 1D scattering curve the q axis is given by grid (1d array) calls the C-code in RQconv the cor parameter can take positive or negative values if cor>0, the 1D data will be corrected for (divided by) the factor due to polarization and the non-normal incident X-rays onto the detector if cor<0, the 1D data will be multipled by this factor instead. this is useful to build this correction into the flat field correction """ # apply the mask before passing the data to RQconv # RQconv should discard all data with zero intensity dm = np.zeros((self.height, self.width), np.int32) + 1 # dm = 1-np.asarray(mask.map,np.int32) if dz: print("dezinger ...") RQconv.dezinger(self.data.astype(np.int32), dm, w, tol) # NOTE: use self.data+1, instead of self.data, to avoid confusion betwee # zero-count pixels and masked pixels. The added 1 count will be subtracted in RQconv # print (dm*2-1==0).any() # dm = (dm*2-1)*self.data dm = np.multiply(dm, (1 - mask.map) * (self.data + 1)).astype(np.int32) # plt.figure() # plt.imshow(dm) RQconv.conv_to_Iq(dm, self.exp, qidi, cor)