Ignore:
Timestamp:
Jun 9, 2015 4:02:06 PM (7 years ago)
Author:
vondreele
Message:

remove some unused imports
add merohedral/pseudomerohedral Twin Laws to G2ddataGUI and G2strIO (not in G2strmath yet).
allow ReImport? atoms to fill otherwise empty Atom List
clarify HKL importers as Shelx HKL 4 & HKL 5 files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2sfact.py

    r1832 r1884  
    8585            return False
    8686
    87 class HKLF2_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 = 'Simple [hkl, Fo2, sig(Fo2)] Structure factor text file'
     87class 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'
    9393        else:
    9494            formatName = u'HKL F\u00b2'
    95             longFormatName = u'Simple [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'
    9696        super(self.__class__,self).__init__( # fancy way to self-reference
    9797            extensionlist=('.hkl','.HKL'),
     
    203203           
    204204class 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'
    210210        else:
    211211            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'       
    213213        super(self.__class__,self).__init__( # fancy way to self-reference
    214214            extensionlist=('.hkl','.HKL'),
     
    222222        numCols = 0
    223223        for i,line in enumerate(filepointer):
    224             numCols = max(numCols,len(line))
     224            numCols = max(numCols,len(line.split()))
    225225            if i > 20:
    226226                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")           
    229230        return True #ColumnValidator(self, filepointer)
    230231
     
    235236                self.errors = '  Error reading line '+str(line+1)
    236237                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()
    238239                    h,k,l = [int(h),int(k),int(l)]
    239240                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()
    241242                    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)]
    248243                if not any([h,k,l]):
    249244                    break
     
    252247                # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
    253248                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])
    255250                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])
    261252                #self.RefDict['FF'].append({}) # now done in OnImportSfact
    262253            self.errors = 'Error after reading reflections (unexpected!)'
Note: See TracChangeset for help on using the changeset viewer.