Changeset 2840
- Timestamp:
- May 27, 2017 11:20:45 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r2752 r2840 871 871 useData.SetValue(UseList[G2frame.hist]['Use']) 872 872 useBox.Add(useData,0,WACV) 873 if not generalData['doPawley'] :873 if not generalData['doPawley'] and 'PWDR' in G2frame.hist[:4]: 874 874 lebail = wx.CheckBox(DData,wx.ID_ANY,label='Do LeBail extraction?') 875 875 lebail.Bind(wx.EVT_CHECKBOX, OnLeBail) -
trunk/GSASIIgrid.py
r2825 r2840 68 68 wxID_RELOADDRAWATOMS,wxID_ATOMSDISAGL,wxID_ATOMMOVE,wxID_MAKEMOLECULE, 69 69 wxID_ASSIGNATMS2RB,wxID_ATOMSPDISAGL, wxID_ISODISP,wxID_ADDHATOM,wxID_UPDATEHATOM, 70 wxID_WAVEVARY,wxID_ATOMSROTATE, wxID_ATOMSDENSITY, 70 wxID_WAVEVARY,wxID_ATOMSROTATE, wxID_ATOMSDENSITY, wxID_VALIDPROTEIN, 71 71 wxID_ATOMSSETALL, wxID_ATOMSSETSEL, 72 ] = [wx.NewId() for item in range(2 1)]72 ] = [wx.NewId() for item in range(22)] 73 73 74 74 [ wxID_DRAWATOMSTYLE, wxID_DRAWATOMLABEL, wxID_DRAWATOMCOLOR, wxID_DRAWATOMRESETCOLOR, … … 2443 2443 self.AtomCompute.Append(id=wxID_ATOMSPDISAGL, kind=wx.ITEM_NORMAL,text='Save Distances && Angles', 2444 2444 help='Compute distances & angles for selected atoms') 2445 self.AtomCompute.ISOcalc = self.AtomCompute.Append(2446 id=wxID_ISODISP, kind=wx.ITEM_NORMAL,2447 text='ISODISTORT mode values',2448 help='Compute values of ISODISTORT modes from atom parameters')2449 2445 self.AtomCompute.Append(id=wxID_ATOMSDENSITY, kind=wx.ITEM_NORMAL, 2450 text='Density', 2451 help='Compute density for current phase') 2446 text='Density',help='Compute density for current phase') 2447 self.AtomCompute.Append(id=wxID_VALIDPROTEIN, kind=wx.ITEM_NORMAL, 2448 text='Protein quality',help='Protein quality analysis') 2449 self.AtomCompute.ISOcalc = self.AtomCompute.Append(id=wxID_ISODISP, kind=wx.ITEM_NORMAL, 2450 text='ISODISTORT mode values',help='Compute values of ISODISTORT modes from atom parameters') 2451 2452 2452 self.PostfillDataMenu() 2453 2453 … … 2866 2866 wx.CallAfter(UpdateControls,G2frame,data) 2867 2867 2868 # def OnConvergence(event):2869 # event.Skip()2870 # try:2871 # value = max(1.e-9,min(1.0,float(Cnvrg.GetValue())))2872 # except ValueError:2873 # value = 0.00012874 # data['min dM/M'] = value2875 # Cnvrg.SetValue('%.2g'%(value))2876 #2877 2868 def OnMaxCycles(event): 2878 2869 data['max cyc'] = int(maxCyc.GetValue()) … … 2895 2886 data['F**2'] = fsqRef.GetValue() 2896 2887 2897 # def OnHatomFix(event):2898 # data['HatomFix'] = Hfix.GetValue()2899 2900 # def OnUsrRej(event):2901 # event.Skip()2902 # Obj = event.GetEventObject()2903 # item,limits = Indx[Obj]2904 # try:2905 # value = min(max(float(Obj.GetValue()),limits[0]),limits[1])2906 # except ValueError:2907 # value = data['UsrReject'][item]2908 # data['UsrReject'][item] = value2909 # Obj.SetValue('%.2f'%(value))2910 #2911 2888 LSSizer = wx.FlexGridSizer(cols=4,vgap=5,hgap=5) 2912 2889 LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Refinement derivatives: '),0,WACV) 2913 Choice=['analytic Jacobian','numeric','analytic Hessian'] 2890 Choice=['analytic Jacobian','numeric','analytic Hessian'] #TODO +'SVD refine' - what flags will it need? 2914 2891 derivSel = wx.ComboBox(parent=G2frame.dataDisplay,value=data['deriv type'],choices=Choice, 2915 2892 style=wx.CB_READONLY|wx.CB_DROPDOWN) … … 2920 2897 LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Min delta-M/M: '),0,WACV) 2921 2898 Cnvrg = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'min dM/M',nDig=(10,2,'g'),min=1.e-9,max=1.,typeHint=float) 2922 # Cnvrg = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2g'%(data['min dM/M']),style=wx.TE_PROCESS_ENTER)2923 # Cnvrg.Bind(wx.EVT_TEXT_ENTER,OnConvergence)2924 # Cnvrg.Bind(wx.EVT_KILL_FOCUS,OnConvergence)2925 2899 LSSizer.Add(Cnvrg,0,WACV) 2926 # Indx = {}2927 2900 if 'Hessian' in data['deriv type']: 2928 2901 LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Max cycles: '),0,WACV) … … 2930 2903 maxCyc = wx.ComboBox(parent=G2frame.dataDisplay,value=str(data['max cyc']),choices=Choice, 2931 2904 style=wx.CB_READONLY|wx.CB_DROPDOWN) 2932 # maxCyc.SetValue(str(data['max cyc']))2933 2905 maxCyc.Bind(wx.EVT_COMBOBOX, OnMaxCycles) 2934 2906 LSSizer.Add(maxCyc,0,WACV) … … 2939 2911 marqLam.Bind(wx.EVT_COMBOBOX,OnMarqLam) 2940 2912 LSSizer.Add(marqLam,0,WACV) 2941 else: 2913 else: #TODO what for SVD refine? 2942 2914 LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Initial shift factor: '),0,WACV) 2943 2915 Factr = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'shift factor',nDig=(10,5),min=1.e-5,max=100.,typeHint=float) 2944 # Factr = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.5f'%(data['shift factor']),style=wx.TE_PROCESS_ENTER)2945 # Factr.Bind(wx.EVT_TEXT_ENTER,OnFactor)2946 # Factr.Bind(wx.EVT_KILL_FOCUS,OnFactor)2947 2916 LSSizer.Add(Factr,0,WACV) 2948 2917 if G2frame.Sngl: … … 2961 2930 usrrej = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,userReject,item,nDig=(10,2), 2962 2931 min=usrRej[item][1][0],max=usrRej[item][1][1],typeHint=float) 2963 # usrrej = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2f'%(userReject[item]),style=wx.TE_PROCESS_ENTER)2964 # Indx[usrrej] = [item,usrRej[item][1]]2965 # usrrej.Bind(wx.EVT_TEXT_ENTER,OnUsrRej)2966 # usrrej.Bind(wx.EVT_KILL_FOCUS,OnUsrRej)2967 2932 LSSizer.Add(usrrej,0,WACV) 2968 # Hfix = wx.CheckBox(G2frame.dataDisplay,-1,label='Regularize H atoms? ')2969 # Hfix.SetValue(data['HatomFix'])2970 # Hfix.Bind(wx.EVT_CHECKBOX,OnHatomFix)2971 # LSSizer.Add(Hfix,0,WACV) #for now2972 2933 return LSSizer 2973 2934 … … 4518 4479 mainSizer.Add(wx.StaticText(G2frame.dataDisplay,-1, 4519 4480 ' Data residual wR: %.3f%% on %d observations'%(data[0]['wR'],data[0]['Nobs']))) 4520 mainSizer.Add(wx.StaticText(G2frame.dataDisplay,-1, 4521 ' Durbin-Watson statistic: %.3f'%(data[0].get('Durbin-Watson',0.)))) 4481 if kind == 'PWDR': 4482 mainSizer.Add(wx.StaticText(G2frame.dataDisplay,-1, 4483 ' Durbin-Watson statistic: %.3f'%(data[0].get('Durbin-Watson',0.)))) 4522 4484 for value in data[0]: 4523 4485 if 'Nref' in value: -
trunk/GSASIImath.py
r2839 r2840 2394 2394 out += ("e{:d}").format(valoff) # add an exponent, when needed 2395 2395 return out 2396 2397 ############################################################################### 2398 ##### Protein validation - "ERRATV2" analysis 2399 ############################################################################### 2400 2401 def validProtein(Phase): 2402 resNames = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE', 2403 'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE'] 2404 print 'Do VALIDPROTEIN analysis - TBD' 2405 General = Phase['General'] 2406 Amat,Bmat = G2lat.cell2AB(General['Cell'][1:7]) 2407 cx,ct,cs,cia = General['AtomPtrs'] 2408 Atoms = Phase['Atoms'] 2409 cartAtoms = [] 2410 chains = [] 2411 for atom in Atoms: 2412 if atom[2] in resNames: 2413 cartAtoms.append(atom[:cx+3]) 2414 if atom[2] not in chains: 2415 chains.append(atom[2]) 2416 cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3]) 2417 2396 2418 2397 2419 ################################################################################ -
trunk/GSASIIphsGUI.py
r2834 r2840 2512 2512 print(msg) 2513 2513 G2G.G2MessageBox(G2frame.dataFrame,msg,'Density') 2514 2515 def OnValidProtein(event): 2516 G2mth.validProtein(data) 2514 2517 2515 2518 def OnSetAll(event): … … 2768 2771 try: 2769 2772 idx = atomNames.index(''.join(atom[:ct+1]).capitalize()) #eliminate spurious differences 2770 atId = atom[cia+8] 2771 atomData[idx][:-1] = atom[:-1] 2772 atomData[idx][cia+8] = atId 2773 atId = atomData[idx][cia+8] #save old Id 2774 atomData[idx][:cia+8] = atom[:cia+8]+[atId,] 2773 2775 except ValueError: 2774 2776 if All: … … 6009 6011 6010 6012 def ResrbSizer(RBObj): 6011 G2frame.dataFrame.SetStatusText('NB: Rotation vector is in crystallographic space') 6012 6013 6013 6014 def OnTorsionRef(event): 6014 6015 Obj = event.GetEventObject() … … 6127 6128 return vecrbSizer 6128 6129 6130 def OnSelect(event): 6131 rbId = select.GetSelection() 6132 wx.CallLater(100,RepaintRBInfo,rbId) 6133 6134 def RepaintRBInfo(rbId,Scroll=0): 6135 oldFocus = wx.Window.FindFocus() 6136 G2frame.bottomSizer.DeleteWindows() 6137 Indx.clear() 6138 rbObj = data['RBModels']['Residue'][rbId] 6139 data['Drawing']['viewPoint'][0] = rbObj['Orig'][0] 6140 G2frame.bottomSizer = ResrbSizer(rbObj) 6141 mainSizer.Add(G2frame.bottomSizer) 6142 mainSizer.Layout() 6143 G2frame.dataFrame.Refresh() 6144 RigidBodies.SetVirtualSize(mainSizer.GetMinSize()) 6145 RigidBodies.Scroll(0,Scroll) 6146 G2frame.dataFrame.SendSizeEvent() 6147 wx.CallAfter(G2plt.PlotStructure,G2frame,data) 6148 oldFocus.SetFocus() 6149 6129 6150 # FillRigidBodyGrid executable code starts here 6130 6151 if refresh: … … 6150 6171 mainSizer.Add(wx.StaticText(RigidBodies,-1,'No rigid body models:'),0,WACV) 6151 6172 mainSizer.Add((5,5),0) 6152 if 'Residue' in data['RBModels'] :6173 if 'Residue' in data['RBModels'] and len(data['RBModels']['Residue']): 6153 6174 mainSizer.Add((5,5),0) 6154 6175 mainSizer.Add(wx.StaticText(RigidBodies,-1,'Residue rigid bodies:'),0,WACV) 6155 6176 mainSizer.Add((5,5),0) 6177 RBnames = [] 6156 6178 for RBObj in data['RBModels']['Residue']: 6157 mainSizer.Add(ResrbSizer(RBObj)) 6158 if 'Vector' in data['RBModels']: 6179 RBnames.append(RBObj['RBname'].split(':')[0]+RBObj['numChain']) 6180 rbName = RBnames[0] 6181 rbObj = data['RBModels']['Residue'][0] 6182 data['Drawing']['viewPoint'][0] = rbObj['Orig'][0] 6183 select = wx.ListBox(RigidBodies,choices=RBnames,style=wx.LB_SINGLE,size=(-1,120)) 6184 select.SetSelection(RBnames.index(rbName)) 6185 select.SetFirstItem(RBnames.index(rbName)) 6186 select.Bind(wx.EVT_LISTBOX,OnSelect) 6187 mainSizer.Add(select,0,WACV) 6188 G2frame.bottomSizer = wx.BoxSizer(wx.VERTICAL) 6189 G2frame.bottomSizer.Add(ResrbSizer(rbObj)) 6190 mainSizer.Add(G2frame.bottomSizer) 6191 G2frame.dataFrame.SetStatusText('NB: Rotation vector is in crystallographic space') 6192 wx.CallAfter(G2plt.PlotStructure,G2frame,data) 6193 if 'Vector' in data['RBModels'] and len(data['RBModels']['Vector']): 6159 6194 mainSizer.Add((5,5),0) 6160 6195 mainSizer.Add(wx.StaticText(RigidBodies,-1,'Vector rigid bodies:'),0,WACV) … … 6193 6228 RBObjs[x].update(copy.copy(sourceRB)) 6194 6229 G2plt.PlotStructure(G2frame,data) 6195 wx.CallAfter(FillRigidBodyGrid (True))6230 wx.CallAfter(FillRigidBodyGrid,True) 6196 6231 6197 6232 def OnRBAssign(event): … … 8071 8106 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDistAngle, id=G2gd.wxID_ATOMSDISAGL) 8072 8107 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDistAnglePrt, id=G2gd.wxID_ATOMSPDISAGL) 8108 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDensity, id=G2gd.wxID_ATOMSDENSITY) 8109 G2frame.dataFrame.Bind(wx.EVT_MENU, OnValidProtein, id=G2gd.wxID_VALIDPROTEIN) 8073 8110 G2frame.dataFrame.Bind(wx.EVT_MENU, OnIsoDistortCalc, id=G2gd.wxID_ISODISP) 8074 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDensity, id=G2gd.wxID_ATOMSDENSITY)8075 8111 if 'HydIds' in data['General']: 8076 8112 G2frame.dataFrame.AtomEdit.Enable(G2gd.wxID_UPDATEHATOM,True) … … 8230 8266 G2frame.dataDisplay.AddPage(G2frame.PawleyRefl,'Pawley reflections') 8231 8267 Pages.append('Pawley reflections') 8232 G2frame.dataFrame.AtomCompute.ISOcalc.Enable('ISODISTORT' in data) 8268 G2frame.dataFrame.AtomCompute.Enable(G2gd.wxID_ISODISP,'ISODISTORT' in data) 8269 G2frame.dataFrame.AtomCompute.Enable(G2gd.wxID_VALIDPROTEIN,'macro' in data['General']['Type']) 8233 8270 G2frame.dataDisplay.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, OnPageChanged) 8234 8271 FillMenus() -
trunk/GSASIIrestrGUI.py
r2704 r2840 120 120 style=wx.OPEN | wx.CHANGE_DIR) 121 121 try: 122 macro = '' 122 123 if dlg.ShowModal() == wx.ID_OK: 123 124 macfile = dlg.GetPath() … … 907 908 for ibad in bad: 908 909 del bondList[ibad] 909 bondTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 910 Bonds = G2G.GSGrid(BondRestr) 911 Bonds.SetTable(bondTable, True) 912 Bonds.AutoSizeColumns(False) 913 for r in range(len(bondList)): 914 for c in [0,1,4]: 915 Bonds.SetReadOnly(r,c,True) 916 Bonds.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 917 Bonds.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 918 Bonds.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 919 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 920 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 921 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 922 mainSizer.Add(wx.StaticText(BondRestr,-1, 923 'Bond restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 924 %(chisq,chisq/len(bondList))),0,wx.ALIGN_CENTER_VERTICAL) 925 mainSizer.Add(Bonds,0,) 910 if len(bondList): 911 bondTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 912 Bonds = G2G.GSGrid(BondRestr) 913 Bonds.SetTable(bondTable, True) 914 Bonds.AutoSizeColumns(False) 915 for r in range(len(bondList)): 916 for c in [0,1,4]: 917 Bonds.SetReadOnly(r,c,True) 918 Bonds.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 919 Bonds.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 920 Bonds.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 921 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 922 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 923 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 924 mainSizer.Add(wx.StaticText(BondRestr,-1, 925 'Bond restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 926 %(chisq,chisq/len(bondList))),0,wx.ALIGN_CENTER_VERTICAL) 927 mainSizer.Add(Bonds,0,) 928 else: 929 mainSizer.Add(wx.StaticText(BondRestr,-1,'No bond distance restraints for this phase'),0,) 926 930 else: 927 931 mainSizer.Add(wx.StaticText(BondRestr,-1,'No bond distance restraints for this phase'),0,) … … 1036 1040 for ibad in bad: 1037 1041 del angleList[ibad] 1038 angleTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1039 Angles = G2G.GSGrid(AngleRestr) 1040 Angles.SetTable(angleTable, True) 1041 Angles.AutoSizeColumns(False) 1042 for r in range(len(angleList)): 1043 for c in [0,1,4]: 1044 Angles.SetReadOnly(r,c,True) 1045 Angles.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1046 Angles.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1047 Angles.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1048 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1049 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1050 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1051 mainSizer.Add(wx.StaticText(AngleRestr,-1, 1052 'Angle restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1053 %(chisq,chisq/len(angleList))),0,wx.ALIGN_CENTER_VERTICAL) 1054 mainSizer.Add(Angles,0,) 1042 if len(angleList): 1043 angleTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1044 Angles = G2G.GSGrid(AngleRestr) 1045 Angles.SetTable(angleTable, True) 1046 Angles.AutoSizeColumns(False) 1047 for r in range(len(angleList)): 1048 for c in [0,1,4]: 1049 Angles.SetReadOnly(r,c,True) 1050 Angles.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1051 Angles.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1052 Angles.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1053 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1054 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1055 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1056 mainSizer.Add(wx.StaticText(AngleRestr,-1, 1057 'Angle restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1058 %(chisq,chisq/len(angleList))),0,wx.ALIGN_CENTER_VERTICAL) 1059 mainSizer.Add(Angles,0,) 1060 else: 1061 mainSizer.Add(wx.StaticText(AngleRestr,-1,'No bond angle restraints for this phase'),0,) 1055 1062 else: 1056 1063 mainSizer.Add(wx.StaticText(AngleRestr,-1,'No bond angle restraints for this phase'),0,) … … 1161 1168 for ibad in bad: 1162 1169 del planeList[ibad] 1163 planeTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1164 Planes = G2G.GSGrid(PlaneRestr) 1165 Planes.SetTable(planeTable, True) 1166 Planes.AutoSizeColumns(False) 1167 Planes.AutoSizeRows(False) 1168 for r in range(len(planeList)): 1169 for c in range(3): 1170 Planes.SetReadOnly(r,c,True) 1171 Planes.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1172 Planes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1173 Planes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1174 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1175 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1176 mainSizer.Add(wx.StaticText(PlaneRestr,-1, 1177 'Plane restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1178 %(chisq,chisq/len(planeList))),0,wx.ALIGN_CENTER_VERTICAL) 1179 mainSizer.Add(Planes,0,) 1170 if len(planeList): 1171 planeTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1172 Planes = G2G.GSGrid(PlaneRestr) 1173 Planes.SetTable(planeTable, True) 1174 Planes.AutoSizeColumns(False) 1175 Planes.AutoSizeRows(False) 1176 for r in range(len(planeList)): 1177 for c in range(3): 1178 Planes.SetReadOnly(r,c,True) 1179 Planes.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1180 Planes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1181 Planes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1182 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1183 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1184 mainSizer.Add(wx.StaticText(PlaneRestr,-1, 1185 'Plane restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1186 %(chisq,chisq/len(planeList))),0,wx.ALIGN_CENTER_VERTICAL) 1187 mainSizer.Add(Planes,0,) 1188 else: 1189 mainSizer.Add(wx.StaticText(PlaneRestr,-1,'No plane restraints for this phase'),0,) 1180 1190 else: 1181 1191 mainSizer.Add(wx.StaticText(PlaneRestr,-1,'No plane restraints for this phase'),0,) … … 1290 1300 for ibad in bad: 1291 1301 del volumeList[ibad] 1292 volumeTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1293 Volumes = G2G.GSGrid(ChiralRestr) 1294 Volumes.SetTable(volumeTable, True) 1295 Volumes.AutoSizeColumns(False) 1296 for r in range(len(volumeList)): 1297 for c in [0,1,4]: 1298 Volumes.SetReadOnly(r,c,True) 1299 Volumes.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1300 Volumes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1301 Volumes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1302 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1303 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1304 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1305 mainSizer.Add(wx.StaticText(ChiralRestr,-1, 1306 'Chiral volume restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1307 %(chisq,chisq/len(volumeList))),0,wx.ALIGN_CENTER_VERTICAL) 1308 mainSizer.Add(Volumes,0,) 1302 if len(volumeList): 1303 volumeTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1304 Volumes = G2G.GSGrid(ChiralRestr) 1305 Volumes.SetTable(volumeTable, True) 1306 Volumes.AutoSizeColumns(False) 1307 for r in range(len(volumeList)): 1308 for c in [0,1,4]: 1309 Volumes.SetReadOnly(r,c,True) 1310 Volumes.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1311 Volumes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1312 Volumes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1313 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1314 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1315 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1316 mainSizer.Add(wx.StaticText(ChiralRestr,-1, 1317 'Chiral volume restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1318 %(chisq,chisq/len(volumeList))),0,wx.ALIGN_CENTER_VERTICAL) 1319 mainSizer.Add(Volumes,0,) 1320 else: 1321 mainSizer.Add(wx.StaticText(ChiralRestr,-1,'No chiral volume restraints for this phase'),0,) 1309 1322 else: 1310 1323 mainSizer.Add(wx.StaticText(ChiralRestr,-1,'No chiral volume restraints for this phase'),0,) … … 1391 1404 for ibad in bad: 1392 1405 del torsionList[ibad] 1393 torsionTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1394 TorsionRestr.Torsions = G2G.GSGrid(TorsionRestr) 1395 TorsionRestr.Torsions.SetTable(torsionTable, True) 1396 TorsionRestr.Torsions.AutoSizeColumns(False) 1397 for r in range(len(torsionList)): 1398 for c in range(5): 1399 TorsionRestr.Torsions.SetReadOnly(r,c,True) 1400 TorsionRestr.Torsions.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1401 TorsionRestr.Torsions.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1402 TorsionRestr.Torsions.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1403 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1404 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1405 mainSizer.Add(wx.StaticText(TorsionRestr,-1, 1406 'Torsion restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1407 %(chisq,chisq/len(torsionList))),0,wx.ALIGN_CENTER_VERTICAL) 1408 mainSizer.Add(TorsionRestr.Torsions,0,) 1409 1410 mainSizer.Add((5,5)) 1411 mainSizer.Add(wx.StaticText(TorsionRestr,-1,'Torsion function coefficients:'),0,wx.ALIGN_CENTER_VERTICAL) 1412 table = [] 1413 rowLabels = [] 1414 Types = 9*[wg.GRID_VALUE_FLOAT+':10,4',] 1415 colLabels = ['Mag A','Pos A','Width A','Mag B','Pos B','Width B','Mag C','Pos C','Width C'] 1416 for item in coeffDict: 1417 rowLabels.append(item) 1418 table.append(coeffDict[item]) 1419 coeffTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1420 Coeff = G2G.GSGrid(TorsionRestr) 1421 Coeff.SetTable(coeffTable, True) 1422 Coeff.AutoSizeColumns(False) 1423 for r in range(len(coeffDict)): 1424 for c in range(9): 1425 Coeff.SetReadOnly(r,c,True) 1426 Coeff.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1427 mainSizer.Add(Coeff,0,) 1406 if len(torsionList): 1407 torsionTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1408 TorsionRestr.Torsions = G2G.GSGrid(TorsionRestr) 1409 TorsionRestr.Torsions.SetTable(torsionTable, True) 1410 TorsionRestr.Torsions.AutoSizeColumns(False) 1411 for r in range(len(torsionList)): 1412 for c in range(5): 1413 TorsionRestr.Torsions.SetReadOnly(r,c,True) 1414 TorsionRestr.Torsions.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1415 TorsionRestr.Torsions.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1416 TorsionRestr.Torsions.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1417 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1418 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1419 mainSizer.Add(wx.StaticText(TorsionRestr,-1, 1420 'Torsion restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1421 %(chisq,chisq/len(torsionList))),0,wx.ALIGN_CENTER_VERTICAL) 1422 mainSizer.Add(TorsionRestr.Torsions,0,) 1423 1424 mainSizer.Add((5,5)) 1425 mainSizer.Add(wx.StaticText(TorsionRestr,-1,'Torsion function coefficients:'),0,wx.ALIGN_CENTER_VERTICAL) 1426 table = [] 1427 rowLabels = [] 1428 Types = 9*[wg.GRID_VALUE_FLOAT+':10,4',] 1429 colLabels = ['Mag A','Pos A','Width A','Mag B','Pos B','Width B','Mag C','Pos C','Width C'] 1430 for item in coeffDict: 1431 rowLabels.append(item) 1432 table.append(coeffDict[item]) 1433 coeffTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1434 Coeff = G2G.GSGrid(TorsionRestr) 1435 Coeff.SetTable(coeffTable, True) 1436 Coeff.AutoSizeColumns(False) 1437 for r in range(len(coeffDict)): 1438 for c in range(9): 1439 Coeff.SetReadOnly(r,c,True) 1440 Coeff.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1441 mainSizer.Add(Coeff,0,) 1442 else: 1443 mainSizer.Add(wx.StaticText(TorsionRestr,-1,'No torsion restraints for this phase'),0,) 1428 1444 else: 1429 1445 mainSizer.Add(wx.StaticText(TorsionRestr,-1,'No torsion restraints for this phase'),0,) … … 1511 1527 for ibad in bad: 1512 1528 del ramaList[ibad] 1513 ramaTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1514 RamaRestr.Ramas = G2G.GSGrid(RamaRestr) 1515 RamaRestr.Ramas.SetTable(ramaTable, True) 1516 RamaRestr.Ramas.AutoSizeColumns(False) 1517 for r in range(len(ramaList)): 1518 for c in range(6): 1519 RamaRestr.Ramas.SetReadOnly(r,c,True) 1520 RamaRestr.Ramas.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1521 RamaRestr.Ramas.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1522 RamaRestr.Ramas.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1523 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1524 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1525 mainSizer.Add(wx.StaticText(RamaRestr,-1, 1526 'Ramachandran restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1527 %(chisq,chisq/len(ramaList))),0,wx.ALIGN_CENTER_VERTICAL) 1528 mainSizer.Add(RamaRestr.Ramas,0,) 1529 if len(ramaList): 1530 ramaTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1531 RamaRestr.Ramas = G2G.GSGrid(RamaRestr) 1532 RamaRestr.Ramas.SetTable(ramaTable, True) 1533 RamaRestr.Ramas.AutoSizeColumns(False) 1534 for r in range(len(ramaList)): 1535 for c in range(6): 1536 RamaRestr.Ramas.SetReadOnly(r,c,True) 1537 RamaRestr.Ramas.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1538 RamaRestr.Ramas.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1539 RamaRestr.Ramas.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1540 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1541 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD) 1542 mainSizer.Add(wx.StaticText(RamaRestr,-1, 1543 'Ramachandran restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1544 %(chisq,chisq/len(ramaList))),0,wx.ALIGN_CENTER_VERTICAL) 1545 mainSizer.Add(RamaRestr.Ramas,0,) 1546 else: 1547 mainSizer.Add(wx.StaticText(RamaRestr,-1,'No Ramachandran restraints for this phase'),0,) 1529 1548 else: 1530 1549 mainSizer.Add(wx.StaticText(RamaRestr,-1,'No Ramachandran restraints for this phase'),0,) … … 1649 1668 for ibad in bad: 1650 1669 del chemcompList[ibad] 1651 chemcompTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1652 ChemComps = G2G.GSGrid(ChemCompRestr) 1653 ChemComps.SetTable(chemcompTable, True) 1654 ChemComps.AutoSizeColumns(False) 1655 for r in range(chemcompTable.GetNumberRows()): 1656 for c in range(2): 1657 ChemComps.SetReadOnly(r,c,True) 1658 ChemComps.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1659 if 'Restr' in ChemComps.GetRowLabelValue(r): 1660 for c in range(4): 1670 if len(chemcompList): 1671 chemcompTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1672 ChemComps = G2G.GSGrid(ChemCompRestr) 1673 ChemComps.SetTable(chemcompTable, True) 1674 ChemComps.AutoSizeColumns(False) 1675 for r in range(chemcompTable.GetNumberRows()): 1676 for c in range(2): 1661 1677 ChemComps.SetReadOnly(r,c,True) 1662 1678 ChemComps.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1663 for c in [1,2]: 1664 ChemComps.SetCellTextColour(r,c,VERY_LIGHT_GREY) 1665 else: 1666 for c in [3,4,5]: 1667 ChemComps.SetReadOnly(r,c,True) 1668 ChemComps.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1669 for c in [4,5]: 1670 ChemComps.SetCellTextColour(r,c,VERY_LIGHT_GREY) 1671 1672 ChemComps.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1673 ChemComps.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1674 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1675 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1676 mainSizer.Add(wx.StaticText(ChemCompRestr,-1, 1677 'Chemical composition restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1678 %(chisq,chisq/len(chemcompList))),0,wx.ALIGN_CENTER_VERTICAL) 1679 mainSizer.Add(ChemComps,0,) 1679 if 'Restr' in ChemComps.GetRowLabelValue(r): 1680 for c in range(4): 1681 ChemComps.SetReadOnly(r,c,True) 1682 ChemComps.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1683 for c in [1,2]: 1684 ChemComps.SetCellTextColour(r,c,VERY_LIGHT_GREY) 1685 else: 1686 for c in [3,4,5]: 1687 ChemComps.SetReadOnly(r,c,True) 1688 ChemComps.SetCellStyle(r,c,VERY_LIGHT_GREY,True) 1689 for c in [4,5]: 1690 ChemComps.SetCellTextColour(r,c,VERY_LIGHT_GREY) 1691 1692 ChemComps.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 1693 ChemComps.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange) 1694 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE) 1695 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL) 1696 mainSizer.Add(wx.StaticText(ChemCompRestr,-1, 1697 'Chemical composition restraints: sum(wt*(delt/sig)^2) = %.2f, mean(wt*(delt/sig)^2) = %.2f' \ 1698 %(chisq,chisq/len(chemcompList))),0,wx.ALIGN_CENTER_VERTICAL) 1699 mainSizer.Add(ChemComps,0,) 1700 else: 1701 mainSizer.Add(wx.StaticText(ChemCompRestr,-1,'No chemical composition restraints for this phase'),0,) 1680 1702 else: 1681 1703 mainSizer.Add(wx.StaticText(ChemCompRestr,-1,'No chemical composition restraints for this phase'),0,) -
trunk/GSASIIstrIO.py
r2770 r2840 1456 1456 for name,rest in names: 1457 1457 itemRest = phaseRest[name] 1458 if itemRest[rest] and itemRest['Use']:1458 if rest in itemRest and itemRest[rest] and itemRest['Use']: 1459 1459 print >>pFile,'\n %s %10.3f Use: %s'%(name+' restraint weight factor',itemRest['wtFactor'],str(itemRest['Use'])) 1460 1460 if name in ['Bond','Angle','Plane','Chiral']: -
trunk/imports/G2phase.py
r2817 r2840 130 130 S[12:17].strip(),Type.strip().capitalize(),'',XYZ[0],XYZ[1],XYZ[2], 131 131 float(S[55:61]),SytSym,Mult,'I',Uiso,0,0,0,0,0,0] 132 S = file.readline()133 line += 1134 if 'ANISOU' in S[:6]:135 Uij = S[30:72].split()136 Uij = [float(Uij[0])/10000.,float(Uij[1])/10000.,float(Uij[2])/10000.,137 float(Uij[3])/10000.,float(Uij[4])/10000.,float(Uij[5])/10000.]138 Atom = Atom[:14]+Uij139 Atom[12] = 'A'140 132 Atom.append(ran.randint(0,sys.maxint)) 141 133 Atoms.append(Atom) 134 elif 'ANISOU' in S[:6]: 135 Uij = S[30:72].split() 136 Uij = [float(Uij[0])/10000.,float(Uij[1])/10000.,float(Uij[2])/10000., 137 float(Uij[3])/10000.,float(Uij[4])/10000.,float(Uij[5])/10000.] 138 Atoms[-1] = Atoms[-1][:14]+Uij 139 Atoms[-1][12] = 'A' 140 Atoms[-1].append(ran.randint(0,sys.maxint)) 142 141 S = file.readline() 143 142 line += 1
Note: See TracChangeset
for help on using the changeset viewer.