Changeset 3173 for trunk/GSASIIimgGUI.py
- Timestamp:
- Dec 5, 2017 3:23:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimgGUI.py
r3172 r3173 143 143 ##### Image Controls 144 144 ################################################################################ 145 def UpdateImageControls(G2frame,data,masks,IntegrateOnly=False): 145 blkSize = 1024 #this seems to be optimal; will break in polymask if >1024 146 def UpdateImageControls(G2frame,data,masks,useTA=None,IntegrateOnly=False): 146 147 '''Shows and handles the controls on the "Image Controls" 147 148 data tree entry … … 237 238 MaxSizer.GetChildren()[5].Window.SetValue(Imin) #tricky 238 239 239 def OnIntegrate(event ):240 def OnIntegrate(event,useTA=None): 240 241 '''Integrate image in response to a menu event or from the AutoIntegrate 241 242 dialog. In the latter case, event=None. … … 243 244 ''' 244 245 CleanupMasks(masks) 245 blkSize = 1024 #this seems to be optimal; will break in polymask if >1024246 # blkSize = 128 #this seems to be optimal; will break in polymask if >1024247 246 sumImg = GetImageZ(G2frame,data) 248 247 wx.BeginBusyCursor() 249 248 try: 250 G2frame.Integrate = G2img.ImageIntegrate(sumImg,data,masks,blkSize )249 G2frame.Integrate = G2img.ImageIntegrate(sumImg,data,masks,blkSize,useTA=useTA) 251 250 finally: 252 251 wx.EndBusyCursor() … … 269 268 style = wx.PD_ELAPSED_TIME|wx.PD_CAN_ABORT) 270 269 try: 270 pId = 0 271 oldData = {'tilt':0.,'distance':0.,'rotation':0.,'center':[0.,0.],'DetDepth':0.,'azmthOff':0.} 271 272 for icnt,item in enumerate(items): 272 273 GoOn = dlgp.Update(icnt) … … 277 278 CId = G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls') 278 279 Data = G2frame.GPXtree.GetItemPyData(CId) 280 same = True 281 for item in ['tilt','distance','rotation','center','DetDepth','azmthOff']: 282 if Data[item] != oldData[item]: 283 same = False 284 if not same: 285 print('Use new image controls') 286 useTA = G2img.MakeUseTA(Data,blkSize) 279 287 Masks = G2frame.GPXtree.GetItemPyData( 280 288 G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Masks')) 281 289 image = GetImageZ(G2frame,Data) 282 blkSize = 128 #this seems to be optimal; will break in polymask if >1024 283 G2frame.Integrate = G2img.ImageIntegrate(image,Data,Masks,blkSize) 290 G2frame.Integrate = G2img.ImageIntegrate(image,Data,Masks,blkSize,useTA=useTA) 284 291 del image #force cleanup 285 292 pId = G2IO.SaveIntegration(G2frame,CId,Data) 293 oldData = Data 286 294 finally: 287 295 dlgp.Destroy() 288 296 G2frame.EnablePlot = True 289 G2frame.GPXtree.SelectItem(pId) 290 G2frame.GPXtree.Expand(pId) 291 G2frame.PatternId = pId 297 if pId: 298 G2frame.GPXtree.SelectItem(pId) 299 G2frame.GPXtree.Expand(pId) 300 G2frame.PatternId = pId 292 301 finally: 293 302 dlg.Destroy() … … 1184 1193 1185 1194 if IntegrateOnly: 1186 OnIntegrate(None )1195 OnIntegrate(None,useTA=useTA) 1187 1196 return 1188 1197 … … 2715 2724 self.Pause = True 2716 2725 2717 def IntegrateImage(self,img ):2726 def IntegrateImage(self,img,useTA=None): 2718 2727 '''Integrates a single image. Ids for created PWDR entries (more than one is possible) 2719 2728 are placed in G2frame.IntgOutList … … 2741 2750 # simulate a Image Controls press, since that is where the 2742 2751 # integration is hidden 2743 UpdateImageControls(G2frame,data,masks, IntegrateOnly=True)2752 UpdateImageControls(G2frame,data,masks,useTA=useTA,IntegrateOnly=True) 2744 2753 G2frame.IntegratedList.append(img) # note this as integrated 2745 2754 # split name and control number … … 2919 2928 This is called only after the "Start" button is pressed (then its label reads "Pause"). 2920 2929 ''' 2921 def AutoIntegrateImage(imgId ):2930 def AutoIntegrateImage(imgId,useTA=None): 2922 2931 '''Integrates an image that has been read into the data tree and updates the 2923 2932 AutoInt window. … … 2936 2945 self.EnableButtons(False) 2937 2946 try: 2938 self.IntegrateImage(img )2947 self.IntegrateImage(img,useTA=useTA) 2939 2948 finally: 2940 2949 self.EnableButtons(True) … … 3022 3031 # integrate the images that have already been read in, but 3023 3032 # have not yet been processed 3033 oldData = {'tilt':0.,'distance':0.,'rotation':0.,'center':[0.,0.],'DetDepth':0.,'azmthOff':0.} 3024 3034 for img in G2gd.GetGPXtreeDataNames(G2frame,['IMG ']): 3025 3035 imgId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,img) … … 3029 3039 # skip if already integrated 3030 3040 if img in G2frame.IntegratedList: continue 3031 AutoIntegrateImage(imgId) 3032 #self.Pause |= G2frame.PauseIntegration 3033 #if self.Pause: 3034 # self.OnPause() 3035 # self.PreventReEntryTimer = False 3036 # return 3041 Data = G2frame.GPXtree.GetItemPyData( 3042 G2gd.GetGPXtreeItemId(G2frame,imgId, 'Image Controls')) 3043 same = True 3044 for item in ['tilt','distance','rotation','center','DetDepth','azmthOff']: 3045 if Data[item] != oldData[item]: 3046 same = False 3047 if not same: 3048 print('Use new image controls') 3049 self.useTA = G2img.MakeUseTA(Data,blkSize) 3050 AutoIntegrateImage(imgId,self.useTA) 3051 oldData = Data 3037 3052 if self.pdfControls: AutoComputePDF(imgId) 3038 3053 self.Pause |= G2frame.PauseIntegration … … 3046 3061 if newImage in imageFileList or self.Pause: continue # already read? 3047 3062 for imgId in G2IO.ReadImages(G2frame,newImage): 3048 AutoIntegrateImage(imgId) 3049 #self.Pause |= G2frame.PauseIntegration 3050 #if self.Pause: 3051 # self.OnPause() 3052 # self.PreventReEntryTimer = False 3053 # return 3063 AutoIntegrateImage(imgId,self.useTA) 3054 3064 if self.pdfControls: AutoComputePDF(imgId) 3055 3065 self.Pause |= G2frame.PauseIntegration
Note: See TracChangeset
for help on using the changeset viewer.