コード例 #1
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 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,dm,w,tol)
     # NOTE: use self.data+1, instead of self.data, to avoid confusion between
     # 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 *= (1-mask.map) * (self.data+1)
     #plt.figure()
     #plt.imshow(dm)
     RQconv.conv_to_Iq(dm,self.exp,qidi,cor)
コード例 #2
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def conv_to_Iqrqz(self):
     #calls the C-code in RQconv
     self.q_data_available = True
     if not self.qdata==None: del self.qdata
     RQconv.pre_conv_Iqrqz(self.data,self.exp)
     self.qdata = np.ones((self.exp.nz, self.exp.nr), dtype=np.int32)
     RQconv.conv_to_Iqrqz(self.data,self.qdata,self.exp)
コード例 #3
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def set_exp_para(self,exp):
     if exp.flip:
         self.im = self.im.transpose(Image.ROTATE_90).transpose(Image.FLIP_LEFT_RIGHT)
         self.data = np.asarray(self.im).copy()
         (self.height, self.width) = np.shape(self.data)
     self.exp=exp
     RQconv.calc_rot(self.exp)
コード例 #4
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def merge2(self, dset):
     """ intended to merge dset with self, doesn't work, see notes in RQconv.c
     """
     if not self.data.shape==dset.data.shape:
         print "merging 2D data sets have different shapes:"
         print self.shape, " and ", dset.data.shape, "\n"
         exit()
     RQconv.merge(self.data,dset.data)
コード例 #5
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def cor_IAdep_2D(self,mask=None,corCode=3,invert=False):
     """ if invert==True, the data is mulitplied by the correction factor, instead of being divided by
         this is useful for obtaining the correction factor itself for each pixel
     """
     dm = np.ones((self.height,self.width),np.int32)
     if not mask==None:
         dm *= (1-mask.map) * self.data
     else:
         dm *= self.data
     RQconv.cor_IAdep_2D(dm,self.exp,corCode,invert)
     self.data=dm
コード例 #6
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
    def qrqz2xy(self,qr,qz):
        """calls the C-code in RQconv
        need to deal with the special situation when the (qr, qz) is not visible on the detector
        use the smallest allowable qr at the same qz instead
        this is done in RQconv, with the last argument in RQconv.qrqz2xy set to 1
        """

        ret = RQconv.qrqz2xy(self.data,self.exp,qr,qz,1)
        return ret.x, ret.y
コード例 #7
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def val(self, fx, fy):
     """ intensity at the pixel position (fx, fy), interpolatd from the neighbors
     """
     """
     ix = int(fx)
     iy = int(fy)
     if ix<0 or iy<0 or ix>=self.width or iy>=self.height : return(0)
     t = (1.-(fx-ix))*(1.-(fy-iy))*self.data[iy,ix]
     t += (fx-ix)*(1.-(fy-iy))*self.data[iy+1,ix]
     t += (1.-(fx-ix))*(fy-iy)*self.data[iy,ix+1]
     t += (fx-ix)*(fy-iy)*self.data[iy+1,ix+1]
     return t
     """
     return RQconv.get_value(self.data,fx,fy)
コード例 #8
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def xy2q(self,x,y):
     """calls the C-code in RQconv
     """
     return RQconv.xy2q(self.data,self.exp,x,y)
コード例 #9
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def xy2qrqz(self,x,y):
     """calls the C-code in RQconv
     """
     ret = RQconv.xy2qrqz(self.data,self.exp,x,y)
     return ret.x, ret.y
コード例 #10
0
ファイル: Data2D.py プロジェクト: qiuresearch/sassie_0_dna
 def qphi2xy(self,q,phi):
     """calls the C-code in RQconv
     """
     #print q,phi
     ret = RQconv.qphi2xy(self.data,self.exp,q,phi)
     return ret.x, ret.y