Changeset 3003
- Timestamp:
- Aug 12, 2017 4:23:31 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r3000 r3003 2574 2574 resNames = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE', 2575 2575 'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE'] 2576 old = True #use errat version 1 math 2577 # data from errat.f 2578 b1_old = np.array([ 2579 [1154.343, 600.213, 1051.018, 1132.885, 960.738], 2580 [600.213, 1286.818, 1282.042, 957.156, 612.789], 2581 [1051.018, 1282.042, 3519.471, 991.974, 1226.491], 2582 [1132.885, 957.156, 991.974, 1798.672, 820.355], 2583 [960.738, 612.789, 1226.491, 820.355, 2428.966] 2584 ]) 2585 avg_old = np.array([ 0.225, 0.281, 0.071, 0.237, 0.044]) #Table 1 3.5A Obsd. Fr. p 1513 2576 2586 # data taken from erratv2.ccp 2577 b1 = np.array([ [0,0,0,0,0,0],2578 [ 0,5040.279078850848200, 3408.805141583649400, 4152.904423767300600, 4236.200004171890200, 5054.781210204625500],2579 [ 0,3408.805141583648900, 8491.906094010220800, 5958.881777877950300, 1521.387352718486200, 4304.078200827221700],2580 [ 0,4152.904423767301500, 5958.881777877952100, 7637.167089335050100, 6620.715738223072500, 5287.691183798410700],2581 [ 0,4236.200004171890200, 1521.387352718486200, 6620.715738223072500, 18368.343774298410000, 4050.797811118806700],2582 [ 0,5054.781210204625500, 4304.078200827220800, 5287.691183798409800, 4050.797811118806700, 6666.856740479164700]])2583 avg = np.array([0. ,0.192765509919262, 0.195575208778518, 0.275322406824210, 0.059102357035642, 0.233154192767480])2587 b1 = np.array([ 2588 [5040.279078850848200, 3408.805141583649400, 4152.904423767300600, 4236.200004171890200, 5054.781210204625500], 2589 [3408.805141583648900, 8491.906094010220800, 5958.881777877950300, 1521.387352718486200, 4304.078200827221700], 2590 [4152.904423767301500, 5958.881777877952100, 7637.167089335050100, 6620.715738223072500, 5287.691183798410700], 2591 [4236.200004171890200, 1521.387352718486200, 6620.715738223072500, 18368.343774298410000, 4050.797811118806700], 2592 [5054.781210204625500, 4304.078200827220800, 5287.691183798409800, 4050.797811118806700, 6666.856740479164700]]) 2593 avg = np.array([0.192765509919262, 0.195575208778518, 0.275322406824210, 0.059102357035642, 0.233154192767480]) 2584 2594 General = Phase['General'] 2585 2595 Amat,Bmat = G2lat.cell2AB(General['Cell'][1:7]) … … 2594 2604 if atom[4].strip() in ['S','Se']: 2595 2605 atom[4] = 'O' 2596 if atom[3].strip() in ['C','N']: #skip main chain C & N atoms2597 continue2606 # if atom[3].strip() in ['C','N']: #skip main chain C & N atoms 2607 # continue 2598 2608 cartAtoms.append(atom[:cx+3]) 2599 2609 cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3]) … … 2607 2617 Boxes[box[0],box[1],box[2],0] += 1 2608 2618 Boxes[box[0],box[1],box[2],Boxes[box[0],box[1],box[2],0]] = ib 2619 #Box content checks with errat.f ibox1 array 2609 2620 indices = (-1,0,1) 2610 2621 Units = np.array([[h,k,l] for h in indices for k in indices for l in indices]) 2611 2622 dsmax = 3.75**2 2623 if old: 2624 dsmax = 3.5**2 2612 2625 chains = [] 2613 2626 resIntAct = [] … … 2631 2644 newChain = True 2632 2645 if atom[0] not in res: #new residue, get residue no. 2646 if len(res): print res[-1],resname[-1],intact 2633 2647 res.append(atom[0]) 2634 2648 resname.append('%s-%s%s'%(atom[2],atom[0],atom[1])) … … 2645 2659 tgts = list(set(tgts)) 2646 2660 tgts = [tgt for tgt in tgts if atom[1:3] != cartAtoms[tgt][1:3]] #exclude same residue 2647 tgts = [tgt for tgt in tgts if cartAtoms[tgt][3].strip() not in ['C','N']] #exclude main chain 2661 if atom[3].strip() in ['C',]: 2662 tgts = [tgt for tgt in tgts if cartAtoms[tgt][3].strip() not in ['N',]] #exclude main chain C-N 2663 if atom[3].strip() in ['N',]: 2664 tgts = [tgt for tgt in tgts if cartAtoms[tgt][3].strip() not in ['C',]] #exclude main chain N-C 2648 2665 tgts = [tgt for tgt in tgts if np.sum((XYZ[ia]-XYZ[tgt])**2) <= dsmax] 2649 2666 for tgt in tgts: 2650 2667 dsqt = np.sqrt(np.sum((XYZ[ia]-XYZ[tgt])**2)) 2651 2668 mult = 1.0 2652 if dsqt > 3.25 :2669 if dsqt > 3.25 and not old: 2653 2670 mult = 2.*(3.75-dsqt) 2654 2671 intype = atom[4].strip()+cartAtoms[tgt][4].strip() … … 2663 2680 Probs = [0.,0.,0.,0.] 2664 2681 for i in range(4,nRes-4): 2665 mtrx = np.zeros(6) 2682 print i,IntAct[i] 2683 mtrx = np.zeros(5) 2666 2684 summ = 0. 2667 for j in range(i-4,i+ 4):2685 for j in range(i-4,i+5): 2668 2686 summ += np.sum(np.array(IntAct[j].values())) 2669 print 'CC',IntAct[j]['CC'],'CN',IntAct[j]['CN'],'CO',IntAct[j]['CO'] 2670 print 'NN',IntAct[j]['NN'],'NO',IntAct[j]['NO'],'OO',IntAct[j]['OO'] 2671 mtrx[1] += IntAct[j]['CC'] 2672 mtrx[2] += IntAct[j]['CN'] 2673 mtrx[3] += IntAct[j]['CO'] 2674 mtrx[4] += IntAct[j]['NN'] 2675 mtrx[5] += IntAct[j]['NO'] 2687 if old: 2688 mtrx[0] += IntAct[j]['CC'] 2689 mtrx[1] += IntAct[j]['CO'] 2690 mtrx[2] += IntAct[j]['NN'] 2691 mtrx[3] += IntAct[j]['NO'] 2692 mtrx[4] += IntAct[j]['OO'] 2693 else: 2694 mtrx[0] += IntAct[j]['CC'] 2695 mtrx[1] += IntAct[j]['CN'] 2696 mtrx[2] += IntAct[j]['CO'] 2697 mtrx[3] += IntAct[j]['NN'] 2698 mtrx[4] += IntAct[j]['NO'] 2699 print mtrx,np.sum(mtrx) 2700 print summ 2676 2701 mtrx /= summ 2677 mtrx -= avg 2678 prob = np.inner(np.inner(mtrx,b1),mtrx)/36. 2702 if old: 2703 mtrx -= avg_old 2704 prob = np.inner(np.inner(mtrx,b1_old),mtrx) 2705 else: 2706 mtrx -= avg 2707 prob = np.inner(np.inner(mtrx,b1),mtrx) 2679 2708 print i, mtrx 2680 2709 Probs.append(prob) -
trunk/GSASIIplot.py
r3000 r3003 70 70 # GSASIIpath.IPyBreak() 71 71 plotDebug = False 72 72 #matplotlib 2.0.x dumbed down Paired to 16 colors - 73 # this restores the pre 2.0 Paired color map found in matplotlib._cm.py 74 _Old_Paired_data = {'blue': [(0.0, 0.89019608497619629, 75 0.89019608497619629), (0.090909090909090912, 0.70588237047195435, 76 0.70588237047195435), (0.18181818181818182, 0.54117649793624878, 77 0.54117649793624878), (0.27272727272727271, 0.17254902422428131, 78 0.17254902422428131), (0.36363636363636365, 0.60000002384185791, 79 0.60000002384185791), (0.45454545454545453, 0.10980392247438431, 80 0.10980392247438431), (0.54545454545454541, 0.43529412150382996, 81 0.43529412150382996), (0.63636363636363635, 0.0, 0.0), 82 (0.72727272727272729, 0.83921569585800171, 0.83921569585800171), 83 (0.81818181818181823, 0.60392159223556519, 0.60392159223556519), 84 (0.90909090909090906, 0.60000002384185791, 0.60000002384185791), (1.0, 85 0.15686275064945221, 0.15686275064945221)], 86 87 'green': [(0.0, 0.80784314870834351, 0.80784314870834351), 88 (0.090909090909090912, 0.47058823704719543, 0.47058823704719543), 89 (0.18181818181818182, 0.87450981140136719, 0.87450981140136719), 90 (0.27272727272727271, 0.62745100259780884, 0.62745100259780884), 91 (0.36363636363636365, 0.60392159223556519, 0.60392159223556519), 92 (0.45454545454545453, 0.10196078568696976, 0.10196078568696976), 93 (0.54545454545454541, 0.74901962280273438, 0.74901962280273438), 94 (0.63636363636363635, 0.49803921580314636, 0.49803921580314636), 95 (0.72727272727272729, 0.69803923368453979, 0.69803923368453979), 96 (0.81818181818181823, 0.23921568691730499, 0.23921568691730499), 97 (0.90909090909090906, 1.0, 1.0), (1.0, 0.3490196168422699, 98 0.3490196168422699)], 99 100 'red': [(0.0, 0.65098041296005249, 0.65098041296005249), 101 (0.090909090909090912, 0.12156862765550613, 0.12156862765550613), 102 (0.18181818181818182, 0.69803923368453979, 0.69803923368453979), 103 (0.27272727272727271, 0.20000000298023224, 0.20000000298023224), 104 (0.36363636363636365, 0.9843137264251709, 0.9843137264251709), 105 (0.45454545454545453, 0.89019608497619629, 0.89019608497619629), 106 (0.54545454545454541, 0.99215686321258545, 0.99215686321258545), 107 (0.63636363636363635, 1.0, 1.0), (0.72727272727272729, 108 0.7921568751335144, 0.7921568751335144), (0.81818181818181823, 109 0.41568627953529358, 0.41568627953529358), (0.90909090909090906, 110 1.0, 1.0), (1.0, 0.69411766529083252, 0.69411766529083252)]} 111 mpl.cm.register_cmap('Paired',data=_Old_Paired_data,lut=128) 112 mpl.cm.register_cmap('Paired_r',data=mpl.cm._reverse_cmap_spec(_Old_Paired_data),lut=128) 113 #This can be done on request for other colors 114 73 115 class _tabPlotWin(wx.Panel): 74 116 'Creates a basic tabbed plot window for GSAS-II graphics' … … 3111 3153 Plot.set_xlabel(r'Error score',fontsize=14) 3112 3154 Plot.set_ylabel(r'Residue',fontsize=14) 3113 colors=['b','r','g','c','m','k'] 3114 Plot.barh(np.arange(len(resNames)),Probs,tick_label=resNames,) 3155 try: 3156 Plot.barh(np.arange(len(resNames)),Probs,tick_label=resNames,) 3157 except AttributeError: #tick_label not in mpl 1.4 3158 Plot.barh(np.arange(len(resNames)),Probs) 3115 3159 if thresh is not None: 3116 3160 for item in thresh: … … 3126 3170 else: 3127 3171 Page.canvas.draw() 3128 3129 3172 3130 3173 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl')
Note: See TracChangeset
for help on using the changeset viewer.