Changeset 4487
- Timestamp:
- Jun 13, 2020 3:50:13 PM (3 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
install/bootstrap.py
r4477 r4487 120 120 ''' 121 121 if isinstance(arg,str): return arg 122 if isinstance(arg,bytes): return arg.decode() 122 if isinstance(arg,bytes): 123 try: 124 return arg.decode() 125 except: 126 print('Decode error') 127 return arg 123 128 if isinstance(arg,list): 124 129 return [MakeByte2str(i) for i in arg] -
trunk/GSASIIpath.py
r4439 r4487 154 154 ''' 155 155 if isinstance(arg,str): return arg 156 if isinstance(arg,bytes): return arg.decode() 156 if isinstance(arg,bytes): 157 try: 158 return arg.decode() 159 except: 160 if GetConfigValue('debug'): print('Decode error') 161 return arg 157 162 if isinstance(arg,list): 158 163 return [MakeByte2str(i) for i in arg] -
trunk/GSASIIphsGUI.py
r4484 r4487 7924 7924 mainSizer = wx.BoxSizer(wx.VERTICAL) 7925 7925 mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Molecular completion parameters'),0,WACV) 7926 mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Pause after: '),0,WACV) 7926 7927 topSizer = wx.BoxSizer(wx.HORIZONTAL) 7927 topSizer.Add( wx.StaticText(dlg,wx.ID_ANY,'Max # of repetitions: '),0,WACV)7928 topSizer.Add((45,-1)) 7928 7929 choices = [1,2,5,10,50] 7929 7930 params = {'maxrep':10, 'maxatm':1000} 7930 7931 topSizer.Add(G2G.EnumSelector(dlg,params,'maxrep', 7931 7932 [str(i) for i in choices],choices)) 7933 topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,' repetitions'),0,WACV) 7932 7934 mainSizer.Add(topSizer,0,WACV) 7933 7935 topSizer = wx.BoxSizer(wx.HORIZONTAL) 7934 topSizer.Add( wx.StaticText(dlg,wx.ID_ANY,'Max # of added atoms: '),0,WACV)7936 topSizer.Add((45,-1)) 7935 7937 choices = [100,500,1000,5000,10000] 7936 7938 topSizer.Add(G2G.EnumSelector(dlg,params,'maxatm', 7937 7939 [str(i) for i in choices],choices)) 7940 topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,' added atoms'),0,WACV) 7938 7941 mainSizer.Add(topSizer,0,WACV) 7939 7942 mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Atom types to add:'),0,WACV) … … 7976 7979 7977 7980 time1 = time.time() 7978 pgbar = wx.ProgressDialog('Fill molecular coordination',7979 'Passes done=0 %0',params['maxrep'],7980 parent=G2frame,7981 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT)7982 screenSize = wx.ClientDisplayRect()7983 Size = pgbar.GetSize()7984 if 50 < Size[0] < 500: # sanity check on size, since this fails w/Win & wx3.07985 pgbar.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x7986 pgbar.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))7987 pgbar.Raise()7988 wx.Yield()7989 7981 added = 0 7990 7982 targets = [item for item in atomTypes if params[item]] 7991 cx,ct,cs,ci = getAtomPtrs(data,draw=True) 7992 for rep in range(params['maxrep']): 7983 cx,ct,cs,ci = getAtomPtrs(data,draw=True) 7984 rep = 0 7985 allrep = 0 7986 while True: 7987 if rep == 0: 7988 pgbar = wx.ProgressDialog('Fill molecular coordination', 7989 'Passes done=0 %0',params['maxrep']+1, 7990 parent=G2frame, 7991 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT) 7992 screenSize = wx.ClientDisplayRect() 7993 Size = pgbar.GetSize() 7994 if 50 < Size[0] < 500: # sanity check on size, since this fails w/Win & wx3.0 7995 pgbar.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x 7996 pgbar.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5)) 7997 pgbar.Raise() 7998 wx.Yield() 7993 7999 startlen = len(data['Drawing']['Atoms']) 7994 8000 coordsArray = np.array([a[cx:cx+3] for a in data['Drawing']['Atoms']]) … … 8002 8008 if not GoOn[0]: break 8003 8009 print('pass {} processed {} atoms adding {}; Search time: {:.2f}s'.format( 8004 rep+1,len(indx),len(addedAtoms),time.time()-time1))8010 allrep+1,len(indx),len(addedAtoms),time.time()-time1)) 8005 8011 time1 = time.time() 8006 8012 rep += 1 8013 allrep += 1 8007 8014 if len(addedAtoms) == 0: break 8008 8015 added += len(addedAtoms) 8009 if added > params['maxatm']: break8010 8016 data['Drawing']['Atoms'] += addedAtoms 8011 8017 # atoms to search over (omit H) 8012 indx = [i+startlen for i in range(len(addedAtoms)) if addedAtoms[i][ct] != 'H'] 8018 indx = [i+startlen for i in range(len(addedAtoms)) if addedAtoms[i][ct] != 'H'] 8019 if len(indx) == 0: break 8020 if added > params['maxatm']: 8021 msg = "Exceeded number added atoms. Continue?" 8022 dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO) 8023 if dlg.ShowModal() != wx.ID_YES: 8024 dlg.Destroy() 8025 break 8026 dlg.Destroy() 8027 rep = 0 8028 added = 1 8029 pgbar.Destroy() 8030 if rep >= params['maxrep']: 8031 msg = "Exceeded number of repetitions. Continue?" 8032 dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO) 8033 if dlg.ShowModal() != wx.ID_YES: 8034 dlg.Destroy() 8035 break 8036 dlg.Destroy() 8037 rep = 0 8038 added = 1 8039 pgbar.Destroy() 8013 8040 UpdateDrawAtoms() 8014 8041 G2plt.PlotStructure(G2frame,data) … … 9961 9988 dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO|wx.ICON_EXCLAMATION) 9962 9989 if dlg.ShowModal() != wx.ID_YES: 9963 #OkBtn.SetLabel('Not Ready') 9964 #OkBtn.Enable(False) 9990 dlg.Destroy() 9965 9991 return 9992 dlg.Destroy() 9966 9993 9967 9994 rbType = data['testRBObj']['rbType']
Note: See TracChangeset
for help on using the changeset viewer.