Changeset 1453 for trunk/GSASII.py


Ignore:
Timestamp:
Aug 1, 2014 3:19:48 PM (9 years ago)
Author:
vondreele
Message:

get HKLF data type into RefDict?
create a SetDefaultDData routine in GSASII.py
fix copyflags for sc extinction coeff
fix neutron resonant ff for TOF
fix error in making Hessian v-cov matrix - now matches the Jabobian one
put names in the Es, Ep & Eg sc extinction coeff
fix errors in SCExtinction - still problem with derivatives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1449 r1453  
    9999    return GSASII(parent)
    100100
     101def SetDefaultDData(dType,histoName,NShkl=0,NDij=0):
     102    if dType in ['SXC','SNC']:
     103        return {'Histogram':histoName,'Show':False,'Scale':[1.0,True],
     104            'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},
     105            'Extinction':['Lorentzian','None', {'Tbar':0.1,'Cos2TM':0.955,
     106            'Eg':[1.e-10,False],'Es':[1.e-10,False],'Ep':[1.e-10,False]}]}
     107    elif dType == 'SNT':
     108        return {'Histogram':histoName,'Show':False,'Scale':[1.0,True],
     109            'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},
     110            'Extinction':['Lorentzian','None', {
     111            'Eg':[1.e-10,False],'Es':[1.e-10,False],'Ep':[1.e-10,False]}]}
     112    elif 'P' in dType:
     113        return {'Histogram':histoName,'Show':False,'Scale':[1.0,False],
     114            'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{}],
     115            'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1],
     116                [1.,1.,1.,0.,0.,0.],6*[False,]],
     117            'Mustrain':['isotropic',[1000.0,1000.0,1.0],[False,False,False],[0,0,1],
     118                NShkl*[0.01,],NShkl*[False,]],
     119            'HStrain':[NDij*[0.0,],NDij*[False,]],                         
     120            'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
     121
    101122class GSASII(wx.Frame):
    102123    '''Define the main GSAS-II frame and its associated menu items
    103124    '''
     125   
    104126    def _Add_FileMenuItems(self, parent):
    105127        item = parent.Append(
     
    625647                histoName = TextList[i]
    626648                if histoName in HKLFlist:
    627                     UseList[histoName] = {
    628                         'Histogram':histoName,'Show':False,'Scale':[1.0,True],
    629                         'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},
    630                         'Extinction':['Lorentzian','None', {'Tbar':0.1,'Cos2TM':0.955,
    631                                                             'Eg':[1.e-10,False],
    632                                                             'Es':[1.e-10,False],
    633                                                             'Ep':[1.e-10,False]},]
    634                         }
    635649                    #redo UpdateHKLFdata(histoName) here:
    636650                    Id = G2gd.GetPatternTreeItemId(self,self.root,histoName)
     
    641655                        ref[4] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
    642656                        iabsnt,ref[3],Uniq,phi = G2spc.GenHKLf(H,SGData)
     657                    UseList[histoName] = SetDefaultDData(refDict['Type'],histoName)
    643658                elif histoName in PWDRlist:
    644                     UseList[histoName] = {
    645                         'Histogram':histoName,'Show':False,
    646                         'Scale':[1.0,False],'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{}],
    647                         'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1],
    648                                 [1.,1.,1.,0.,0.,0.],6*[False,]],
    649                         'Mustrain':['isotropic',[1000.0,1000.0,1.0],[False,False,False],[0,0,1],
    650                                     NShkl*[0.01,],NShkl*[False,]],
    651                         'HStrain':[NDij*[0.0,],NDij*[False,]],                         
    652                         'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
    653659                    Id = G2gd.GetPatternTreeItemId(self,self.root,histoName)
    654660                    refList = self.PatternTree.GetItemPyData(
    655661                        G2gd.GetPatternTreeItemId(self,Id,'Reflection Lists'))
    656662                    refList[generalData['Name']] = []
     663                    UseList[histoName] = SetDefaultDData('PWDR',histoName,NShkl=NShkl,NDij=NDij)
    657664                else:
    658665                    raise Exception('Unexpected histogram '+str(histoName))
     
    714721            HistName = 'HKLF '+HistName
    715722            # make new histogram names unique
    716             valuesdict = {
    717                 'wtFactor':1.0,
    718                 'Dummy':False,
    719                 'ranId':ran.randint(0,sys.maxint),
    720                 }
    721723            if len(rd.Banks):
    722724                for Bank in rd.Banks:
     725                    valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxint),}
    723726                    HistName = G2obj.MakeUniqueLabel(HistName,HKLFlist)
    724727                    print 'Read structure factor table '+str(HistName)+' from file '+str(self.lastimport)
     
    732735                        self.PatternTree.AppendItem(Id,text='Reflection List'),[])  #dummy entry for GUI use
    733736            else:
     737                valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxint),}
    734738                HistName = G2obj.MakeUniqueLabel(HistName,HKLFlist)
    735739                print 'Read structure factor table '+str(HistName)+' from file '+str(self.lastimport)
     
    774778            SGData = generalData['SGData']
    775779            UseList = data['Histograms']
    776             NShkl = len(G2spc.MustrainNames(SGData))
    777             NDij = len(G2spc.HStrainNames(SGData))
    778780            for histoName in newHistList:
    779                 UseList[histoName] = {
    780                     'Histogram':histoName,'Show':False,'Scale':[1.0,True],
    781                     'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},
    782                     'Extinction':['Lorentzian','None', {'Tbar':0.1,'Cos2TM':0.955,
    783                                                         'Eg':[1.e-10,False],
    784                                                         'Es':[1.e-10,False],
    785                                                         'Ep':[1.e-10,False]},]
    786                     }
    787781                #redo UpdateHKLFdata(histoName) here:
    788782                Id = G2gd.GetPatternTreeItemId(self,self.root,histoName)
    789783                refDict,reflData = self.PatternTree.GetItemPyData(Id)
     784                UseList[histoName] = SetDefaultDData(refDict['Type'],histoName)
    790785                G,g = G2lat.cell2Gmat(generalData['Cell'][1:7])
    791786                for iref,ref in enumerate(reflData['RefList']):
     
    13261321            NDij = len(G2spc.HStrainNames(SGData))
    13271322            for histoName in newHistList:
    1328                 UseList[histoName] = {
    1329                     'Histogram':histoName,'Show':False,
    1330                     'Scale':[1.0,False],'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{}],
    1331                     'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1],
    1332                             [1.,1.,1.,0.,0.,0.],6*[False,]],
    1333                     'Mustrain':['isotropic',[1000.0,1000.0,1.0],[False,False,False],[0,0,1],
    1334                                 NShkl*[0.01,],NShkl*[False,]],
    1335                     'HStrain':[NDij*[0.0,],NDij*[False,]],                         
    1336                     'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
     1323                UseList[histoName] = SetDefaultDData('PWDR',histoName,NShkl=NShkl,NDij=NDij)
    13371324                Id = G2gd.GetPatternTreeItemId(self,self.root,histoName)
    13381325                refList = self.PatternTree.GetItemPyData(
     
    14961483            NShkl = len(G2spc.MustrainNames(SGData))
    14971484            NDij = len(G2spc.HStrainNames(SGData))
    1498             UseList[HistName] = {
    1499                 'Histogram':HistName,'Show':False,
    1500                 'Scale':[1.0,False],'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{}],
    1501                 'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1],
    1502                         [1.,1.,1.,0.,0.,0.],6*[False,]],
    1503                 'Mustrain':['isotropic',[1000.0,1000.0,1.0],[False,False,False],[0,0,1],
    1504                             NShkl*[0.01,],NShkl*[False,]],
    1505                 'HStrain':[NDij*[0.0,],NDij*[False,]],                         
    1506                 'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
     1485            UseList[HistName] = SetDefaultDData('PWDR',histoName,NShkl=NShkl,NDij=NDij)
    15071486            Id = G2gd.GetPatternTreeItemId(self,self.root,HistName)
    15081487            refList = self.PatternTree.GetItemPyData(
Note: See TracChangeset for help on using the changeset viewer.