Changeset 1884 for trunk/imports/G2sfact.py
- Timestamp:
- Jun 9, 2015 4:02:06 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/imports/G2sfact.py
r1832 r1884 85 85 return False 86 86 87 class HKLF 2_ReaderClass(G2IO.ImportStructFactor):88 'Routines to import F**2, sig(F**2) reflections from a HKLF file'89 def __init__(self): 90 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus 91 formatName = 'HKL F2'92 longFormatName = 'S imple[hkl, Fo2, sig(Fo2)] Structure factor text file'87 class HKLF4_ReaderClass(G2IO.ImportStructFactor): 88 'Routines to import F**2, sig(F**2) reflections from a HKLF 4 file' 89 def __init__(self): 90 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus 91 formatName = 'HKL 4' 92 longFormatName = 'Shelx HKL4 [hkl, Fo2, sig(Fo2)] Structure factor text file' 93 93 else: 94 94 formatName = u'HKL F\u00b2' 95 longFormatName = u'S imple[hkl, Fo\u00b2, sig(Fo\u00b2)] Structure factor text file'95 longFormatName = u'Shelx HKL4 [hkl, Fo\u00b2, sig(Fo\u00b2)] Structure factor text file' 96 96 super(self.__class__,self).__init__( # fancy way to self-reference 97 97 extensionlist=('.hkl','.HKL'), … … 203 203 204 204 class SHELX5_ReaderClass(G2IO.ImportStructFactor): 205 'Routines to import F**2, sig(F**2) reflections from a fixed format SHELX HKLF5 file'206 def __init__(self): 207 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus 208 formatName = 'SHELX HKL F2'209 longFormatName = 'SHELX HKLF5 [hkl , Fo2, sig(Fo2)] Structure factor text file'205 'Routines to import F**2, sig(F**2) twin index reflections from a fixed format SHELX HKLF5 file' 206 def __init__(self): 207 if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus 208 formatName = 'SHELX HKL5 F2' 209 longFormatName = 'SHELX HKLF5 [hklm, Fo2, sig(Fo2), Tind] Structure factor text file' 210 210 else: 211 211 formatName = u'SHELX HKL F\u00b2' 212 longFormatName = u'SHELX HKLF5 [hkl , Fo\u00b2, sig(Fo\u00b2)] Structure factor text file'212 longFormatName = u'SHELX HKLF5 [hklm, Fo\u00b2, sig(Fo\u00b2), Tind] Structure factor text file' 213 213 super(self.__class__,self).__init__( # fancy way to self-reference 214 214 extensionlist=('.hkl','.HKL'), … … 222 222 numCols = 0 223 223 for i,line in enumerate(filepointer): 224 numCols = max(numCols,len(line ))224 numCols = max(numCols,len(line.split())) 225 225 if i > 20: 226 226 break 227 self.Super = (numCols-33)/4 #= 0,1,2,or 3 228 print numCols,self.Super 227 self.Super = numCols-6 #= 0,1,2,or 3 228 if self.Super > 1: 229 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry") 229 230 return True #ColumnValidator(self, filepointer) 230 231 … … 235 236 self.errors = ' Error reading line '+str(line+1) 236 237 if self.Super == 0: 237 h,k,l,Fo,sigFo = S[:4],S[4:8],S[8:12],S[12:20],S[20:28]238 h,k,l,Fo,sigFo,Tw = S.split() 238 239 h,k,l = [int(h),int(k),int(l)] 239 240 elif self.Super == 1: 240 h,k,l,m1,Fo,sigFo = S[:4],S[4:8],S[8:12],S[12:16],S[16:24],S[24:32]241 h,k,l,m1,Fo,sigFo,Tw = S.split() 241 242 h,k,l,m1 = [int(h),int(k),int(l),int(m1)] 242 elif self.Super == 2:243 h,k,l,m1,m2,Fo,sigFo = S[:4],S[4:8],S[8:12],S[12:16],S[16:20],S[20:28],S[28:36]244 h,k,l,m1,m2 = [int(h),int(k),int(l),int(m1),int(m2)]245 elif self.Super == 3:246 h,k,l,m1,m2,m3,Fo,sigFo = S[:4],S[4:8],S[8:12],S[12:16],S[16:20],S[20:24],S[24:32],S[32:40]247 h,k,l,m1,m2,m3 = [int(h),int(k),int(l),int(m1),int(m2),int(m3)]248 243 if not any([h,k,l]): 249 244 break … … 252 247 # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,... 253 248 if self.Super == 0: 254 self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0 ])249 self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0,Tw]) 255 250 elif self.Super == 1: 256 self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0]) 257 elif self.Super == 2: 258 self.RefDict['RefList'].append([h,k,l,m1,m2,0,0,Fo,sigFo,0,Fo,0,0,0]) 259 elif self.Super == 3: 260 self.RefDict['RefList'].append([h,k,l,m1,m2,m3,0,0,Fo,sigFo,0,Fo,0,0,0]) 251 self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0,Tw]) 261 252 #self.RefDict['FF'].append({}) # now done in OnImportSfact 262 253 self.errors = 'Error after reading reflections (unexpected!)'
Note: See TracChangeset
for help on using the changeset viewer.