Changeset 4333
- Timestamp:
- Feb 28, 2020 4:19:30 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r4317 r4333 5558 5558 # IMG / Masks 5559 5559 G2G.Define_wxId('wxID_MASKCOPY', 'wxID_MASKSAVE', 'wxID_MASKLOAD', 'wxID_NEWMASKSPOT', 'wxID_NEWMASKARC', 'wxID_NEWMASKRING', 5560 'wxID_NEWMASKFRAME', 'wxID_NEWMASKPOLY','wxID_NEWMASKXLINE','wxID_NEWMASKYLINE','wxID_MASKLOADNOT', 'wxID_FINDSPOTS', 'wxID_DELETESPOTS',) 5560 'wxID_NEWMASKFRAME', 'wxID_NEWMASKPOLY','wxID_NEWMASKXLINE','wxID_NEWMASKYLINE','wxID_MASKLOADNOT', 5561 'wxID_FINDSPOTS', 'wxID_AUTOFINDSPOTS', 'wxID_DELETESPOTS',) 5561 5562 self.MaskMenu = wx.MenuBar() 5562 5563 self.PrefillDataMenu(self.MaskMenu) … … 5569 5570 self.MaskEdit.Append(G2G.wxID_MASKLOADNOT,'Load mask','Load mask from file; ignoring threshold') 5570 5571 self.MaskEdit.Append(G2G.wxID_MASKLOAD,'Load mask w/threshold','Load mask from file keeping the threshold value') 5571 self.MaskEdit.Append(G2G.wxID_FINDSPOTS,'Auto spot masks','Auto search for spot masks; NB: will clear old spot masks') 5572 self.MaskEdit.Append(G2G.wxID_FINDSPOTS,'Spot mask search','Search for spot mask; NB: slow') 5573 self.MaskEdit.Append(G2G.wxID_AUTOFINDSPOTS,'Auto spot mask search','Auto spot mask ssearch; NB: slow') 5572 5574 self.MaskEdit.Append(G2G.wxID_DELETESPOTS,'Delete spot masks','Delete all spot masks') 5573 5575 submenu.Append(G2G.wxID_NEWMASKARC,'Arc mask','Create an arc mask with mouse input') -
trunk/GSASIIimgGUI.py
r4332 r4333 1649 1649 dlg.Destroy() 1650 1650 1651 def On AutoSpotMask(event):1651 def OnFindSpotMask(event): 1652 1652 'Do auto search for spot masks' 1653 if wx.MessageDialog(G2frame.dataWindow,'NB: This will clear any old spot masks',1654 ' Auto Spot Masks', wx.OK|wx.CANCEL).ShowModal() == wx.ID_OK:1655 Controls = copy.deepcopy(G2frame.GPXtree.GetItemPyData(1656 G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls')) )1653 if wx.MessageDialog(G2frame.dataWindow,'NB: This is slow (5-10min)', 1654 'Spot mask search', wx.OK|wx.CANCEL).ShowModal() == wx.ID_OK: 1655 Controls = G2frame.GPXtree.GetItemPyData( 1656 G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls')) 1657 1657 wave = Controls['wavelength'] 1658 1658 LUtth = np.array(Controls['IOtth']) … … 1666 1666 time0 = time.time() 1667 1667 data['SpotMask']['spotMask'] = G2img.AutoSpotMask(G2frame.ImageZ,data,Controls,nChans,dlg) 1668 print(' Autospot processingtime: %.2f m'%((time.time()-time0)/60.))1668 print(' Spot masksearch time: %.2f m'%((time.time()-time0)/60.)) 1669 1669 wx.CallAfter(UpdateMasks,G2frame,data) 1670 1670 wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event) 1671 else: 1672 print(' Spot mask search not done') 1673 1674 def OnAutoFindSpotMask(event): 1675 Names = G2gd.GetGPXtreeDataNames(G2frame,['IMG ',]) 1676 dlg = G2G.G2MultiChoiceDialog(G2frame,'Automatic spot mask search','Select images to spot mask:',Names) 1677 try: 1678 if dlg.ShowModal() == wx.ID_OK: 1679 items = dlg.GetSelections() 1680 G2frame.EnablePlot = False 1681 for item in items: 1682 name = Names[item] 1683 print ('Spot search for'+name) 1684 G2frame.Image = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name) 1685 Controls = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls')) 1686 Mask = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Masks')) 1687 G2frame.ImageZ = GetImageZ(G2frame,Controls) 1688 wave = Controls['wavelength'] 1689 LUtth = np.array(Controls['IOtth']) 1690 dsp0 = wave/(2.0*sind(LUtth[0]/2.0)) 1691 dsp1 = wave/(2.0*sind(LUtth[1]/2.0)) 1692 x0 = G2img.GetDetectorXY(dsp0,0.0,Controls)[0] 1693 x1 = G2img.GetDetectorXY(dsp1,0.0,Controls)[0] 1694 nChans = int(1000*(x1-x0)/Controls['pixelSize'][0])//2 1695 dlg = wx.ProgressDialog("Spot mask search for %d bins"%nChans,"Processed 2-theta rings = ",nChans+3, 1696 style = wx.PD_ELAPSED_TIME|wx.PD_CAN_ABORT) 1697 time0 = time.time() 1698 Mask['SpotMask']['spotMask'] = G2img.AutoSpotMask(G2frame.ImageZ,Mask,Controls,nChans,dlg) 1699 print(' Spot mask search time: %.2f m'%((time.time()-time0)/60.)) 1700 finally: 1701 dlg.Destroy() 1702 G2plt.PlotExposedImage(G2frame,event=None) 1703 1671 1704 1672 1705 def OnDeleteSpotMask(event): … … 1879 1912 G2frame.Bind(wx.EVT_MENU, OnLoadMask, id=G2G.wxID_MASKLOADNOT) 1880 1913 G2frame.Bind(wx.EVT_MENU, OnSaveMask, id=G2G.wxID_MASKSAVE) 1881 G2frame.Bind(wx.EVT_MENU, OnAutoSpotMask, id=G2G.wxID_FINDSPOTS) 1914 G2frame.Bind(wx.EVT_MENU, OnFindSpotMask, id=G2G.wxID_FINDSPOTS) 1915 G2frame.Bind(wx.EVT_MENU, OnAutoFindSpotMask, id=G2G.wxID_AUTOFINDSPOTS) 1882 1916 G2frame.Bind(wx.EVT_MENU, OnDeleteSpotMask, id=G2G.wxID_DELETESPOTS) 1883 1917 G2frame.Bind(wx.EVT_MENU, ToggleSpotMaskMode, id=G2G.wxID_NEWMASKSPOT) -
trunk/GSASIIpwd.py
r4328 r4333 388 388 if 'XC' in inst['Type'][0]: 389 389 ruland = Ruland(data['Ruland'],wave,Q,CF) 390 # auxPlot.append([Q,ruland,'Ruland'])390 # auxPlot.append([Q,ruland,'Ruland']) 391 391 CF *= ruland 392 392 # auxPlot.append([Q,CF,'CF-Corr']) … … 407 407 mul = int(round(2.*np.pi*nR/(Rmax*qLimits[1]))) 408 408 # mul = int(round(2.*np.pi*nR/(data.get('Rmax',100.)*qLimits[1]))) 409 xydata['GofR'][1][0] = 2.*np.pi*np.linspace(0,nR,nR,endpoint=True)/(mul*qLimits[1]) 410 xydata['GofR'][1][1] = -dq*np.imag(fft.fft(xydata['FofQ'][1][1],mul*nR)[:nR]) 409 R = 2.*np.pi*np.linspace(0,nR,nR,endpoint=True)/(mul*qLimits[1]) 410 xydata['GofR'][1][0] = R 411 GR = -dq*np.imag(fft.fft(xydata['FofQ'][1][1],mul*nR)[:nR]) 412 xydata['GofR'][1][1] = GR 413 # gr = GR/(4.*np.pi*R) 414 # auxPlot.append([R,gr,'g(r)']) 411 415 if data.get('noRing',True): 412 416 xydata['GofR'][1][1] = np.where(xydata['GofR'][1][0]<0.5,0.,xydata['GofR'][1][1])
Note: See TracChangeset
for help on using the changeset viewer.