Changeset 1909


Ignore:
Timestamp:
Jun 26, 2015 10:39:44 AM (7 years ago)
Author:
vondreele
Message:

fix import names for HKLF files - now explicit Shelx names
fix importing problems with run-on numbers in Shelx HKLF 4 & 5 files
fix issues with importing structure factors before importing a phase

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1907 r1909  
    777777                    self.PatternTree.SetItemPyData(Sub,copy.copy(rd.Parameters))
    778778                    self.PatternTree.SetItemPyData(
    779                         self.PatternTree.AppendItem(Id,text='Reflection List'),[])  #dummy entry for GUI use
     779                        self.PatternTree.AppendItem(Id,text='Reflection List'),{})  #dummy entry for GUI use
    780780                    newHistList.append(HistName)
    781781            else:
     
    790790                self.PatternTree.SetItemPyData(Sub,rd.Parameters)
    791791                self.PatternTree.SetItemPyData(
    792                     self.PatternTree.AppendItem(Id,text='Reflection List'),[])  #dummy entry for GUI use
     792                    self.PatternTree.AppendItem(Id,text='Reflection List'),{})  #dummy entry for GUI use
    793793                newHistList.append(HistName)
    794794               
     
    28292829                                        del(refList[item])
    28302830                            self.PatternTree.SetItemPyData(Id,refList)
     2831                        elif 'HKLF' in name:
     2832                            data = self.PatternTree.GetItemPyData(item)
     2833                            data[0] = {}
     2834                            self.PatternTree.SetItemPyData(item,data)
     2835                           
    28312836                        item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
    28322837            finally:
  • trunk/GSASIIplot.py

    r1907 r1909  
    606606           
    607607    Name = G2frame.PatternTree.GetItemText(G2frame.PatternId)
    608     if Title: #NB: save image as e.g. jpeg will fail if False; MyDir is unknown
     608    if Title and Title in G2frame.GetPhaseData(): #NB: save image as e.g. jpeg will fail if False; MyDir is unknown
    609609        generalData = G2frame.GetPhaseData()[Title]['General']
    610610        cell = generalData['Cell'][1:7]
    611611        Mydir = generalData['Mydir']
    612612    else:
     613        Title = 'Unknown'
    613614        cell = [10,10,10,90,90,90]
    614615        Mydir = G2frame.dirname
  • trunk/GSASIIpwdGUI.py

    r1898 r1909  
    30683068        '''
    30693069        phaseName = G2frame.RefList
    3070         pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
    3071         phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
    3072         General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
    3073         Super = General.get('Super',0)
    3074         SuperVec = General.get('SuperVec',[])
     3070        if phaseName not in ['Unknown',]:
     3071            pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
     3072            phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
     3073            General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
     3074            Super = General.get('Super',0)
     3075            SuperVec = General.get('SuperVec',[])
     3076        else:
     3077            Super = 0
     3078            SuperVec = []       
    30753079        if 'list' in str(type(data)):   #single crystal data is 2 dict in list
    30763080            refList = data[1]['RefList']
     
    30883092        '''
    30893093        phaseName = G2frame.RefList
    3090         pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
    3091         phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
    3092         General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
    3093         Super = General.get('Super',0)
    3094         SuperVec = General.get('SuperVec',[])
     3094        if phaseName not in ['Unknown',]:
     3095            pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
     3096            phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
     3097            General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
     3098            Super = General.get('Super',0)
     3099            SuperVec = General.get('SuperVec',[])
     3100        else:
     3101            Super = 0
     3102            SuperVec = []       
    30953103        if 'list' in str(type(data)):   #single crystal data is 2 dict in list
    30963104            refList = data[1]['RefList']
     
    31113119        for a phase.       
    31123120        '''
    3113         if phaseName:
     3121        if phaseName not in ['Unknown',]:
    31143122            pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
    31153123            phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
     
    32443252        G2frame.RefList = 1
    32453253        phaseName = IsHistogramInAnyPhase(G2frame,Name)
     3254        if not phaseName:
     3255            phaseName = 'Unknown'
    32463256        phases = [phaseName]
    32473257    else:
     
    32733283        G2frame.refTable[phase] = G2G.GSGrid(parent=G2frame.dataDisplay)
    32743284        G2frame.dataDisplay.AddPage(G2frame.refTable[phase],phase)
    3275     if phaseName not in G2frame.refTable:
    3276         print phaseName
    3277         print phases
    3278         raise Exception("how did we get a invalid phase name?")   
     3285#    if phaseName not in G2frame.refTable:
     3286#        print phaseName
     3287#        print phases
     3288#        raise Exception("how did we get a invalid phase name?")   
    32793289    ShowReflTable(phaseName)
    32803290    G2frame.refTable[phaseName].Fit()
  • trunk/imports/G2sfact.py

    r1884 r1909  
    8989    def __init__(self):
    9090        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         else:
    94             formatName = u'HKL F\u00b2'
    95             longFormatName = u'Shelx HKL4 [hkl, Fo\u00b2, sig(Fo\u00b2)] Structure factor text file'
     91            formatName = 'HKLF 4'
     92            longFormatName = 'Shelx HKLF 4 [hkl, Fo2, sig(Fo2)] Structure factor text file'
     93        else:
     94            formatName = u'Shelx HKLF 4 F\u00b2'
     95            longFormatName = u'Shelx HKLF 4 [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'),
     
    110110                self.errors = '  Error reading line '+str(line+1)
    111111                if S[0] == '#': continue       #ignore comments, if any
    112                 h,k,l,Fo,sigFo = S.split()
     112                h,k,l,Fo,sigFo = S.split()[:5]
    113113                h,k,l = [int(h),int(k),int(l)]
    114114                if not any([h,k,l]):
     
    178178                        h,k,l,m1 = [int(h),int(k),int(l),int(m1)]
    179179                except ValueError:  #skipping text at front
     180                    if not S:
     181                        break
    180182                    text = S.split()
    181183                    if text[0] == 'lambda':
     
    206208    def __init__(self):
    207209        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         else:
    211             formatName = u'SHELX HKL F\u00b2'
    212             longFormatName = u'SHELX HKLF5 [hklm, Fo\u00b2, sig(Fo\u00b2), Tind] Structure factor text file'       
     210            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'       
    213215        super(self.__class__,self).__init__( # fancy way to self-reference
    214216            extensionlist=('.hkl','.HKL'),
     
    236238                self.errors = '  Error reading line '+str(line+1)
    237239                if self.Super == 0:
    238                     h,k,l,Fo,sigFo,Tw = S.split()
     240                    h,k,l,Fo,sigFo,Tw = S[:4],S[4:8],S[8:12],S[12:20],S[20:28],S[28:32]
    239241                    h,k,l = [int(h),int(k),int(l)]
    240242                elif self.Super == 1:
    241                     h,k,l,m1,Fo,sigFo,Tw = S.split()
     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]
    242244                    h,k,l,m1 = [int(h),int(k),int(l),int(m1)]
    243245                if not any([h,k,l]):
     
    247249                # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
    248250                if self.Super == 0:
    249                     self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0,Tw])
     251                    self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0])
    250252                elif self.Super == 1:
    251                     self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0,Tw])
     253                    self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0])
    252254                #self.RefDict['FF'].append({}) # now done in OnImportSfact
    253255            self.errors = 'Error after reading reflections (unexpected!)'
Note: See TracChangeset for help on using the changeset viewer.