Changeset 1910
- Timestamp:
- Jun 26, 2015 2:13:27 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r1909 r1910 833 833 UseList[histoName] = SetDefaultDData(reflData['Type'],histoName) 834 834 G,g = G2lat.cell2Gmat(generalData['Cell'][1:7]) 835 UseList[histoName]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],] 836 for iT in range(reflData['TwMax']): 837 UseList[histoName]['Twins'].append([[],0.0]) 835 838 for iref,ref in enumerate(reflData['RefList']): 836 839 hkl = ref[:3] -
trunk/GSASIIddataGUI.py
r1906 r1910 844 844 twinMat,twinVal = Twin 845 845 matSizer = wx.BoxSizer(wx.HORIZONTAL) 846 matSizer.Add(wx.StaticText(DData,-1,' Twin Law: '),0,WACV)847 846 if it: 848 847 Style = wx.TE_PROCESS_ENTER … … 851 850 Style = wx.TE_READONLY 852 851 TwVal = Twin[1][0] 853 for im,Mat in enumerate(twinMat): 854 mat = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(Mat[0],Mat[1],Mat[2]), 855 style=Style) 856 if it: 857 Indx[mat.GetId()] = [it,im] 858 mat.Bind(wx.EVT_TEXT_ENTER,OnMat) 859 mat.Bind(wx.EVT_KILL_FOCUS,OnMat) 860 else: 861 mat.SetBackgroundColour(VERY_LIGHT_GREY) 862 matSizer.Add(mat,0,WACV|wx.LEFT,5) 852 if len(Twin[0]): 853 matSizer.Add(wx.StaticText(DData,-1,' Twin Law: '),0,WACV) 854 for im,Mat in enumerate(twinMat): 855 mat = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(Mat[0],Mat[1],Mat[2]), 856 style=Style) 857 if it: 858 Indx[mat.GetId()] = [it,im] 859 mat.Bind(wx.EVT_TEXT_ENTER,OnMat) 860 mat.Bind(wx.EVT_KILL_FOCUS,OnMat) 861 else: 862 mat.SetBackgroundColour(VERY_LIGHT_GREY) 863 matSizer.Add(mat,0,WACV|wx.LEFT,5) 864 else: 865 matSizer.Add(wx.StaticText(DData,-1,' Nonmerohedral twin component %d:'%(it)),0,WACV) 863 866 twinsizer.Add(matSizer,0,WACV|wx.LEFT,5) 864 867 valSizer = wx.BoxSizer(wx.HORIZONTAL) … … 872 875 twinval.SetBackgroundColour(VERY_LIGHT_GREY) 873 876 valSizer.Add(twinval,0,WACV) 874 if it :877 if it and len(Twin[0]): 875 878 twindel = wx.CheckBox(DData,wx.ID_ANY,label=' Delete?') 876 879 Indx[twindel.GetId()] = it 877 880 twindel.Bind(wx.EVT_CHECKBOX, OnTwinDel) 878 881 valSizer.Add(twindel,0,WACV) 879 el se:882 elif not it: 880 883 twinref = wx.CheckBox(DData,wx.ID_ANY,label=' Refine?') 881 884 twinref.SetValue(Twin[1][1]) -
trunk/GSASIIstrIO.py
r1897 r1910 2265 2265 controlDict[pfx+'TwinLaw'] = [] 2266 2266 for it,twin in enumerate(Twins): 2267 controlDict[pfx+'TwinLaw'].append(twin[0]) 2267 if len(twin[0]): 2268 controlDict[pfx+'TwinLaw'].append(twin[0]) 2269 else: 2270 controlDict[pfx+'TwinLaw'].append(np.zeros((3,3))) 2268 2271 if it: 2269 2272 hapDict[pfx+'TwinFr:'+str(it)] = twin[1] … … 2293 2296 if len(Twins) > 1: 2294 2297 for it,twin in enumerate(Twins): 2295 print >>pFile,' Twin law: %s'%(str(twin[0]).replace('\n',',')),' Twin fr.: %5.3f Refine? '%(hapDict[pfx+'TwinFr:'+str(it)]),Twins[0][1][1] 2298 if len(twin[0]): 2299 print >>pFile,' Twin law: %s'%(str(twin[0]).replace('\n',',')),' Twin fr.: %5.3f Refine? '%(hapDict[pfx+'TwinFr:'+str(it)]),Twins[0][1][1] 2300 else: 2301 print >>pFile,' Nonmerohedral twin fr.: %5.3f Refine? '%(hapDict[pfx+'TwinFr:'+str(it)]),Twins[0][1][1] 2296 2302 2297 2303 Histogram['Reflection Lists'] = phase -
trunk/GSASIIstrMath.py
r1902 r1910 819 819 Flack = 1.-2.*parmDict[phfx+'Flack'] 820 820 TwinLaw = np.array([[[1,0,0],[0,1,0],[0,0,1]],]) 821 TwinDict = refDict.get('TwinDict',{}) 821 822 if 'S' in calcControls[hfx+'histType']: 822 823 TwinLaw = calcControls[phfx+'TwinLaw'] … … 847 848 refDict['FF']['FF'][iref] *= dat.values() 848 849 #reflection processing begins here - big arrays! 849 iBeg = 0 850 iBeg = 0 850 851 while iBeg < nRef: 851 852 iFin = min(iBeg+blkSize,nRef) -
trunk/imports/G2sfact.py
r1909 r1910 110 110 self.errors = ' Error reading line '+str(line+1) 111 111 if S[0] == '#': continue #ignore comments, if any 112 h,k,l,Fo,sigFo = S .split()[:5]112 h,k,l,Fo,sigFo = S[:4],S[4:8],S[8:12],S[12:20],S[20:28] 113 113 h,k,l = [int(h),int(k),int(l)] 114 114 if not any([h,k,l]): … … 132 132 return False 133 133 134 class SHELX5_ReaderClass(G2IO.ImportStructFactor): 135 'Routines to import F**2, sig(F**2) twin/incommensurate reflections from a fixed format SHELX HKLF5 file' 136 def __init__(self): 137 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus 138 formatName = 'SHELX HKLF 5 F2 Tw/Incom' 139 longFormatName = 'SHELX HKLF 5 [hklm, Fo2, sig(Fo2), Tind] Twin/incommensurate structure factor text file' 140 else: 141 formatName = u'SHELX HKLF 5 F\u00b2 Tw/Incom' 142 longFormatName = u'SHELX HKLF 5 [hklm, Fo\u00b2, sig(Fo\u00b2), Tind] Twin/incommensurate structure factor text file' 143 super(self.__class__,self).__init__( # fancy way to self-reference 144 extensionlist=('.hkl','.HKL'), 145 strictExtension=False, 146 formatName=formatName, 147 longFormatName=longFormatName) 148 self.Super = 0 149 150 def ContentsValidator(self, filepointer): 151 'Discover how many characters are in the SHELX file - could be 32-44 depending on satellites' 152 numCols = 0 153 for i,line in enumerate(filepointer): 154 numCols = max(numCols,len(line.split())) 155 if i > 20: 156 break 157 self.Super = numCols-6 #= 0,1,2,or 3 158 if self.Super > 1: 159 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry") 160 return True #ColumnValidator(self, filepointer) 161 162 def Reader(self,filename,filepointer, ParentFrame=None, **unused): 163 'Read the file' 164 TwDict = {} 165 TwSet = {} 166 TwMax = 0 167 try: 168 for line,S in enumerate(filepointer): 169 self.errors = ' Error reading line '+str(line+1) 170 if self.Super == 0: 171 h,k,l,Fo,sigFo,Tw = S[:4],S[4:8],S[8:12],S[12:20],S[20:28],S[28:32] 172 h,k,l = [int(h),int(k),int(l)] 173 elif self.Super == 1: 174 h,k,l,m1,Fo,sigFo,Tw = S[:4],S[4:8],S[8:12],S[12:16],S[16:24],S[24:32],S[32:36] 175 h,k,l,m1 = [int(h),int(k),int(l),int(m1)] 176 Tw = Tw.strip() 177 if not any([h,k,l]): 178 break 179 if Tw not in ['','0','1']: 180 TwId = -int(Tw)-1 181 TwMax = max(TwMax,TwId) 182 TwSet[TwId] = [h,k,l] 183 else: 184 if TwSet: 185 TwDict[len(self.RefDict['RefList'])] = TwSet 186 TwSet = {} 187 Fo = float(Fo) 188 sigFo = float(sigFo) 189 # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,... 190 if self.Super == 0: 191 self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0]) 192 elif self.Super == 1: 193 self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0]) 194 self.errors = 'Error after reading reflections (unexpected!)' 195 self.RefDict['RefList'] = np.array(self.RefDict['RefList']) 196 self.RefDict['Type'] = 'SXC' 197 self.RefDict['Super'] = self.Super 198 self.RefDict['TwDict'] = TwDict 199 self.RefDict['TwMax'] = TwMax 200 self.UpdateParameters(Type='SXC',Wave=None) # histogram type 201 return True 202 except Exception as detail: 203 self.errors += '\n '+str(detail) 204 print '\n\n'+self.formatName+' read error: '+str(detail) # for testing 205 import traceback 206 traceback.print_exc(file=sys.stdout) 207 return False 208 134 209 class M90_ReaderClass(G2IO.ImportStructFactor): 135 210 'Routines to import F**2, sig(F**2) reflections from a JANA M90 file' … … 204 279 return False 205 280 206 class SHELX5_ReaderClass(G2IO.ImportStructFactor):207 'Routines to import F**2, sig(F**2) twin index reflections from a fixed format SHELX HKLF5 file'208 def __init__(self):209 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus210 formatName = 'SHELX HKLF 5 F2'211 longFormatName = 'SHELX HKLF 5 [hklm, Fo2, sig(Fo2), Tind] Structure factor text file'212 else:213 formatName = u'SHELX HKLF 5 F\u00b2'214 longFormatName = u'SHELX HKLF 5 [hklm, Fo\u00b2, sig(Fo\u00b2), Tind] Structure factor text file'215 super(self.__class__,self).__init__( # fancy way to self-reference216 extensionlist=('.hkl','.HKL'),217 strictExtension=False,218 formatName=formatName,219 longFormatName=longFormatName)220 self.Super = 0221 222 def ContentsValidator(self, filepointer):223 'Discover how many characters are in the SHELX file - could be 32-44 depending on satellites'224 numCols = 0225 for i,line in enumerate(filepointer):226 numCols = max(numCols,len(line.split()))227 if i > 20:228 break229 self.Super = numCols-6 #= 0,1,2,or 3230 if self.Super > 1:231 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")232 return True #ColumnValidator(self, filepointer)233 234 def Reader(self,filename,filepointer, ParentFrame=None, **unused):235 'Read the file'236 try:237 for line,S in enumerate(filepointer):238 self.errors = ' Error reading line '+str(line+1)239 if self.Super == 0:240 h,k,l,Fo,sigFo,Tw = S[:4],S[4:8],S[8:12],S[12:20],S[20:28],S[28:32]241 h,k,l = [int(h),int(k),int(l)]242 elif self.Super == 1:243 h,k,l,m1,Fo,sigFo,Tw = S[:4],S[4:8],S[8:12],S[12:16],S[16:24],S[24:32],S[32:36]244 h,k,l,m1 = [int(h),int(k),int(l),int(m1)]245 if not any([h,k,l]):246 break247 Fo = float(Fo)248 sigFo = float(sigFo)249 # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...250 if self.Super == 0:251 self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0])252 elif self.Super == 1:253 self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0])254 #self.RefDict['FF'].append({}) # now done in OnImportSfact255 self.errors = 'Error after reading reflections (unexpected!)'256 self.RefDict['RefList'] = np.array(self.RefDict['RefList'])257 self.RefDict['Type'] = 'SXC'258 self.RefDict['Super'] = self.Super259 self.UpdateParameters(Type='SXC',Wave=None) # histogram type260 return True261 except Exception as detail:262 self.errors += '\n '+str(detail)263 print '\n\n'+self.formatName+' read error: '+str(detail) # for testing264 import traceback265 traceback.print_exc(file=sys.stdout)266 return False267 268 281 class NT_HKLF2_ReaderClass(G2IO.ImportStructFactor): 269 282 'Routines to import neutron TOF F**2, sig(F**2) reflections from a HKLF file'
Note: See TracChangeset
for help on using the changeset viewer.