Changeset 1601
- Timestamp:
- Dec 9, 2014 3:46:07 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r1594 r1601 655 655 Super = generalData.get('Super',0) 656 656 SuperVec = [] 657 for i in range(Super): 658 SuperVec.append(generalData['SuperVec'][i][0]) 659 SuperVec = np.array(SuperVec) 657 if Super: 658 SuperVec = np.array(generalData['SuperVec'][0]) 660 659 UseList = data['Histograms'] 661 660 NShkl = len(G2spc.MustrainNames(SGData)) … … 671 670 for iref,ref in enumerate(reflData['RefList']): 672 671 hkl = ref[:3] 673 H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0)) 672 if Super: 673 H = list(hkl+SuperVec*ref[3]) 674 else: 675 H = hkl 674 676 ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G)) 675 677 iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData) … … 799 801 Super = generalData.get('Super',0) 800 802 SuperVec = [] 801 for i in range(Super): 802 SuperVec.append(generalData['SuperVec'][i][0]) 803 SuperVec = np.array(SuperVec) 803 if Super: 804 SuperVec = np.array(generalData['SuperVec'][0]) 804 805 UseList = data['Histograms'] 805 806 for histoName in newHistList: … … 811 812 for iref,ref in enumerate(reflData['RefList']): 812 813 hkl = ref[:3] 813 H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0)) 814 if Super: 815 H = list(hkl+SuperVec*ref[3]) 816 else: 817 H = hkl 814 818 ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G)) 815 819 iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData) -
trunk/GSASIIgrid.py
r1590 r1601 67 67 wxID_CHARGEFLIP, wxID_PEAKSUNIQUE, wxID_PEAKSDELETE, wxID_PEAKSDA, 68 68 wxID_PEAKSDISTVP, wxID_PEAKSVIEWPT, wxID_FINDEQVPEAKS,wxID_SHOWBONDS,wxID_MULTIMCSA, 69 wxID_SINGLEMCSA 70 ] = [wx.NewId() for item in range(1 5)]69 wxID_SINGLEMCSA, wxID_4DMAPCOMPUTE, 70 ] = [wx.NewId() for item in range(16)] 71 71 72 72 [ wxID_PWDRADD, wxID_HKLFADD, wxID_PWDANALYSIS, wxID_PWDCOPY, wxID_DATADELETE, … … 3656 3656 self.PrefillDataMenu(self.WavesData,helpType='Wave Data', helpLbl='Imcommensurate wave data') 3657 3657 self.WavesData.Append(menu=wx.Menu(title=''),title='Select tab') 3658 self.WavesDataCompute = wx.Menu(title='') 3659 self.WavesData.Append(menu=self.WavesDataCompute,title='Compute') 3660 self.WavesDataCompute.Append(id=wxID_4DMAPCOMPUTE, kind=wx.ITEM_NORMAL,text='Compute 4D map', 3661 help='Compute 4-dimensional map') 3658 3662 self.PostfillDataMenu() 3659 3663 -
trunk/GSASIImath.py
r1598 r1601 1525 1525 mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho'])) 1526 1526 print 'Omit map time: %.4f'%(time.time()-time0),'no. elements: %d'%(Fhkl.size) 1527 return mapData 1528 1529 def Fourier4DMap(data,reflDict): 1530 '''default doc string 1531 1532 :param type name: description 1533 1534 :returns: type name: description 1535 1536 ''' 1537 generalData = data['General'] 1538 if not generalData['4DmapData']['RefList']: 1539 print '**** ERROR - 4D Fourier map data not defined' 1540 return 1541 mapData = generalData['4DmapData'] 1542 dmin = mapData['Resolution'] 1543 SGData = generalData['SGData'] 1544 SSGData = generalData['SSGData'] 1545 SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']]) 1546 SSGT = np.array([ops[1] for ops in SSGData['SSGOps']]) 1547 cell = generalData['Cell'][1:8] 1548 A = G2lat.cell2A(cell[:6]) 1549 maxM = generalData['SuperVec'][2] 1550 Hmax = G2lat.getHKLmax(dmin,SGData,A)+[maxM,] 1551 adjHKLmax(SGData,Hmax) 1552 Hmax = np.asarray(Hmax,dtype='i')+1 1553 Fhkl = np.zeros(shape=2*Hmax,dtype='c16') 1554 time0 = time.time() 1555 for iref,ref in enumerate(reflDict['RefList']): 1556 if ref[5] >= dmin: 1557 Fosq,Fcsq,ph = ref[9:12] 1558 Uniq = np.inner(ref[:4],SSGMT) 1559 Phi = np.inner(ref[:4],SSGT) 1560 for i,hkl in enumerate(Uniq): #uses uniq 1561 hkl = np.asarray(hkl,dtype='i') 1562 dp = 360.*Phi[i] #and phi 1563 a = cosd(ph+dp) 1564 b = sind(ph+dp) 1565 phasep = complex(a,b) 1566 phasem = complex(a,-b) 1567 if 'Fobs' in mapData['MapType']: 1568 F = np.where(Fosq>0.,np.sqrt(Fosq),0.) 1569 h,k,l,m = hkl+Hmax 1570 Fhkl[h,k,l,m] = F*phasep 1571 h,k,l,m = -hkl+Hmax 1572 Fhkl[h,k,l,m] = F*phasem 1573 elif 'delt-F' in mapData['MapType']: 1574 dF = np.where(Fosq>0.,np.sqrt(Fosq),0.)-np.sqrt(Fcsq) 1575 h,k,l,m = hkl+Hmax 1576 Fhkl[h,k,l,m] = dF*phasep 1577 h,k,l,m = -hkl+Hmax 1578 Fhkl[h,k,l,m] = dF*phasem 1579 rho = fft.fftn(fft.fftshift(Fhkl))/cell[6] 1580 print 'Fourier map time: %.4f'%(time.time()-time0),'no. elements: %d'%(Fhkl.size) 1581 mapData['rho'] = np.real(rho) 1582 mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho'])) 1527 1583 return mapData 1528 1584 -
trunk/GSASIIphsGUI.py
r1599 r1601 129 129 if generalData['Type'] =='macromolecular': 130 130 generalData['AtomPtrs'] = [6,4,10,12] 131 if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData: 132 generalData['Super'] = 1 133 generalData['SuperVec'] = [[0,0,.1],False,4] 134 generalData['SSGData'] = {} 131 if generalData['Type'] in ['modulated','magnetic',]: 132 if 'Super' not in generalData: 133 generalData['Super'] = 1 134 generalData['SuperVec'] = [[0,0,.1],False,4] 135 generalData['SSGData'] = {} 136 if '4DmapData' not in generalData: 137 generalData['4DmapData'] = mapDefault 138 generalData['4DmapData'].update({'MapType':'Fobs'}) 135 139 # end of patches 136 140 cx,ct,cs,cia = generalData['AtomPtrs'] … … 1965 1969 atom[-1][SS]['waveType']=waveType.GetValue() 1966 1970 1971 def OnShowWave(event): 1972 mapBtn.SetValue(False) 1973 G2plt.ModulationPlot(G2frame,data,atom) 1974 1967 1975 atomSizer = wx.BoxSizer(wx.HORIZONTAL) 1968 1976 atomSizer.Add(wx.StaticText(waveData,label=' Modulation data for atom: '+atom[0]+' WaveType: '),0,WACV) … … 1971 1979 waveType.Bind(wx.EVT_COMBOBOX,OnWaveType) 1972 1980 atomSizer.Add(waveType,0,WACV) 1981 mapBtn = wx.CheckBox(waveData,label='Show contour map?') 1982 mapBtn.Bind(wx.EVT_CHECKBOX, OnShowWave) 1983 Indx[mapBtn.GetId()] = atom 1984 atomSizer.Add(mapBtn,0,WACV) 1973 1985 return atomSizer 1974 1986 … … 2038 2050 return waveSizer 2039 2051 2052 def MapSizer(): 2053 2054 def OnRefList(event): 2055 Map['RefList'] = refList.GetValue() 2056 2057 def OnMapType(event): 2058 Map['MapType'] = mapType.GetValue() 2059 2060 Map = generalData['4DmapData'] 2061 refList = data['Histograms'].keys() 2062 mapSizer = wx.BoxSizer(wx.HORIZONTAL) 2063 mapSizer.Add(wx.StaticText(waveData,label=' 4D map data: Reflection set from: '),0,WACV) 2064 refList = wx.ComboBox(waveData,-1,value=Map['RefList'],choices=refList, 2065 style=wx.CB_READONLY|wx.CB_DROPDOWN) 2066 refList.Bind(wx.EVT_COMBOBOX,OnRefList) 2067 mapSizer.Add(refList,0,WACV) 2068 mapTypes = ['Fobs','delt-F'] 2069 mapSizer.Add(wx.StaticText(waveData,label=' Map type: '),0,WACV) 2070 mapType = wx.ComboBox(waveData,-1,value=Map['MapType'],choices=mapTypes, 2071 style=wx.CB_READONLY|wx.CB_DROPDOWN) 2072 mapType.Bind(wx.EVT_COMBOBOX,OnMapType) 2073 mapSizer.Add(mapType,0,WACV) 2074 return mapSizer 2075 2040 2076 Indx = {} 2041 2077 G2frame.dataFrame.SetStatusText('') … … 2057 2093 mainSizer.Add(wx.StaticText(waveData,label=' Incommensurate propagation wave data:'),0,WACV) 2058 2094 if generalData['Type'] in ['modulated','magnetic']: 2095 mainSizer.Add(MapSizer(),0,WACV) 2059 2096 for iatm,atom in enumerate(atomData): 2060 for SS in ['SS1',]: #future SS2 & SS3 2097 for SS in ['SS1',]: #future SS2 & SS3 - I doubt it! 2061 2098 G2gd.HorizontalLine(mainSizer,waveData) 2062 2099 mainSizer.Add(AtomSizer(SS,atom)) … … 2068 2105 SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer) 2069 2106 2107 def On4DMapCompute(event): 2108 generalData = data['General'] 2109 mapData = generalData['4DmapData'] 2110 reflName = mapData['RefList'] 2111 if not reflName: 2112 G2frame.ErrorDialog('Fourier map','No reflections defined for Fourier map') 2113 return 2114 phaseName = generalData['Name'] 2115 if 'PWDR' in reflName: 2116 PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, reflName) 2117 reflSets = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists')) 2118 reflData = reflSets[phaseName] 2119 elif 'HKLF' in reflName: 2120 PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, reflName) 2121 reflData = G2frame.PatternTree.GetItemPyData(PatternId)[1] 2122 mapData.update(G2mth.Fourier4DMap(data,reflData)) 2123 mapSig = np.std(mapData['rho']) 2124 print mapData['MapType']+' computed: rhomax = %.3f rhomin = %.3f sigma = %.3f'%(np.max(mapData['rho']),np.min(mapData['rho']),mapSig) 2125 2070 2126 ################################################################################ 2071 2127 #Structure drawing GUI stuff … … 5632 5688 if data['General']['Type'] in ['modulated','magnetic']: 5633 5689 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.WavesData) 5690 G2frame.dataFrame.Bind(wx.EVT_MENU, On4DMapCompute, id=G2gd.wxID_4DMAPCOMPUTE) 5634 5691 # Draw Options 5635 5692 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.DataDrawOptions) -
trunk/GSASIIplot.py
r1599 r1601 526 526 ################################################################################ 527 527 528 def Plot3DSngl(G2frame,newPlot=False,Data=None,hklRef=None,Title=' '):528 def Plot3DSngl(G2frame,newPlot=False,Data=None,hklRef=None,Title='no phase'): 529 529 '''3D Structure factor plotting package - displays reflections as rings proportional 530 530 to F, F**2, etc. as requested as 3D array … … 2766 2766 2767 2767 ################################################################################ 2768 ##### 2769 ################################################################################ 2770 2771 def ModulationPlot(G2frame,data,atom): 2772 2773 print 'modulation plot for',atom[0] 2774 try: 2775 plotNum = G2frame.G2plotNB.plotList.index('Modulation') 2776 Page = G2frame.G2plotNB.nb.GetPage(plotNum) 2777 Page.figure.clf() 2778 Plot = Page.figure.gca() 2779 if not Page.IsShown(): 2780 Page.Show() 2781 except ValueError: 2782 Plot = G2frame.G2plotNB.addMpl('Modulation').gca() 2783 plotNum = G2frame.G2plotNB.plotList.index('Modulation') 2784 Page = G2frame.G2plotNB.nb.GetPage(plotNum) 2785 # Page.canvas.mpl_connect('motion_notify_event', OnMotion) 2786 2787 2788 ################################################################################ 2768 2789 ##### PlotCovariance 2769 2790 ################################################################################ -
trunk/imports/G2phase.py
r1599 r1601 406 406 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry") 407 407 SpGrp = S.split()[1] 408 SuperSg = '' 408 409 if '(' in SpGrp: #supercell symmetry - split in 2 409 410 SuperStr = SpGrp.split('(') … … 411 412 SuperSg = '('+SuperStr[1] 412 413 SpGrpNorm = G2spc.StandardizeSpcName(SpGrp) 413 E,SGData = G2spc.SpcGroup(SpGrp )414 E,SGData = G2spc.SpcGroup(SpGrpNorm) 414 415 # space group processing failed, try to look up name in table 415 416 while E: … … 533 534 Phase['General']['SuperVec'] = SuperVec 534 535 Phase['General']['SuperSg'] = SuperSg 536 if SuperSg: 537 Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1] 535 538 Phase['General']['AtomPtrs'] = [3,1,7,9] 536 539 Phase['Atoms'] = Atoms -
trunk/imports/G2sfact_CIF.py
r1453 r1601 41 41 If multiple datasets are requested, use self.repeat and buffer caching. 42 42 ''' 43 hklitems = [('_refln_index_h','_refln_index_k','_refln_index_l' ),44 ('_refln.index_h','_refln.index_k','_refln.index_l' )]43 hklitems = [('_refln_index_h','_refln_index_k','_refln_index_l','_refln_index_m_1'), 44 ('_refln.index_h','_refln.index_k','_refln.index_l','_refln.index_m_1')] 45 45 cellitems = [ 46 46 ('_cell_length_a','_cell_length_b','_cell_length_c', … … 111 111 gotFo = False 112 112 gotFo2 = False 113 im = 0 113 114 for i in range(2): 114 115 if hklitems[i][0] in blkkeys and hklitems[i][1] in blkkeys and hklitems[i][2] in blkkeys: 115 116 dnIndex = i 117 if hklitems[i][3] in blkkeys: #Super lattice reflections h,k,l,m 118 im = 1 116 119 break 117 120 else: … … 262 265 HKL.append('.') 263 266 #h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,Ext 264 ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0] 267 if im: 268 ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0,0] 269 else: 270 ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0] 265 271 if F2dn: 266 272 F2 = item[itemkeys[F2dn]] … … 298 304 pass 299 305 300 ref[8 ] = F2301 ref[5 ] = F2302 ref[6 ] = sigF2303 ref[9 ] = F2c304 ref[7 ] = F2c306 ref[8+im] = F2 307 ref[5+im] = F2 308 ref[6+im] = sigF2 309 ref[9+im] = F2c 310 ref[7+im] = F2c 305 311 try: 306 312 if Phdn: 307 ref[10 ] = float(item[itemkeys[Phdn]])313 ref[10+im] = float(item[itemkeys[Phdn]]) 308 314 except: 309 315 pass … … 321 327 Type = 'SNC' 322 328 else: 323 type = 'SXC'329 Type = 'SXC' 324 330 self.RefDict['Type'] = Type 331 self.RefDict['Super'] = im 325 332 if blk.get('_diffrn_radiation_wavelength'): 326 333 wave = float(blk['_diffrn_radiation_wavelength'])
Note: See TracChangeset
for help on using the changeset viewer.