Jul 4, 2019 5:28:49 PM (3 years ago)

complete multiprocessing & caching of maps; results not yet tested

1 edited


  • trunk/GSASIIscriptable.py

    r4049 r4053  
    44534453        G2fil.PDFWrite(PDFentry,fileroot,PDFsaves,self.data['PDF Controls'],inst,limits)
     4455blkSize = 256   #256 seems to be optimal; will break in polymask if >1024
     4456'Integration block size; 256 seems to be optimal, must be <=1024 (for polymask)'
     4458def calcMaskMap(imgprms,mskprms):
     4459    '''Computes the mask array for a set of image controls and mask parameters
     4460    '''
     4461    return G2img.MakeUseMask(imgprms,mskprms,blkSize)
     4463def calcThetaAzimMap(imgprms):
     4464    '''Computes the array for theta-azimuth mapping for a set of image controls
     4465    '''
     4466    return G2img.MakeUseTA(imgprms,blkSize)
    44554468class G2Image(G2ObjectWrapper):
    44564469    """Wrapper for an IMG tree entry, containing an image and various metadata.
    47164729        '''load masks dict (from :meth:`getMasks`) into current IMG record
    4718         :param dict maskDict: specifies a dict with image parameters
     4731        :param dict maskDict: specifies a dict with image parameters,
     4732          from :meth:`getMasks`
    47194733        :param bool resetThresholds: If True, Threshold Masks in the
    47204734          dict are ignored. The default is False which means Threshold
    47264740            Imin = max(0.,np.min(ImageZ))
    47274741            Imax = np.max(ImageZ)
    4728             self.data['Masks']['Thresholds'] [(0,Imax),[Imin,Imax]]
     4742            self.data['Masks']['Thresholds'] [(0,Imax),[Imin,Imax]]       
    47304744    def getVary(self,*args):
    47314745        '''Return the refinement flag(s) for Image Controls parameter(s)
    47794793        G2img.ImageRecalibrate(None,ImageZ,self.data['Image Controls'],self.data['Masks'])
    4781     def Integrate(self,name=None):
     4795    def Integrate(self,name=None,MaskMap=None,ThetaAzimMap=None):
    47824796        '''Invokes an image integration (same as Image Controls/Integration/Integrate
    47834797        menu command). All parameters will have previously been set with Image Controls
    4784         so no input is needed here. Note that if integration is performed on an
     4798        so no input is needed here. However, the optional parameters MaskMap
     4799        and ThetaAzimMap may be supplied to save computing these items more than
     4800        once, speeding integration of multiple images with the same
     4801        image/mask parameters.
     4803        Note that if integration is performed on an
    47854804        image more than once, histogram entries may be overwritten. Use the name
    47864805        parameter to prevent this if desired.
    47884807        :param str name: base name for created histogram(s). If None (default),
    47894808          the histogram name is taken from the image name.
     4809        :param list MaskMap: from :func:`calcMaskMap`
     4810        :param list ThetaAzimMap: from :func:`calcThetaAzimMap`
    47904811        :returns: a list of created histogram (:class:`G2PwdrData`) objects.
    47914812        '''
    4792         blkSize = 256   #256 seems to be optimal; will break in polymask if >1024
    47934813        ImageZ = _getCorrImage(Readers['Image'],self.proj,self)
    47944814        # do integration
    4795         ints,azms,Xvals,cancel = G2img.ImageIntegrate(ImageZ,self.data['Image Controls'],self.data['Masks'],blkSize=blkSize)
     4815        ints,azms,Xvals,cancel = G2img.ImageIntegrate(ImageZ,
     4816                self.data['Image Controls'],self.data['Masks'],blkSize=blkSize,
     4817                useMask=MaskMap,useTA=ThetaAzimMap)
    47964818        # code from here on based on G2IO.SaveIntegration, but places results in the current
    47974819        # project rather than tree
Note: See TracChangeset for help on using the changeset viewer.