Changeset 2117 for trunk/GSASIIindex.py
- Timestamp:
- Jan 8, 2016 12:03:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIindex.py
r2111 r2117 14 14 15 15 Cell indexing program: variation on that of A. Coehlo 16 includes cell refinement from peak positions (not zero as yet) 17 18 This needs a bit of refactoring to remove the little bit of GUI 19 code referencing wx 16 includes cell refinement from peak positions 20 17 ''' 21 18 22 19 import math 23 import wx24 20 import time 25 21 import numpy as np … … 775 771 Asave = [] 776 772 GoOn = True 773 Skip = False 777 774 if A: 778 775 HKL = G2lat.GenHBravais(dmin,ibrav,A[:]) … … 781 778 Asave.append([calc_M20(peaks,HKL,ifX20),A[:]]) 782 779 tries = 0 783 while tries < Ntries :780 while tries < Ntries and GoOn: 784 781 if A: 785 782 Abeg = ranAbyR(ibrav,A,tries+1,Ntries,ran2axis) … … 789 786 Abeg = ranAbyV(ibrav,amin,amax,V1) 790 787 HKL = G2lat.GenHBravais(dmin,ibrav,Abeg) 788 Nc = len(HKL) 789 if Nc >= ncMax: 790 GoOn = False 791 else: 792 if dlg: 793 GoOn,Skip = dlg.Update(100*Nc/ncMax) 794 if Skip or not GoOn: 795 GoOn = False 796 break 791 797 792 798 if IndexPeaks(peaks,HKL)[0] and len(HKL) > mHKL[ibrav]: … … 809 815 break 810 816 Nc = len(HKL) 811 if Nc >= ncMax:812 GoOn = False813 elif dlg:814 GoOn = dlg.Update(Nc)[0]815 if not GoOn:816 break817 817 tries += 1 818 818 X = sortM20(Asave) 819 819 if X: 820 820 Lhkl,M20,X20,A = refinePeaks(peaks,ibrav,X[0][1],ifX20) 821 return GoOn,Lhkl,M20,X20,A 822 823 else: 824 return GoOn,0,0,0,0 821 return GoOn,Skip,Lhkl,M20,X20,A 822 else: 823 return GoOn,Skip,0,0,0,0 825 824 826 825 def monoCellReduce(ibrav,A): … … 846 845 return A 847 846 848 def DoIndexPeaks(peaks,controls,bravais, ifX20=True):847 def DoIndexPeaks(peaks,controls,bravais,dlg,ifX20=True): 849 848 'needs a doc string' 850 849 … … 881 880 cycle = 0 882 881 while cycle < 5: 883 dlg = wx.ProgressDialog("Generated reflections",tries[cycle]+" cell search for "+bravaisNames[ibrav],ncMax, 884 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT) 885 screenSize = wx.ClientDisplayRect() 886 Size = dlg.GetSize() 887 dlg.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5)) 882 dlg.Update(0,newmsg=tries[cycle]+" cell search for "+bravaisNames[ibrav]) 888 883 try: 889 884 GoOn = True … … 894 889 if not N2: 895 890 A = [] 896 GoOn,Nc,M20,X20,A = findBestCell(dlg,ncMax,A,Nm[ibrav]*N1s[ibrav],ibrav,peaks,V1,ifX20) 891 GoOn,Skip,Nc,M20,X20,A = findBestCell(dlg,ncMax,A,Nm[ibrav]*N1s[ibrav],ibrav,peaks,V1,ifX20) 892 if Skip: 893 break 897 894 if A: 898 GoOn, Nc,M20,X20,A = findBestCell(dlg,ncMax,A[:],N1s[ibrav],ibrav,peaks,0,ifX20)895 GoOn,Skip,Nc,M20,X20,A = findBestCell(dlg,ncMax,A[:],N1s[ibrav],ibrav,peaks,0,ifX20) 899 896 else: 900 GoOn,Nc,M20,X20,A = findBestCell(dlg,ncMax,0,Nm[ibrav]*N1s[ibrav],ibrav,peaks,V1,ifX20) 901 if Nc >= ncMax: 897 GoOn,Skip,Nc,M20,X20,A = findBestCell(dlg,ncMax,0,Nm[ibrav]*N1s[ibrav],ibrav,peaks,V1,ifX20) 898 if Skip: 899 break 900 elif Nc >= ncMax: 902 901 GoOn = False 903 902 break … … 928 927 break 929 928 N2 += 1 929 if Skip: 930 cycle = 10 931 GoOn = False 932 break 930 933 if ibrav < 11: 931 934 V1 *= 1.1 … … 946 949 finally: 947 950 pass 948 dlg.Destroy()951 # dlg.Destroy() 949 952 print '%s%s%s%s'%('finished cell search for ',bravaisNames[ibrav], \ 950 953 ', elapsed time = ',G2lat.sec2HMS(time.time()-begin))
Note: See TracChangeset
for help on using the changeset viewer.