Changeset 311


Ignore:
Timestamp:
Jun 27, 2011 10:27:29 AM (10 years ago)
Author:
vondreele
Message:

finish new indexing refinement stuff
more on texture plotting

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r303 r311  
    878878            'Models':{},'SH Texture':{'Order':0,'Model':'cylindrical','Sample omega':[False,0.0],
    879879            'Sample chi':[False,0.0],'Sample phi':[False,0.0],'SH Coeff':[False,{}],
    880             'SHShow':False,'PFhkl':[0,0,1]}})
     880            'SHShow':False,'PFhkl':[0,0,1],'PFxyz':[0,0,1],'PlotType':'Pole figure'}})
    881881       
    882882    def OnDeletePhase(self,event):
  • trunk/GSASIIgrid.py

    r300 r311  
    867867        data = self.PatternTree.GetItemPyData(item)
    868868        if not data:
    869             data.append([0,0.1,4,25.0,0,'P1',1,1,1,90,90,90]) #zero error flag, max zero error, max Nc/No, start volume
     869            data.append([0,0.0,4,25.0,0,'P1',1,1,1,90,90,90]) #zero error flag, zero value, max Nc/No, start volume
    870870            data.append([0,0,0,0,0,0,0,0,0,0,0,0,0,0])      #Bravais lattice flags
    871871            data.append([])                                 #empty cell list
  • trunk/GSASIIindex.py

    r307 r311  
    245245            return [values[0],values[1],values[2],0,values[3],0]
    246246        else:
    247             return values
     247            return list(values)
    248248           
    249249    def A2values(ibrav,A):
     
    258258        else:
    259259            return A
     260           
     261    def Jacobian(values,ibrav,d,H,Pwr):
     262# derivatives of rdsq = H[0]*H[0]*A[0]+H[1]*H[1]*A[1]+H[2]*H[2]*A[2]+H[0]*H[1]*A[3]+H[0]*H[2]*A[4]+H[1]*H[2]*A[5]
     263        if ibrav in [0,1,2]:            #m3m
     264            return [H[0]*H[0]+H[1]*H[1]+H[2]*H[2],]*d**Pwr
     265        elif ibrav in [3,4]:            #R3H, P3/m & P6/mmm
     266            return [H[0]*H[0]+H[1]*H[0]+H[1]*H[1],H[2]*H[2]]*d**Pwr
     267        elif ibrav in [5,6]:            #4/mmm
     268            return [H[0]*H[0]+H[1]*H[1],H[2]*H[2]]*d**Pwr
     269        elif ibrav in [7,8,9,10]:       #mmm
     270            return [H[0]*H[0],H[1]*H[1],H[2]*H[2]]*d**Pwr
     271        elif ibrav in [11,12]:          #2/m
     272            return [H[0]*H[0],H[1]*H[1],H[2]*H[2],H[0]*H[2]]*d**Pwr
     273        else:                           #-1
     274            return [H[0]*H[0],H[1]*H[1],H[2]*H[2],H[1]*H[0],H[0]*H[2],H[1]*H[2]]*d**Pwr
    260275   
    261276    def errFit(values,ibrav,d,H,Pwr):
     
    266281   
    267282    Peaks = np.array(peaks).T
    268     values = A2values(ibrav,A)   
    269     result = so.leastsq(errFit,values,args=(ibrav,Peaks[7],Peaks[4:7],Pwr),full_output=True)
     283   
     284    values = A2values(ibrav,A)
     285#    result = so.leastsq(errFit,values,args=(ibrav,Peaks[7],Peaks[4:7],Pwr),
     286#        Dfun=Jacobian,col_deriv=True,full_output=True)
     287    result = so.leastsq(errFit,values,args=(ibrav,Peaks[7],Peaks[4:7],Pwr),
     288        full_output=True,factor=0.1)
    270289    A = Values2A(ibrav,result[0])
    271     return True,np.sum(errFit(result[0],ibrav,Peaks[7],Peaks[4:7],Pwr)**2),A
     290    return True,np.sum(errFit(result[0],ibrav,Peaks[7],Peaks[4:7],Pwr)**2),A,result
    272291           
    273292def FitHKLZ(ibrav,peaks,Z,A):
     
    314333    return peaks[0][7]
    315334   
    316 def refinePeaks(peaks,ibrav,A):
     335def refinePeaks(peaks,ibrav,A,Zero):
     336    #Zero is list(zero value, flag)
    317337    dmin = getDmin(peaks)
    318338    smin = 1.0e10
    319     pwr = 3
     339    pwr = 4
    320340    maxTries = 10
    321     if ibrav == 13:
     341    if ibrav == 13: #-1 - triclinic
    322342        pwr = 4
    323343        maxTries = 10
     
    325345    tries = 0
    326346    HKL = G2lat.GenHBravais(dmin,ibrav,A)
    327     while IndexPeaks(peaks,HKL):
     347    while len(HKL) > 2 and IndexPeaks(peaks,HKL):
    328348        Pwr = pwr - (tries % 2)
    329349        HKL = []
    330350        tries += 1
    331351        osmin = smin
    332         oldA = A
    333         OK,smin,A = FitHKL(ibrav,peaks,A,Pwr)
    334         if min(A[:3]) <= 0:
     352        oldA = A[:]
     353        Vold = G2lat.calc_V(oldA)
     354        OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
     355        Vnew = G2lat.calc_V(A)
     356        if Vnew > 2.0*Vold or Vnew < 2.:
     357            A = ranAbyR(ibrav,oldA,tries+1,maxTries,ran2axis)
     358            OK = False
     359            continue
     360        try:
     361            HKL = G2lat.GenHBravais(dmin,ibrav,A)
     362        except FloatingPointError:
    335363            A = oldA
    336364            OK = False
    337365            break
    338         if OK:
    339             HKL = G2lat.GenHBravais(dmin,ibrav,A)
    340366        if len(HKL) == 0: break                         #absurd cell obtained!
    341367        rat = (osmin-smin)/smin
     
    343369        if tries > maxTries: break
    344370    if OK:
    345         OK,smin,A = FitHKL(ibrav,peaks,A,2)
     371        OK,smin,A,result = FitHKL(ibrav,peaks,A,2)
    346372        Peaks = np.array(peaks).T
    347373        H = Peaks[4:7]
     
    350376       
    351377    M20,X20 = calc_M20(peaks,HKL)
    352     return len(HKL),M20,X20,A
     378    return len(HKL),M20,X20,A,Zero
    353379       
    354380def findBestCell(dlg,ncMax,A,Ntries,ibrav,peaks,V1):
     
    371397    while tries < Ntries:
    372398        if A:
    373             Anew = ranAbyR(ibrav,A[:],tries+1,Ntries,ran2axis)
    374             if ibrav in [11,12,13]:
    375                 Anew = ranAbyR(ibrav,A[:],tries/10+1,Ntries,ran2axis)
     399            Abeg = ranAbyR(ibrav,A,tries+1,Ntries,ran2axis)
     400            if ibrav in [11,12,13]:         #monoclinic & triclinic
     401                Abeg = ranAbyR(ibrav,A,tries/10+1,Ntries,ran2axis)
    376402        else:
    377             Anew = ranAbyV(ibrav,amin,amax,V1)
    378         HKL = G2lat.GenHBravais(dmin,ibrav,Anew)
     403            Abeg = ranAbyV(ibrav,amin,amax,V1)
     404        HKL = G2lat.GenHBravais(dmin,ibrav,Abeg)
    379405       
    380406        if IndexPeaks(peaks,HKL) and len(HKL) > mHKL[ibrav]:
    381             Lhkl,M20,X20,Anew = refinePeaks(peaks,ibrav,Anew)
    382             Asave.append([calc_M20(peaks,HKL),Anew[:]])
     407            Lhkl,M20,X20,Aref,Zero = refinePeaks(peaks,ibrav,Abeg,[0,False])
     408            Asave.append([calc_M20(peaks,HKL),Aref[:]])
    383409            if ibrav == 9:                          #C-centered orthorhombic
    384410                for i in range(2):
    385                     Anew = rotOrthoA(Anew[:])
    386                     Lhkl,M20,X20,Anew = refinePeaks(peaks,ibrav,Anew)
    387                     HKL = G2lat.GenHBravais(dmin,ibrav,Anew)
     411                    Abeg = rotOrthoA(Abeg[:])
     412                    Lhkl,M20,X20,Aref,Zero = refinePeaks(peaks,ibrav,Abeg,[0,False])
     413                    HKL = G2lat.GenHBravais(dmin,ibrav,Aref)
    388414                    IndexPeaks(peaks,HKL)
    389                     Asave.append([calc_M20(peaks,HKL),Anew[:]])
     415                    Asave.append([calc_M20(peaks,HKL),Aref[:]])
    390416            elif ibrav == 11:                      #C-centered monoclinic
    391                 Anew = swapMonoA(Anew[:])
    392                 Lhkl,M20,X20,Anew = refinePeaks(peaks,ibrav,Anew)
    393                 HKL = G2lat.GenHBravais(dmin,ibrav,Anew)
     417                Abeg = swapMonoA(Abeg[:])
     418                Lhkl,M20,X20,Aref,Zero = refinePeaks(peaks,ibrav,Abeg,[0,False])
     419                HKL = G2lat.GenHBravais(dmin,ibrav,Aref)
    394420                IndexPeaks(peaks,HKL)
    395                 Asave.append([calc_M20(peaks,HKL),Anew[:]])
     421                Asave.append([calc_M20(peaks,HKL),Aref[:]])
    396422        else:
    397423            break
     
    406432    X = sortM20(Asave)
    407433    if X:
    408         Lhkl,M20,X20,A = refinePeaks(peaks,ibrav,X[0][1])
    409         return GoOn,Lhkl,M20,X20,X[0][1]
    410     else:
    411         return GoOn,0,0,0,Anew
     434        Lhkl,M20,X20,A,Zero = refinePeaks(peaks,ibrav,X[0][1],[0,False])
     435        return GoOn,Lhkl,M20,X20,A
     436       
     437    else:
     438        return GoOn,0,0,0,0
    412439       
    413440def monoCellReduce(ibrav,A):
     
    537564        return False,0,0
    538565       
     566       
     567NeedTestData = True
     568def TestData():
     569    array = np.array
     570    global NeedTestData
     571    NeedTestData = False
     572    global TestData
     573    TestData = [12, [7.,8.70,10.86,90.,102.95,90.], [7.76006,8.706215,10.865679,90.,102.947,90.],3,
     574        [[2.176562137832974, 761.60902227696033, True, True, 0, 0, 1, 10.591300714328161, 10.589436],
     575        [3.0477561489789498, 4087.2956049071572, True, True, 1, 0, 0, 7.564238997554908, 7.562777],
     576        [3.3254921120068524, 1707.0253890991009, True, True, 1, 0, -1, 6.932650301411212, 6.932718],
     577        [3.428121546163426, 2777.5082170150563, True, True, 0, 1, 1, 6.725163158013632, 6.725106],
     578        [4.0379791325512118, 1598.4321673135987, True, True, 1, 1, 0, 5.709789097440156, 5.70946],
     579        [4.2511182350743937, 473.10955149057577, True, True, 1, 1, -1, 5.423637972781876, 5.42333],
     580        [4.354684330373451, 569.88528280256071, True, True, 0, 0, 2, 5.2947091882172534, 5.294718],
     581        [4.723324574319177, 342.73882372499997, True, True, 1, 0, -2, 4.881681587039431, 4.881592],
     582        [4.9014773581253994, 5886.3516356615492, True, True, 1, 1, 1, 4.704350709093183, 4.70413],
     583        [5.0970774474587275, 3459.7541692903033, True, True, 0, 1, 2, 4.523933797797693, 4.523829],
     584        [5.2971997607389518, 1290.0229964239879, True, True, 0, 2, 0, 4.353139557169142, 4.353108],
     585        [5.4161306205553847, 1472.5726977257755, True, True, 1, 1, -2, 4.257619398422479, 4.257944],
     586        [5.7277364698554161, 1577.8791668322888, True, True, 0, 2, 1, 4.026169751907777, 4.026193],
     587        [5.8500213058834163, 420.74210142657131, True, True, 1, 0, 2, 3.9420803081518443, 3.942219],
     588        [6.0986764166731708, 163.02160537058708, True, True, 2, 0, 0, 3.7814965150452537, 3.781389],
     589        [6.1126665157702753, 943.25461245706833, True, True, 1, 2, 0, 3.772849962062199, 3.772764],
     590        [6.2559260555056957, 250.55355015505376, True, True, 1, 2, -1, 3.6865353266375283, 3.686602],
     591        [6.4226243128279892, 5388.5560141098349, True, True, 1, 1, 2, 3.5909481979190283, 3.591214],
     592        [6.5346132446561134, 1951.6070344509026, True, True, 0, 0, 3, 3.5294722429440584, 3.529812],
     593        [6.5586952135236443, 259.65938178131034, True, True, 2, 1, -1, 3.516526936765838, 3.516784],
     594        [6.6509216222783722, 93.265376597376573, True, True, 2, 1, 0, 3.4678179073694952, 3.468369],
     595        [6.7152737044107722, 289.39386813803162, True, True, 1, 2, 1, 3.4346235125812807, 3.434648],
     596        [6.8594130457361899, 603.54959764648322, True, True, 0, 2, 2, 3.362534044860622, 3.362553],
     597        [7.0511627728884454, 126.43246447656593, True, True, 0, 1, 3, 3.2712038721790675, 3.271181],
     598        [7.077700845503319, 125.49742760019636, True, True, 1, 1, -3, 3.2589538988480626, 3.259037],
     599        [7.099393757363675, 416.55444885434633, True, True, 1, 2, -2, 3.2490085228959193, 3.248951],
     600        [7.1623933278642742, 369.27397110921817, True, True, 2, 1, -2, 3.2204673608202383, 3.220487],
     601        [7.4121734953058924, 482.84120827021826, True, True, 2, 1, 1, 3.1120858221599876, 3.112308]]
     602        ]
     603    global TestData2
     604    TestData2 = [12, [0.15336547830008007, 0.017345499139401827, 0.008122368657493792, 0, 0.02893538955687591, 0], 3,
     605        [[2.176562137832974, 761.6090222769603, True, True, 0, 0, 1, 10.591300714328161, 11.095801],
     606        [3.0477561489789498, 4087.295604907157, True, True, 0, 1, 0, 7.564238997554908, 7.592881],
     607        [3.3254921120068524, 1707.025389099101, True, False, 0, 0, 0, 6.932650301411212, 0.0],
     608        [3.428121546163426, 2777.5082170150563, True, True, 0, 1, 1, 6.725163158013632, 6.266192],
     609        [4.037979132551212, 1598.4321673135987, True, False, 0, 0, 0, 5.709789097440156, 0.0],
     610        [4.251118235074394, 473.10955149057577, True, True, 0, 0, 2, 5.423637972781876, 5.5479],
     611        [4.354684330373451, 569.8852828025607, True, True, 0, 0, 2, 5.2947091882172534, 5.199754],
     612        [4.723324574319177, 342.738823725, True, False, 0, 0, 0, 4.881681587039431, 0.0],
     613        [4.901477358125399, 5886.351635661549, True, False, 0, 0, 0, 4.704350709093183, 0.0],
     614        [5.0970774474587275, 3459.7541692903033, True, True, 0, 1, 2, 4.523933797797693, 4.479534],
     615        [5.297199760738952, 1290.022996423988, True, True, 0, 1, 0, 4.353139557169142, 4.345087],
     616        [5.416130620555385, 1472.5726977257755, True, False, 0, 0, 0, 4.257619398422479, 0.0],
     617        [5.727736469855416, 1577.8791668322888, True, False, 0, 0, 0, 4.026169751907777, 0.0],
     618        [5.850021305883416, 420.7421014265713, True, False, 0, 0, 0, 3.9420803081518443, 0.0],
     619        [6.098676416673171, 163.02160537058708, True, True, 0, 2, 0, 3.7814965150452537, 3.796441],
     620        [6.112666515770275, 943.2546124570683, True, False, 0, 0, 0, 3.772849962062199, 0.0],
     621        [6.255926055505696, 250.55355015505376, True, True, 0, 0, 3, 3.6865353266375283, 3.6986],
     622        [6.422624312827989, 5388.556014109835, True, True, 0, 2, 1, 3.5909481979190283, 3.592005],
     623        [6.534613244656113, 191.6070344509026, True, True, 1, 0, -1, 3.5294722429440584, 3.546166],
     624        [6.558695213523644, 259.65938178131034, True, True, 0, 0, 3, 3.516526936765838, 3.495428],
     625        [6.650921622278372, 93.26537659737657, True, True, 0, 0, 3, 3.4678179073694952, 3.466503],
     626        [6.715273704410772, 289.3938681380316, True, False, 0, 0, 0, 3.4346235125812807, 0.0],
     627        [6.85941304573619, 603.5495976464832, True, True, 0, 1, 3, 3.362534044860622, 3.32509],
     628        [7.051162772888445, 126.43246447656593, True, True, 0, 1, 2, 3.2712038721790675, 3.352121],
     629        [7.077700845503319, 125.49742760019636, True, False, 0, 0, 0, 3.2589538988480626, 0.0],
     630        [7.099393757363675, 416.55444885434633, True, False, 0, 0, 0, 3.2490085228959193, 0.0],
     631        [7.162393327864274, 369.27397110921817, True, False, 0, 0, 0, 3.2204673608202383, 0.0],
     632        [7.412173495305892, 482.84120827021826, True, True, 0, 2, 2, 3.112085822159976, 3.133096]]
     633        ]
     634#
     635def test0():
     636    if NeedTestData: TestData()
     637    msg = 'test FitHKL'
     638    ibrav,cell,bestcell,Pwr,peaks = TestData
     639    print 'best cell:',bestcell
     640    print 'old cell:',cell
     641    Peaks = np.array(peaks)
     642    HKL = Peaks[4:7]
     643    print calc_M20(peaks,HKL)
     644    A = G2lat.cell2A(cell)
     645    OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
     646    print 'new cell:',G2lat.A2cell(A)   
     647    print 'x:',result[0]
     648    print 'cov_x:',result[1]
     649    print 'infodict:'
     650    for item in result[2]:
     651        print item,result[2][item]
     652    print 'msg:',result[3]
     653    print 'ier:',result[4]
     654    result = refinePeaks(peaks,ibrav,A,[0,False])
     655    N,M20,X20,A,Zero = result
     656    print 'refinePeaks:',N,M20,X20,G2lat.A2cell(A)
     657    print 'compare bestcell:',bestcell
     658#
     659def test1():
     660    if NeedTestData: TestData()
     661    msg = 'test FitHKL'
     662    ibrav,A,Pwr,peaks = TestData2
     663    print 'bad cell:',G2lat.A2cell(A)
     664    print 'FitHKL'
     665    OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
     666    result = refinePeaks(peaks,ibrav,A,[0,False])
     667    N,M20,X20,A,Zero = result
     668    print 'refinePeaks:',N,M20,X20,A
     669#    Peaks = np.array(peaks)
     670#    HKL = Peaks[4:7]
     671#    print calc_M20(peaks,HKL)
     672#    OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
     673#    print 'new cell:',G2lat.A2cell(A)   
     674#    print 'x:',result[0]
     675#    print 'cov_x:',result[1]
     676#    print 'infodict:'
     677#    for item in result[2]:
     678#        print item,result[2][item]
     679#    print 'msg:',result[3]
     680#    print 'ier:',result[4]
     681   
     682#
     683if __name__ == '__main__':
     684    test0()
     685    test1()
     686#    test2()
     687#    test3()
     688#    test4()
     689#    test5()
     690#    test6()
     691#    test7()
     692#    test8()
     693    print "OK"
  • trunk/GSASIIlattice.py

    r303 r311  
    100100    returns tuple with a*,b*,c*,alpha*, beta*, gamma* (degrees)
    101101    '''
     102    oldset = np.seterr('raise')
    102103    a = np.sqrt(max(0,g[0][0]))
    103104    b = np.sqrt(max(0,g[1][1]))
     
    106107    bet = acosd(g[2][0]/(a*c))
    107108    gam = acosd(g[0][1]/(a*b))
     109    np.seterr(**oldset)
    108110    return a,b,c,alp,bet,gam
    109111
     
    750752    'L=10':[[-0.16413497,0.33078546,0.39371345],[],[]],
    751753    'L=12':[[0.26141975,0.27266871,0.03277460,0.32589402],
    752         [0.09298802,-0.23773812,0.49446631],[]],
     754        [0.09298802,-0.23773812,0.49446631,0.0],[]],
    753755    'L=14':[[-0.17557309,0.25821932,0.27709173,0.33645360],[],[]],
    754756    'L=16':[[0.24370673,0.29873515,0.06447688,0.00377,0.32574495],
    755         [0.12039646,-0.25330128,0.23950998,0.40962508],[]],
     757        [0.12039646,-0.25330128,0.23950998,0.40962508,0.0],[]],
    756758    'L=18':[[-0.16914245,0.17017340,0.34598142,0.07433932,0.32696037],
    757         [-0.06901768,0.16006562,-0.24743528,0.47110273],[]],
     759        [-0.06901768,0.16006562,-0.24743528,0.47110273,0.0],[]],
    758760    'L=20':[[0.23067026,0.31151832,0.09287682,0.01089683,0.00037564,0.32573563],
    759         [0.13615420,-0.25048007,0.12882081,0.28642879,0.34620433],[]],
     761        [0.13615420,-0.25048007,0.12882081,0.28642879,0.34620433,0.0],[]],
    760762    'L=22':[[-0.16109560,0.10244188,0.36285175,0.13377513,0.01314399,0.32585583],
    761         [-0.09620055,0.20244115,-0.22389483,0.17928946,0.42017231],[]],
     763        [-0.09620055,0.20244115,-0.22389483,0.17928946,0.42017231,0.0],[]],
    762764    'L=24':[[0.22050742,0.31770654,0.11661736,0.02049853,0.00150861,0.00003426,0.32573505],
    763         [0.13651722,-0.21386648,0.00522051,0.33939435,0.10837396,0.32914497],
    764         [0.05378596,-0.11945819,0.16272298,-0.26449730,0.44923956]],
     765        [0.13651722,-0.21386648,0.00522051,0.33939435,0.10837396,0.32914497,0.0],
     766        [0.05378596,-0.11945819,0.16272298,-0.26449730,0.44923956,0.0,0.0]],
    765767    'L=26':[[-0.15435003,0.05261630,0.35524646,0.18578869,0.03259103,0.00186197,0.32574594],
    766         [-0.11306511,0.22072681,-0.18706142,0.05439948,0.28122966,0.35634355],[]],
     768        [-0.11306511,0.22072681,-0.18706142,0.05439948,0.28122966,0.35634355,0.0],[]],
    767769    'L=28':[[0.21225019,0.32031716,0.13604702,0.03132468,0.00362703,0.00018294,0.00000294,0.32573501],
    768         [0.13219496,-0.17206256,-0.08742608,0.32671661,0.17973107,0.02567515,0.32619598],
    769         [0.07989184,-0.16735346,0.18839770,-0.20705337,0.12926808,0.42715602]],
     770        [0.13219496,-0.17206256,-0.08742608,0.32671661,0.17973107,0.02567515,0.32619598,0.0],
     771        [0.07989184,-0.16735346,0.18839770,-0.20705337,0.12926808,0.42715602,0.0,0.0]],
    770772    'L=30':[[-0.14878368,0.01524973,0.33628434,0.22632587,0.05790047,0.00609812,0.00022898,0.32573594],
    771         [-0.11721726,0.20915005,-0.11723436,-0.07815329,0.31318947,0.13655742,0.33241385],
    772         [-0.04297703,0.09317876,-0.11831248,0.17355132,-0.28164031,0.42719361]],
     773        [-0.11721726,0.20915005,-0.11723436,-0.07815329,0.31318947,0.13655742,0.33241385,0.0],
     774        [-0.04297703,0.09317876,-0.11831248,0.17355132,-0.28164031,0.42719361,0.0,0.0]],
    773775    'L=32':[[0.20533892,0.32087437,0.15187897,0.04249238,0.00670516,0.00054977,0.00002018,0.00000024,0.32573501],
    774         [0.12775091,-0.13523423,-0.14935701,0.28227378,0.23670434,0.05661270,0.00469819,0.32578978],
    775         [0.09703829,-0.19373733,0.18610682,-0.14407046,0.00220535,0.26897090,0.36633402]],
     776        [0.12775091,-0.13523423,-0.14935701,0.28227378,0.23670434,0.05661270,0.00469819,0.32578978,0.0],
     777        [0.09703829,-0.19373733,0.18610682,-0.14407046,0.00220535,0.26897090,0.36633402,0.0,0.0]],
    776778    'L=34':[[-0.14409234,-0.01343681,0.31248977,0.25557722,0.08571889,0.01351208,0.00095792,0.00002550,0.32573508],
    777         [-0.11527834,0.18472133,-0.04403280,-0.16908618,0.27227021,0.21086614,0.04041752,0.32688152],
    778         [-0.06773139,0.14120811,-0.15835721,0.18357456,-0.19364673,0.08377174,0.43116318]]
     779        [-0.11527834,0.18472133,-0.04403280,-0.16908618,0.27227021,0.21086614,0.04041752,0.32688152,0.0],
     780        [-0.06773139,0.14120811,-0.15835721,0.18357456,-0.19364673,0.08377174,0.43116318,0.0,0.0]]
    779781    }
    780782   
     
    788790    Fln = np.zeros(len(SHCoef))
    789791    for i,term in enumerate(SHCoef):
    790         if abs(SHCoef[term]) > 1e-6:
    791             l,m,n = eval(term.strip('C'))
    792             lNorm = 4.*np.pi*(2.*l+1.)
    793             if SGData['SGLaue'] in ['m3','m3m']:
    794                 L = [i*4 for i in range(l/4)]
    795                 Kcl = 0.0
    796                 for i in L:
    797                     im = i/4
    798                     pcrs = ptx.pyplmpsi(l,i,phi)
    799                     Kcl += BOH['L='+str(l)][n-1][l/2-1]*pcrs*cosd(i*beta)       
    800             else:                #all but cubic
    801                 pcrs = ptx.pyplmpsi(l,n,phi)*RSQPI
    802                 if not n:
    803                     pcrs /= SQ2
    804                 if SGData['SGLaue'] in ['mmm','4/mmm','6/mmm']:
    805                     if n%6 == 3:
    806                         Kcl = pcrs*sind(n*beta)
    807                     else:
    808                         Kcl = pcrs*cosd(n*beta)
    809                 elif SGData['SGLaue'] in ['3mR','3m1','31m']:
    810                     Kcl = pcrs*cosd(n*beta)
    811                 else:
    812                     Kcl = pcrs*(cosd(n*beta)+sind(n*beta))
    813                                    
    814             Fln[i] = SHCoef[term]*Kcl*lNorm
     792         l,m,n = eval(term.strip('C'))
     793         lNorm = 4.*np.pi/(2.*l+1.)
     794         if SGData['SGLaue'] in ['m3','m3m']:
     795             Kcl = 0.0
     796             for j in range(0,l+1,4):
     797                 im = j/4+1
     798                 pcrs = ptx.pyplmpsi(l,j,phi)
     799                 Kcl += BOH['L='+str(l)][n-1][im-1]*pcrs*cosd(j*beta)       
     800         else:                #all but cubic
     801             pcrs = ptx.pyplmpsi(l,n,phi)*RSQPI
     802             if n == 0:
     803                 pcrs /= SQ2
     804             if SGData['SGLaue'] in ['mmm','4/mmm','6/mmm']:
     805                 if n%6 == 3:
     806                     Kcl = pcrs*sind(n*beta)
     807                 else:
     808                     Kcl = pcrs*cosd(n*beta)
     809             elif SGData['SGLaue'] in ['3mR','3m1','31m']:
     810                 Kcl = pcrs*cosd(n*beta)
     811             else:
     812                 Kcl = pcrs*(cosd(n*beta)+sind(n*beta))
     813         Fln[i] = SHCoef[term]*Kcl*lNorm
    815814    ODFln = dict(zip(SHCoef.keys(),list(zip(SHCoef.values(),Fln))))
    816     return ODFln
     815    return ODFln
     816   
     817def textureIndex(SHCoef):
     818    Tindx = 1.0
     819    for term in SHCoef:
     820        l,m,n = eval(term.strip('C'))
     821        Tindx += SHCoef[term]**2/(2.0*l+1.)
     822    return Tindx
     823   
    817824   
    818825def polfcal(ODFln,SamSym,psi,gam):
     826    import pytexture as ptx
    819827    RSQPI = 0.5641895835478
    820828    SQ2 = 1.414213562373
    821     PolVal = 1.0
     829    PolVal = np.ones_like(gam)
    822830    for term in ODFln:
    823         if ODFln[term][1] > 1.e-3:
     831        if abs(ODFln[term][1]) > 1.e-3:
    824832            l,m,n = eval(term.strip('C'))
    825833            psrs = ptx.pyplmpsi(l,m,psi)
    826834            if SamSym in ['-1','2/m']:
    827                 if m:
     835                if m != 0:
    828836                    Ksl = RSQPI*psrs*(cosd(m*gam)+sind(m*gam))
    829837                else:
    830                     ksl = RSQPI*psrs/SQ2
     838                    Ksl = RSQPI*psrs/SQ2
    831839            else:
    832                 if m:
     840                if m != 0:
    833841                    Ksl = RSQPI*psrs*cosd(m*gam)
    834842                else:
    835843                    Ksl = RSQPI*psrs/SQ2
    836         PolVal += ODFln[term][1]*Ksl
     844            PolVal += ODFln[term][1]*Ksl
    837845    return PolVal
    838846   
     
    900908]),
    901909]
    902 
     910    global FLnhTestData
     911    FLnhTestData = [{
     912    'C(4,0,0)': (0.965, 0.42760447),
     913    'C(2,0,0)': (1.0122, -0.80233610),
     914    'C(2,0,2)': (0.0061, 8.37491546E-03),
     915    'C(6,0,4)': (-0.0898, 4.37985696E-02),
     916    'C(6,0,6)': (-0.1369, -9.04081762E-02),
     917    'C(6,0,0)': (0.5935, -0.18234928),
     918    'C(4,0,4)': (0.1872, 0.16358127),
     919    'C(6,0,2)': (0.6193, 0.27573633),
     920    'C(4,0,2)': (-0.1897, 0.12530720)},[1,0,0]]
    903921def test0():
    904922    if NeedTestData: TestData()
  • trunk/GSASIIphsGUI.py

    r303 r311  
    18541854            textureData = generalData['SH Texture'] = {'Order':0,'Model':'cylindrical',
    18551855                'Sample omega':[False,0.0],'Sample chi':[False,0.0],'Sample phi':[False,0.0],
    1856                 'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1]}
     1856                'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1],
     1857                'PFxyz':[0,0,1.],'PlotType':'Pole figure'}
     1858        try:                        #another fix!
     1859            x = textureData['PlotType']
     1860        except KeyError:
     1861            textureData.update({'PFxyz':[0,0,1.],'PlotType':'Pole figure'})
    18571862        shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
    18581863        SamSym = dict(zip(shModels,['0','-1','2/m','mmm']))
     
    18771882            UseList[hist]['Show'] = Obj.GetValue()
    18781883            UpdateDData()
     1884            G2plt.PlotStrain(self,data)
    18791885           
    18801886        def OnShOrder(event):
     
    18821888            textureData['SH Coeff'][1] = SetSHCoef()
    18831889            UpdateDData()
     1890            G2plt.PlotTexture(self,data)
    18841891                       
    18851892        def OnShModel(event):
     
    18871894            textureData['SH Coeff'][1] = SetSHCoef()
    18881895            UpdateDData()
     1896            G2plt.PlotTexture(self,data)
    18891897           
    18901898        def OnSHRefine(event):
     
    19071915            Obj.SetValue('%8.2f'%(value))
    19081916            textureData[valIndx[Obj.GetId()]][1] = value
     1917            G2plt.PlotTexture(self,data)
    19091918           
    19101919        def OnODFValue(event):
     
    19161925            Obj.SetValue('%8.3f'%(value))
    19171926            textureData['SH Coeff'][1][ODFIndx[Obj.GetId()]] = value
     1927            G2plt.PlotTexture(self,data)
     1928           
     1929        def OnPfType(event):
     1930            textureData['PlotType'] = pfType.GetValue()
     1931            UpdateDData()
     1932            G2plt.PlotTexture(self,data)
    19181933           
    19191934        def OnPFValue(event):
    19201935            Obj = event.GetEventObject()
    1921             try:
    1922                 value =  int(Obj.GetValue())
    1923             except ValueError:
    1924                 value = textureData['PFhkl'][pfIndx[Obj.GetId()]]
    1925             Obj.SetValue('%3d'%(value))
    1926             textureData['PFhkl'][pfIndx[Obj.GetId()]] = value
    1927             G2plt.PlotSphHarmTexture(self,generalData)           
     1936            if textureData['PlotType'] in ['Pole figure','Pole distribution','Axial pole distribution']:
     1937                try:
     1938#                    value =  int(Obj.GetValue())
     1939                    value = '['+Obj.GetValue()+']'
     1940                    hkl = eval(value)
     1941                except:
     1942                    value = str(textureData['PFhkl'])
     1943                    hkl = eval(value)
     1944#                    value = textureData['PFhkl'][pfIndx[Obj.GetId()]]
     1945                Obj.SetValue('%d,%d,%d'%(hkl[0],hkl[1],hkl[2]))
     1946#                Obj.SetValue('%3d'%(value))
     1947#                textureData['PFhkl'][pfIndx[Obj.GetId()]] = value
     1948                textureData['PFhkl'] = hkl
     1949            else:
     1950                try:
     1951                    value =  float(Obj.GetValue())
     1952                except ValueError:
     1953                    value = textureData['PFxyz'][pfIndx[Obj.GetId()]]
     1954                Obj.SetValue('%3.1f'%(value))
     1955                textureData['PFxyz'][pfIndx[Obj.GetId()]] = value
     1956            G2plt.PlotTexture(self,data)
    19281957       
    19291958        def OnScaleRef(event):
     
    21102139        mainSizer.Add(shSizer,0,0)
    21112140        mainSizer.Add((0,5),0)
     2141        mainSizer.Add(wx.StaticText(dataDisplay,-1,
     2142            'Texture Index J = %7.3f'%(G2lat.textureIndex(textureData['SH Coeff'][1]))),
     2143            0,wx.ALIGN_CENTER_VERTICAL)
     2144        mainSizer.Add((0,5),0)
    21122145        if textureData['SHShow']:
    21132146            mainSizer.Add(wx.StaticText(dataDisplay,-1,'Spherical harmonic coefficients: '),0,wx.ALIGN_CENTER_VERTICAL)
     
    21272160            mainSizer.Add((0,5),0)
    21282161        PFSizer = wx.BoxSizer(wx.HORIZONTAL)
    2129         PFSizer.Add(wx.StaticText(dataDisplay,-1,'Display pole figure for HKL: '),0,wx.ALIGN_CENTER_VERTICAL)
    2130         pfIndx = {}
    2131         for i in range(3):
    2132             pfVal = wx.TextCtrl(dataDisplay,wx.ID_ANY,'%3d'%(textureData['PFhkl'][i]),size=(40,20),style=wx.TE_PROCESS_ENTER)
    2133             pfIndx[pfVal.GetId()] = i
     2162        PFSizer.Add(wx.StaticText(dataDisplay,-1,'Texture plot type: '),0,wx.ALIGN_CENTER_VERTICAL)
     2163        choices = ['Pole figure','Pole distribution','Axial pole distribution','Inverse pole figure','Inverse distribution']           
     2164        pfType = wx.ComboBox(dataDisplay,-1,value=str(textureData['PlotType']),choices=choices,
     2165            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2166        pfType.Bind(wx.EVT_COMBOBOX,OnPfType)
     2167        PFSizer.Add(pfType,0,wx.ALIGN_CENTER_VERTICAL)
     2168        mainSizer.Add(PFSizer,0,wx.ALIGN_CENTER_VERTICAL)
     2169        if textureData['PlotType'] in ['Pole figure','Pole distribution','Axial pole distribution']:
     2170            PFSizer.Add(wx.StaticText(dataDisplay,-1,'  Display pole figure for HKL: '),0,wx.ALIGN_CENTER_VERTICAL)
     2171#            pfIndx = {}
     2172#            for i in range(3):
     2173#                pfVal = wx.TextCtrl(dataDisplay,wx.ID_ANY,'%3d'%(textureData['PFhkl'][i]),size=(40,20),style=wx.TE_PROCESS_ENTER)
     2174#                pfIndx[pfVal.GetId()] = i
     2175#                pfVal.Bind(wx.EVT_TEXT_ENTER,OnPFValue)
     2176#                pfVal.Bind(wx.EVT_KILL_FOCUS,OnPFValue)
     2177#                PFSizer.Add(pfVal,0,wx.ALIGN_CENTER_VERTICAL)
     2178            PH = textureData['PFhkl']
     2179            pfVal = wx.TextCtrl(dataDisplay,-1,'%d,%d,%d'%(PH[0],PH[1],PH[2]),style=wx.TE_PROCESS_ENTER)
    21342180            pfVal.Bind(wx.EVT_TEXT_ENTER,OnPFValue)
    21352181            pfVal.Bind(wx.EVT_KILL_FOCUS,OnPFValue)
    2136             PFSizer.Add(pfVal,0,wx.ALIGN_CENTER_VERTICAL)           
    2137         mainSizer.Add(PFSizer,0,wx.ALIGN_CENTER_VERTICAL)
     2182            PFSizer.Add(pfVal,0,wx.ALIGN_CENTER_VERTICAL)
     2183        else:
     2184            PFSizer.Add(wx.StaticText(dataDisplay,-1,'  Display inverse pole figure for XYZ: '),0,wx.ALIGN_CENTER_VERTICAL)
     2185            pfIndx = {}
     2186            for i in range(3):
     2187                pfVal = wx.TextCtrl(dataDisplay,wx.ID_ANY,'%3.1f'%(textureData['PFxyz'][i]),size=(40,20),style=wx.TE_PROCESS_ENTER)
     2188                pfIndx[pfVal.GetId()] = i
     2189                pfVal.Bind(wx.EVT_TEXT_ENTER,OnPFValue)
     2190                pfVal.Bind(wx.EVT_KILL_FOCUS,OnPFValue)
     2191                PFSizer.Add(pfVal,0,wx.ALIGN_CENTER_VERTICAL)
    21382192        mainSizer.Add((0,5),0)
    21392193        mainSizer.Add(wx.StaticText(dataDisplay,-1,'Sample orientation angles: '),0,wx.ALIGN_CENTER_VERTICAL)
     
    23482402
    23492403        dataDisplay.SetSizer(mainSizer)
    2350         mainSizer.FitInside(self.dataFrame)
    2351         Size = mainSizer.Fit(self.dataFrame)
    2352         Size[0] = max(Size[0],300)+20
    2353         Size[1] += 30                        #compensate for status bar
    2354         DData.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-10)
     2404        mainSizer.Fit(self.dataFrame)
     2405        Size = mainSizer.GetMinSize()
     2406        Size[0] += 40
     2407        Size[1] = max(Size[1],250) + 20
    23552408        dataDisplay.SetSize(Size)
     2409        DData.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
     2410        Size[1] = min(Size[1],450)
    23562411        self.dataFrame.setSizePosLeft(Size)
    23572412       
     
    25622617            UpdateDData()           
    25632618            G2plt.PlotStrain(self,data)
     2619            G2plt.PlotTexture(self,data)
    25642620        elif text == 'Draw Options':
    25652621            self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
  • trunk/GSASIIplot.py

    r303 r311  
    4848npcosd = lambda x: np.cos(x*np.pi/180.)
    4949npacosd = lambda x: 180.*np.arccos(x)/np.pi
     50npasind = lambda x: 180.*np.arcsin(x)/np.pi
     51npatan2d = lambda x,y: 180.*np.arctan2(x,y)/np.pi
    5052   
    5153class G2PlotMpl(wx.Panel):   
     
    11811183    Page.canvas.draw()
    11821184   
    1183 def PlotSphHarmTexture(self,generalData):
     1185def PlotTexture(self,data):
    11841186    '''Pole figure, inverse pole figure(?), 3D pole distribution and 3D inverse pole distribution(?)
    11851187    plotting; Need way to select 
    11861188    pole figure or pole distribution to be displayed - do in key enter menu
    1187     dict generalData contains all phase info needed
     1189    dict generalData contains all phase info needed which is in data
    11881190    '''
    11891191    shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
    11901192    SamSym = dict(zip(shModels,['0','-1','2/m','mmm']))
     1193    PatternId = self.PatternId
     1194    generalData = data['General']
    11911195    SGData = generalData['SGData']
    11921196    textureData = generalData['SH Texture']
    1193     print 'Texture plot'
    11941197    SHData = generalData['SH Texture']
    11951198    SHCoef = SHData['SH Coeff'][1]
    11961199    cell = generalData['Cell'][1:7]
    1197     PH = np.array(SHData['PFhkl'])
    1198     phi,beta = G2lat.CrsAng(PH,cell,SGData)
    11991200    Start = True
    1200     ODFln = G2lat.Flnh(Start,SHCoef,phi,beta,SGData)
     1201       
     1202       
     1203    try:
     1204        plotNum = self.G2plotNB.plotList.index('Texture')
     1205        Page = self.G2plotNB.nb.GetPage(plotNum)
     1206        Page.figure.clf()
     1207        Plot = Page.figure.gca()
     1208    except ValueError:
     1209        Plot = self.G2plotNB.addMpl('Texture').gca()
     1210        plotNum = self.G2plotNB.plotList.index('Texture')
     1211        Page = self.G2plotNB.nb.GetPage(plotNum)
     1212    Page.SetFocus()
     1213   
     1214    if 'Axial' in SHData['PlotType']:
     1215        PH = np.array(SHData['PFhkl'])
     1216        phi,beta = G2lat.CrsAng(PH,cell,SGData)
     1217        ODFln = G2lat.Flnh(Start,SHCoef,phi,beta,SGData)
     1218        X = np.linspace(0,90.0,26)
     1219        Y = np.zeros_like(X)
     1220        for i,a in enumerate(X):
     1221            Y[i] = G2lat.polfcal(ODFln,SamSym[textureData['Model']],a,0.0)
     1222        Plot.plot(X,Y,color='k',label=str(SHData['PFhkl']))
     1223        Plot.legend(loc='best')
     1224        Plot.set_title('Axial distribution for HKL='+str(SHData['PFhkl']))
     1225        Plot.set_xlabel(r'$\psi$',fontsize=16)
     1226        Plot.set_ylabel('MRD',fontsize=14)
     1227       
     1228       
     1229    else:       
     1230        self.G2plotNB.status.SetStatusText('Adjust frame size to get desired aspect ratio',1)
     1231        if 'inverse' in SHData['PlotType']:
     1232            PX = np.array(SHData['PFxyz'])
     1233           
     1234        else:
     1235            PH = np.array(SHData['PFhkl'])
     1236            phi,beta = G2lat.CrsAng(PH,cell,SGData)
     1237            ODFln = G2lat.Flnh(Start,SHCoef,phi,beta,SGData)
     1238            X,Y = np.meshgrid(np.linspace(1.,-1.,51),np.linspace(-1.,1.,51))
     1239            R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(X,Y).flatten()
     1240            R = np.where(R <= 1.,2.*npasind(R*0.70710678),0.0)
     1241            Z = np.zeros_like(R)
     1242            for i,r in enumerate(R):
     1243                Z[i] = G2lat.polfcal(ODFln,SamSym[textureData['Model']],r,P[i])
     1244            Z = np.reshape(Z,(51,51))
     1245            Plot.imshow(Z.T,aspect='equal',cmap='binary')
     1246   
     1247               
     1248    Page.canvas.draw()
    12011249
    12021250           
  • trunk/GSASIIpwd.py

    r309 r311  
    768768            print "%s%7.2f%s%12.6g%s%6.2f" % ('Rwp = ',Rwp,'%, chi**2 = ',chisq,' reduced chi**2 = ',GOF)
    769769            try:
    770                 sig = np.sqrt(np.diag(result[1])*chisq)
     770                sig = np.sqrt(np.diag(result[1])*GOF)
    771771                if np.any(np.isnan(sig)):
    772772                    print '*** Least squares aborted - some invalid esds possible ***'
  • trunk/GSASIIpwdGUI.py

    r303 r311  
    664664    def OnStartVol(event):
    665665        try:
    666             stVol = int(startVol.GetValue())
     666            stVol = int(float(startVol.GetValue()))
     667            if stVol < 25:
     668                raise ValueError
    667669        except ValueError:
    668670            stVol = 25
     
    678680            Zero = min(0.1,max(-0.1,float(zero.GetValue())))
    679681        except ValueError:
    680             Zero = 0.1
     682            Zero = 0.0
    681683        controls[1] = Zero
    682         zero.SetValue("%.2f"%(Zero))
     684        zero.SetValue("%.4f"%(Zero))
    683685       
    684686    def OnZeroVar(event):
     
    790792        ibrav = bravaisSymb.index(controls[5])
    791793        dmin = G2indx.getDmin(peaks)-0.005
    792         Lhkl,M20,X20,A = G2indx.refinePeaks(peaks,ibrav,A)
    793         controls[6:12] = G2lat.A2cell(A)
    794         controls[12] = G2lat.calc_V(A)
     794        Lhkl,M20,X20,Aref,Zero = G2indx.refinePeaks(peaks,ibrav,A,controls[:2])
     795        controls[:2] = Zero
     796        controls[6:12] = G2lat.A2cell(Aref)
     797        controls[12] = G2lat.calc_V(Aref)
    795798        data = [controls,bravais,cells,dmin]
    796799        self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'Unit Cells List'),data)
    797         self.HKL = G2lat.GenHBravais(dmin,ibrav,A)
     800        self.HKL = G2lat.GenHBravais(dmin,ibrav,Aref)
    798801        UpdateUnitCellsGrid(self,data)
    799802        print "%s%10.3f" % ('refinement M20 = ',M20)
    800803        print 'unindexed lines = ',X20
    801         cellPrint(ibrav,A)
     804        cellPrint(ibrav,Aref)
    802805        for hkl in self.HKL:
    803806            hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))             
     
    960963    littleSizer.Add(NcNo,0,wx.ALIGN_CENTER_VERTICAL)
    961964    littleSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' Start Volume '),0,wx.ALIGN_CENTER_VERTICAL)
    962     startVol = wx.TextCtrl(self.dataDisplay,value=str(controls[3]),style=wx.TE_PROCESS_ENTER)
     965    startVol = wx.TextCtrl(self.dataDisplay,value=str('%d'%(controls[3])),style=wx.TE_PROCESS_ENTER)
    963966    startVol.Bind(wx.EVT_TEXT_ENTER,OnStartVol)
    964967    startVol.Bind(wx.EVT_KILL_FOCUS,OnStartVol)
     
    980983    mainSizer.Add(littleSizer,0)
    981984    mainSizer.Add((5,5),0)
    982     littleSizer = wx.FlexGridSizer(1,3,5,5)
    983     littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Zero offset"),0,wx.ALIGN_CENTER_VERTICAL)
    984     zero = wx.TextCtrl(self.dataDisplay,value="%.2f"%(controls[1]),style=wx.TE_PROCESS_ENTER)
    985     zero.Bind(wx.EVT_TEXT_ENTER,OnZero)
    986     zero.Bind(wx.EVT_KILL_FOCUS,OnZero)
    987     littleSizer.Add(zero,0,wx.ALIGN_CENTER_VERTICAL)
    988     zeroVar = wx.CheckBox(self.dataDisplay,label="Vary? (not implemented)")
    989     zeroVar.Bind(wx.EVT_CHECKBOX,OnZeroVar)
    990     littleSizer.Add(zeroVar,0,wx.ALIGN_CENTER_VERTICAL)
    991     mainSizer.Add(littleSizer,0)
    992     mainSizer.Add((5,5),0)
     985   
    993986    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' Cell Refinement: '),0,wx.ALIGN_CENTER_VERTICAL)
    994987    mainSizer.Add((5,5),0)
    995     littleSizer = wx.FlexGridSizer(1,3,5,5)
     988    littleSizer = wx.BoxSizer(wx.HORIZONTAL)
    996989    littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Bravais lattice "),0,wx.ALIGN_CENTER_VERTICAL)
    997990    bravSel = wx.Choice(self.dataDisplay,choices=bravaisSymb)
     
    999992    bravSel.Bind(wx.EVT_CHOICE,OnBravSel)
    1000993    littleSizer.Add(bravSel,0,wx.ALIGN_CENTER_VERTICAL)
    1001     hklShow = wx.CheckBox(self.dataDisplay,label="Show starting hkl positions")
     994    littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Zero offset"),0,wx.ALIGN_CENTER_VERTICAL)
     995    zero = wx.TextCtrl(self.dataDisplay,value="%.4f"%(controls[1]),style=wx.TE_PROCESS_ENTER)
     996    zero.Bind(wx.EVT_TEXT_ENTER,OnZero)
     997    zero.Bind(wx.EVT_KILL_FOCUS,OnZero)
     998    littleSizer.Add(zero,0,wx.ALIGN_CENTER_VERTICAL)
     999    zeroVar = wx.CheckBox(self.dataDisplay,label="Refine? (not implemented)")
     1000    zeroVar.Bind(wx.EVT_CHECKBOX,OnZeroVar)
     1001    littleSizer.Add(zeroVar,0,wx.ALIGN_CENTER_VERTICAL)
     1002    hklShow = wx.CheckBox(self.dataDisplay,label="  Show starting hkl positions")
    10021003    hklShow.Bind(wx.EVT_CHECKBOX,OnHklShow)
    10031004    littleSizer.Add(hklShow,0,wx.ALIGN_CENTER_VERTICAL)
    10041005    mainSizer.Add(littleSizer,0)
     1006   
    10051007    mainSizer.Add((5,5),0)
    10061008    ibrav = SetLattice(controls)
     
    10231025            littleSizer.Add(volVal,0,wx.ALIGN_CENTER_VERTICAL)
    10241026    mainSizer.Add(littleSizer,0)
     1027       
    10251028    mainSizer.Layout()   
    10261029    self.dataDisplay.SetSizer(mainSizer)
Note: See TracChangeset for help on using the changeset viewer.