Changeset 3247
- Timestamp:
- Jan 29, 2018 9:34:15 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r3243 r3247 2689 2689 cartAtoms[-1][4] = 'O' 2690 2690 cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3]) 2691 cartAtoms[-1].append(atom[cia+8]) 2691 2692 XYZ = np.array([atom[cx:cx+3] for atom in cartAtoms]) 2692 2693 xyzmin = np.array([np.min(XYZ.T[i]) for i in [0,1,2]]) … … 2713 2714 res = [] 2714 2715 resNames = [] 2716 resIDs = {} 2715 2717 resname = [] 2718 resID = {} 2716 2719 newChain = True 2717 2720 intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0} … … 2724 2727 chainIntAct.append(resIntAct) 2725 2728 resNames += resname 2729 resIDs.update(resID) 2726 2730 res = [] 2727 2731 resname = [] 2732 resID = {} 2728 2733 resIntAct = [] 2729 2734 intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0} … … 2738 2743 resIntAct.append(sumintact(intact)) 2739 2744 res.append(atom[0]) 2740 resname.append('%s-%s%s'%(atom[2],atom[0],atom[1])) 2745 name = '%s-%s%s'%(atom[2],atom[0],atom[1]) 2746 resname.append(name) 2747 resID[name] = atom[-1] 2741 2748 if not newChain: 2742 2749 resIntAct.append(sumintact(intact)) … … 2777 2784 # print ia,atom[0]+atom[1]+atom[3],tgts,jntact['CC'],jntact['CN']+jntact['NC'],jntact['CO']+jntact['OC'],jntact['NN'],jntact['NO']+jntact['ON'] 2778 2785 resNames += resname 2786 resIDs.update(resID) 2779 2787 resIntAct.append(sumintact(intact)) 2780 2788 chainIntAct.append(resIntAct) … … 2789 2797 summ = 0. 2790 2798 for j in range(i-4,i+5): 2791 summ += np.sum(np.array( IntAct[j].values()))2799 summ += np.sum(np.array(list(IntAct[j].values()))) 2792 2800 if old: 2793 2801 mtrx[0] += IntAct[j]['CC'] … … 2815 2823 Probs += 4*[0.,] #skip last 4 residues in chain 2816 2824 chainProb += Probs 2817 return resNames,chainProb 2825 return resNames,chainProb,resIDs 2818 2826 2819 2827 ################################################################################ -
trunk/GSASIIphsGUI.py
r3245 r3247 3457 3457 3458 3458 def OnValidProtein(event): 3459 resNames,Probs1 = G2mth.validProtein(data,True) #old version 3460 resNames,Probs2 = G2mth.validProtein(data,False) #new version 3459 3460 def pickHandler(resName): 3461 drawData = data['Drawing'] 3462 resid = resIDs[resName] 3463 drawData['viewPoint'][0] = atomData[AtLookUp[resid]][cx:cx+3] 3464 UpdateDrawAtoms() 3465 G2plt.PlotStructure(G2frame,data) 3466 3467 atomData = data['Atoms'] 3468 cx,ct,cs,cia = data['General']['AtomPtrs'] 3469 AtLookUp = G2mth.FillAtomLookUp(atomData,cia+8) 3470 resNames,Probs1,resIDs = G2mth.validProtein(data,True) #old version 3471 resNames,Probs2,resIDs = G2mth.validProtein(data,False) #new version 3461 3472 print ('Plot 1 is Protein validation based on errat.f') 3462 3473 print ('Ref: Colovos, C. & Yeates, T.O. Protein Science 2, 1511-1519 (1991).') … … 3468 3479 print ('NB: this calc. gives a close approximate to original erratv2 result') 3469 3480 G2plt.PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='Error score for %s'%(data['General']['Name']), 3470 thresh=[[8.0,6.0],[17.191,11.527]] )3481 thresh=[[8.0,6.0],[17.191,11.527]],pickHandler=pickHandler) 3471 3482 3472 3483 def OnIsoDistortCalc(event): -
trunk/GSASIIplot.py
r3245 r3247 3232 3232 ##### PlotHist 3233 3233 ################################################################################ 3234 def PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='',thresh=None ):3234 def PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='',thresh=None,pickHandler=None): 3235 3235 3236 3236 def OnMotion(event): … … 3256 3256 except TypeError: 3257 3257 G2frame.G2plotNB.status.SetStatusText('Select AA error plot first',1) 3258 3259 def OnPick(event): 3260 xpos = event.mouseevent.xdata 3261 if xpos and pickHandler: 3262 xpos = int(xpos+.5) 3263 if 0 <= xpos < len(resNames): 3264 resName = resNames[xpos] 3265 else: 3266 resName = '' 3267 pickHandler(resName) 3258 3268 3259 3269 def Draw(): … … 3267 3277 colors = list(np.where(np.array(Probs1)>thresh[0][1],'r','b')) 3268 3278 resNums = np.arange(len(resNames)) 3269 Plot1.bar(resNums,Probs1,color=colors,linewidth=0 )3279 Plot1.bar(resNums,Probs1,color=colors,linewidth=0,picker=1) 3270 3280 if thresh is not None: 3271 3281 for item in thresh[0]: … … 3275 3285 Plot2.set_xlabel(r'Residue',fontsize=14) 3276 3286 colors = list(np.where(np.array(Probs2)>thresh[1][1],'r','b')) 3277 Plot2.bar(resNums,Probs2,color=colors,linewidth=0 )3287 Plot2.bar(resNums,Probs2,color=colors,linewidth=0,picker=1) 3278 3288 if thresh is not None: 3279 3289 for item in thresh[1]: … … 3283 3293 3284 3294 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl') 3285 # Page.canvas.mpl_connect('key_press_event', OnKeyPress)3295 Page.canvas.mpl_connect('pick_event', OnPick) 3286 3296 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 3287 3297 Draw() … … 6812 6822 elif atom[cs+1] == 'number': 6813 6823 RenderLabel(x,y,z,' '+str(iat),radius,wxGreen,matRot) 6814 elif atom[cs+1] == 'residue' and atom[ct-1] == 'CA':6824 elif atom[cs+1] == 'residue' and atom[ct-1] in ['CA','CA A']: 6815 6825 RenderLabel(x,y,z,' '+atom[ct-4],radius,wxGreen,matRot) 6816 elif atom[cs+1] == '1-letter' and atom[ct-1] == 'CA':6826 elif atom[cs+1] == '1-letter' and atom[ct-1] in ['CA','CA A']: 6817 6827 RenderLabel(x,y,z,' '+atom[ct-3],radius,wxGreen,matRot) 6818 elif atom[cs+1] == 'chain' and atom[ct-1] == 'CA':6828 elif atom[cs+1] == 'chain' and atom[ct-1] in ['CA','CA A']: 6819 6829 RenderLabel(x,y,z,' '+atom[ct-2],radius,wxGreen,matRot) 6820 6830 # glDisable(GL_BLEND) -
trunk/GSASIIspc.py
r3245 r3247 1450 1450 SSGData = {'SSpGrp':SGData['SpGrp']+SSymbol,'modQ':modQ,'modSymb':modsym,'SSGKl':SSGKl} 1451 1451 SSCen = np.zeros((len(SGData['SGCen']),4)) 1452 # if SGData['SGFixed']: 1453 # for icen,cen in enumerate(SGData['SGCen']): 1454 # SSCen[icen] = cen 1455 # else: 1456 if True: 1457 for icen,cen in enumerate(SGData['SGCen']): 1458 SSCen[icen,0:3] = cen 1459 SSCen[0] = np.zeros(4) 1452 for icen,cen in enumerate(SGData['SGCen']): 1453 SSCen[icen,0:3] = cen 1454 SSCen[0] = np.zeros(4) 1460 1455 SSGData['SSGCen'] = SSCen 1461 1456 SSGData['SSGOps'] = [] … … 1463 1458 T = np.zeros(4) 1464 1459 ssop = np.zeros((4,4)) 1465 # if SGData['SGFixed']: 1466 # ssop = op[0] 1467 # T = op[1] 1468 # else: 1469 if True: 1470 ssop[:3,:3] = op[0] 1471 T[:3] = op[1] 1460 ssop[:3,:3] = op[0] 1461 T[:3] = op[1] 1472 1462 SSGData['SSGOps'].append([ssop,T]) 1473 1463 E,Result = genSSGOps()
Note: See TracChangeset
for help on using the changeset viewer.