Changeset 1275


Ignore:
Timestamp:
Apr 11, 2014 2:03:10 PM (8 years ago)
Author:
vondreele
Message:

fixed bug in background peak refinement & multiple histograms
forced name change with duplicate image integration names;
name now has '(n)' n=1,2,3,... appended to duplicates.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1261 r1275  
    965965            Azms.append((azms[i+1]+azm)/2.)
    966966    for i,azm in enumerate(azms[:-1]):
     967        name += " Azm= %.2f"%(Azms[i])
    967968        item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root)
    968         Id = 0
     969        nOcc = 0
    969970        while item:
    970971            Name = G2frame.PatternTree.GetItemText(item)
    971             if name == Name:
    972                 Id = item
     972            if name in Name:
     973                nOcc += 1
    973974            item, cookie = G2frame.PatternTree.GetNextChild(G2frame.root, cookie)
     975        if nOcc:
     976            name += '(%d)'%(nOcc)
    974977        Sample = G2pdG.SetDefaultSample()
    975978        Sample['Gonio. radius'] = data['distance']
     
    984987        Y = G2frame.Integrate[0][i]
    985988        W = 1./Y                    #probably not true
    986         if Id:
    987             G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Comments'),Comments)                   
    988             G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Limits'),[tuple(Xminmax),Xminmax])
    989             if 'PWDR' in name:
    990                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Background'),[['chebyschev',1,3,1.0,0.0,0.0],
    991                     {'nDebye':0,'debyeTerms':[],'nPeaks':0,'peaksList':[]}])
    992             inst = [dict(zip(names,zip(parms,parms,codes))),{}]
    993             for item in inst[0]:
    994                 inst[0][item] = list(inst[0][item])
    995             G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Instrument Parameters'),inst)
    996             if 'PWDR' in name:
    997                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Peak List'),[])
    998                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Index Peak List'),[])
    999                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Unit Cells List'),[])             
    1000                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Reflection Lists'),{})
    1001             elif 'SASD' in name:             
    1002                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Substances'),G2pdG.SetDefaultSubstances())
    1003                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Models'),G2pdG.SetDefaultSASDModel())
    1004         else:
    1005             Id = G2frame.PatternTree.AppendItem(parent=G2frame.root,text=name+" Azm= %.2f"%(Azms[i]))
    1006             G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Comments'),Comments)                   
    1007             G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Limits'),[tuple(Xminmax),Xminmax])
    1008             if 'PWDR' in name:
    1009                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Background'),[['chebyschev',1,3,1.0,0.0,0.0],
    1010                     {'nDebye':0,'debyeTerms':[],'nPeaks':0,'peaksList':[]}])
    1011             inst = [dict(zip(names,zip(parms,parms,codes))),{}]
    1012             for item in inst[0]:
    1013                 inst[0][item] = list(inst[0][item])
    1014             G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Instrument Parameters'),inst)
    1015             if 'PWDR' in name:
    1016                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
    1017                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Peak List'),[])
    1018                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Index Peak List'),[])
    1019                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Unit Cells List'),[])
    1020                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Reflection Lists'),{})
    1021             elif 'SASD' in name:             
    1022                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Substances'),G2pdG.SetDefaultSubstances())
    1023                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
    1024                 G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Models'),G2pdG.SetDefaultSASDModel())
    1025             valuesdict = {
    1026                 'wtFactor':1.0,
    1027                 'Dummy':False,
    1028                 'ranId':ran.randint(0,sys.maxint),
    1029                 }
     989        Id = G2frame.PatternTree.AppendItem(parent=G2frame.root,text=name)
     990        G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Comments'),Comments)                   
     991        G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Limits'),[tuple(Xminmax),Xminmax])
     992        if 'PWDR' in name:
     993            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Background'),[['chebyschev',1,3,1.0,0.0,0.0],
     994                {'nDebye':0,'debyeTerms':[],'nPeaks':0,'peaksList':[]}])
     995        inst = [dict(zip(names,zip(parms,parms,codes))),{}]
     996        for item in inst[0]:
     997            inst[0][item] = list(inst[0][item])
     998        G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Instrument Parameters'),inst)
     999        if 'PWDR' in name:
     1000            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
     1001            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Peak List'),[])
     1002            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Index Peak List'),[])
     1003            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Unit Cells List'),[])
     1004            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Reflection Lists'),{})
     1005        elif 'SASD' in name:             
     1006            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Substances'),G2pdG.SetDefaultSubstances())
     1007            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
     1008            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Models'),G2pdG.SetDefaultSASDModel())
     1009        valuesdict = {
     1010            'wtFactor':1.0,
     1011            'Dummy':False,
     1012            'ranId':ran.randint(0,sys.maxint),
     1013            }
    10301014        G2frame.PatternTree.SetItemPyData(
    10311015            Id,[valuesdict,
  • trunk/GSASIIstrMath.py

    r1248 r1275  
    14971497    for name in varylist:
    14981498        if 'BkPk' in name:
    1499             id = int(name.split(';')[-1])
    1500             parm = name[:int(name.rindex(';'))]
    1501             ip = names.index(parm)
    1502             dMdv[varylist.index(name)] = dMdpk[4*id+ip]
     1499            parm,id = name.split(';')
     1500            id = int(id)
     1501            if parm in names:
     1502                ip = names.index(parm)
     1503                dMdv[varylist.index(name)] = dMdpk[4*id+ip]
    15031504    cw = np.diff(x)
    15041505    cw = np.append(cw,cw[-1])
Note: See TracChangeset for help on using the changeset viewer.