Changeset 526
 Timestamp:
 Apr 2, 2012 2:30:28 PM (10 years ago)
 Location:
 trunk
 Files:

 8 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASII.py
r524 r526 1064 1064 sub = self.PatternTree.AppendItem(parent=sub,text=PhaseName) 1065 1065 E,SGData = G2spc.SpcGroup('P 1') 1066 self.PatternTree.SetItemPyData(sub, { 1067 'General':{ 1068 'Name':PhaseName, 1069 'Type':'nuclear', 1070 'SGData':SGData, 1071 'Cell':[False,10.,10.,10.,90.,90.,90,1000.], 1072 'Pawley dmin':1.0, 1073 'Data plot type':'Mustrain', 1074 'SH Texture':{ 1075 'Order':0, 1076 'Model':'cylindrical', 1077 'Sample omega':[False,0.0], 1078 'Sample chi':[False,0.0], 1079 'Sample phi':[False,0.0], 1080 'SH Coeff':[False,{}], 1081 'SHShow':False, 1082 'PFhkl':[0,0,1], 1083 'PFxyz':[0,0,1], 1084 'PlotType':'Pole figure'}}, 1085 'Atoms':[], 1086 'Drawing':{}, 1087 'Histograms':{}, 1088 'Pawley ref':[], 1089 'Models':{}, 1090 }) 1066 self.PatternTree.SetItemPyData(sub,G2IO.SetNewPhase(Name=PhaseName,SGData=SGData)) 1091 1067 1092 1068 def OnDeletePhase(self,event): 
trunk/GSASIIIO.py
r502 r526 1035 1035 print 'index peak list saved' 1036 1036 1037 def SetNewPhase(Name='New Phase',SGData=G2spc.SpcGroup('P 1')[1],cell=[1.0,1.0,1.0,90.,90,90.,1.]): 1038 phaseData = { 1039 'General':{ 1040 'Name':Name, 1041 'Type':'nuclear', 1042 'SGData':SGData, 1043 'Cell':[False,]+cell, 1044 'Pawley dmin':1.0, 1045 'Data plot type':'Mustrain', 1046 'SH Texture':{ 1047 'Order':0, 1048 'Model':'cylindrical', 1049 'Sample omega':[False,0.0], 1050 'Sample chi':[False,0.0], 1051 'Sample phi':[False,0.0], 1052 'SH Coeff':[False,{}], 1053 'SHShow':False, 1054 'PFhkl':[0,0,1], 1055 'PFxyz':[0,0,1], 1056 'PlotType':'Pole figure'}}, 1057 'Atoms':[], 1058 'Drawing':{}, 1059 'Histograms':{}, 1060 'Pawley ref':[], 1061 'Models':{}, 1062 } 1063 return phaseData 1064 1037 1065 def ReadEXPPhase(G2frame,filename): 1038 1066 shModels = ['cylindrical','none','shear  2/m','rolling  mmm'] … … 1150 1178 textureData['SH Coeff'] = [False,shCoef] 1151 1179 1152 Phase = { 1153 'General':{ 1154 'Name':PhaseName, 1155 'Type':Ptype, 1156 'SGData':SGData, 1157 'Cell':[False,]+abc+angles+[Volume,], 1158 'Pawley dmin':1.0, 1159 'SH Texture':textureData}, 1160 'Atoms':Atoms, 1161 'Drawing':{}, 1162 'Histograms':{}, 1163 'Pawley ref':[], 1164 'Models':{}, 1165 } 1180 Phase = SetNewPhase(Name=PhaseName,SGData=SGData,cell=abc+angles+[Volume,]) 1181 general = Phase['General'] 1182 general['Type'] = Ptype 1183 general['SH Texture'] = textureData 1184 Phase['Atoms'] = Atoms 1166 1185 return Phase 1167 1186 … … 1241 1260 else: 1242 1261 PhaseName = 'None' 1243 Phase ['General'] = {'Name':PhaseName,'Type':'macromolecular','SGData':SGData,1244 'Cell':[False,]+cell+[Volume,]}1262 Phase = SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell+[Volume,]) 1263 Phase['General']['Type'] = 'macromolecular' 1245 1264 Phase['Atoms'] = Atoms 1246 Phase['Drawing'] = {}1247 Phase['Histograms'] = {}1248 1265 1249 1266 return Phase … … 1277 1294 self.strictExtension = strictExtension 1278 1295 # define a default Phase structure 1279 self.Phase = {} 1280 for i in 'General', 'Atoms', 'Drawing', 'Histograms': 1281 self.Phase[i] = {} 1282 self.Phase['General']['Name'] = 'default' 1283 self.Phase['General']['Type'] = 'nuclear' 1284 self.Phase['General']['SGData'] = SGData 1285 self.Phase['General']['Cell'] = [ 1286 False, # refinement flag 1287 1.,1.,1., # a,b,c 1288 90.,90.,90., # alpha, beta, gamma 1289 1. # volume 1290 ] 1296 self.Phase = SetNewPhase(Name='new phase',SGData=SGData) 1291 1297 self.warnings = '' 1292 1298 self.errors = '' 
trunk/GSASIIphsGUI.py
r522 r526 3469 3469 try: 3470 3470 mapData = generalData['Map'] 3471 contLevel = drawingData['contourLevel']*mapData['rhoMax']3472 rho = ma.array(mapData['rho'],mask=(mapData['rho']<contLevel))3471 contLevel = mapData['cutOff']*mapData['rhoMax']/100. 3472 rho = copy.copy(mapData['rho']) #don't mess up original 3473 3473 except KeyError: 3474 3474 print '**** ERROR  Fourier map not defined' 3475 3475 return 3476 indx = np.array(ma.nonzero(rho)).T 3477 steps = 1./np.array(rho.shape) 3478 rhoXYZ = indx*steps 3479 print rhoXYZ 3476 peaks = [] 3477 while True: 3478 rhoMask = ma.array(rho,mask=(mapData['rho']<contLevel)) 3479 indx = np.array(ma.nonzero(rhoMask)).T 3480 rhoList = np.array([rho[i,j,k] for i,j,k in indx]) 3481 rhoMax = np.max(rhoList) 3482 rMI = indx[np.argmax(rhoList)] 3483 print rMI,rhoMax 3484 break 3485 # steps = 1./np.array(rho.shape) 3486 # rhoXYZ = indx*steps 3480 3487 print 'search Fourier map' 3481 3488 
trunk/GSASIIplot.py
r523 r526 753 753 else: 754 754 Plot.plot(peak.T[1],pos,colors[pId%6]+'',mew=1,ms=8,picker=3.,label=phase) 755 handles,legends = Plot.get_legend_handles_labels() #got double entries in the legends for some reason 756 Plot.legend(handles[::2],legends[::2],title='Phases',loc='best') #skip every other one 755 if len(Phases): 756 handles,legends = Plot.get_legend_handles_labels() #got double entries in the legends for some reason 757 Plot.legend(handles[::2],legends[::2],title='Phases',loc='best') #skip every other one 757 758 758 759 if G2frame.Contour: … … 2731 2732 2732 2733 def Draw(): 2733 if 'Map' in generalData: 2734 mapData = generalData['Map'] 2735 rhoXYZ = [] 2736 if len(mapData['rho']): 2734 2737 VP = np.array(drawingData['viewPoint'][0])np.array([.5,.5,.5]) 2735 mapData = generalData['Map']2736 2738 contLevel = drawingData['contourLevel']*mapData['rhoMax'] 2737 2739 if 'deltF' in mapData['MapType']: … … 2739 2741 else: 2740 2742 rho = ma.array(mapData['rho'],mask=(mapData['rho']<contLevel)) 2741 if rho.size > 0: 2742 steps = 1./np.array(rho.shape) 2743 incre = np.where(VP>0,VP%steps,VP%stepssteps) 2744 Vsteps = np.array(VP/steps,dtype='i') 2745 rho = np.roll(np.roll(np.roll(rho,Vsteps[0],axis=0),Vsteps[1],axis=1),Vsteps[2],axis=2) 2746 indx = np.array(ma.nonzero(rho)).T 2747 rhoXYZ = indx*steps+VPincre 2748 Nc = len(rhoXYZ) 2749 rcube = 2000.*Vol/(ForthirdPI*Nc) 2750 rmax = math.exp(math.log(rcube)/3.)**2 2751 radius = min(drawingData['mapSize']**2,rmax) 2752 view = np.array(drawingData['viewPoint'][0]) 2753 Rok = np.sum(np.inner(Amat,rhoXYZview).T**2,axis=1)>radius 2754 else: 2755 rhoXYZ = [] 2743 steps = 1./np.array(rho.shape) 2744 incre = np.where(VP>0,VP%steps,VP%stepssteps) 2745 Vsteps = np.array(VP/steps,dtype='i') 2746 rho = np.roll(np.roll(np.roll(rho,Vsteps[0],axis=0),Vsteps[1],axis=1),Vsteps[2],axis=2) 2747 indx = np.array(ma.nonzero(rho)).T 2748 rhoXYZ = indx*steps+VPincre 2749 Nc = len(rhoXYZ) 2750 rcube = 2000.*Vol/(ForthirdPI*Nc) 2751 rmax = math.exp(math.log(rcube)/3.)**2 2752 radius = min(drawingData['mapSize']**2,rmax) 2753 view = np.array(drawingData['viewPoint'][0]) 2754 Rok = np.sum(np.inner(Amat,rhoXYZview).T**2,axis=1)>radius 2756 2755 Ind = GetSelectedAtoms() 2757 2756 VS = np.array(Page.canvas.GetSize()) 
trunk/GSASIIpwdGUI.py
r519 r526 16 16 import GSASIIpath 17 17 import GSASIIpwd as G2pwd 18 import GSASIIIO as G2IO 18 19 import GSASIIlattice as G2lat 19 20 import GSASIIspc as G2spc … … 1495 1496 E,SGData = G2spc.SpcGroup(spaceGroups[cell[0]]) 1496 1497 G2frame.PatternTree.SetItemPyData(sub, \ 1497 {'General':{'Name':PhaseName,'Type':'nuclear','SGData':SGData, 1498 'Cell':[False,]+cell[1:], 1499 'Pawley dmin':1.00},'Atoms':[],'Drawing':{},'Histograms':{}}) 1498 G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell[1:])) 1500 1499 Status.SetStatusText('Change space group if needed') 1501 1500 finally:
Note: See TracChangeset
for help on using the changeset viewer.