Ejemplo n.º 1
0
def func( x , *args):
    global TRACK
    rx, ry, rz = x
    #print "\tCalled with ",rx,ry,rz
    oc, d = args
    umat = np.dot( np.dot(  rotmatx(rx),rotmaty(ry)),rotmatz(rz))
    d.crystal.set_orientation( umat )
#    d.crystal.set_wvln( w )
    d.crystal.generate_gve()
    d.computek()
    d.computeomegas()
    dom = np.degrees( d.omega)
    esum = 0
#    print 'oc',oc
#    print 'dom',dom
    f = []
 #   print dom
    for i in range(len(oc)):
        err = (oc[i] - dom)
        j = (err*err).argmin()
        f.append( err[j] )
#        print i,oc[i],dom[j]
#    1/0    
    TRACK+=1
    return f
Ejemplo n.º 2
0
def gof( p, args):
    global SAVEFILE
    rx, ry, rz, tilt, wvln = p

    d.axistilt = tilt
    d.crystal.set_wvln( wvln )
    umat = np.dot( np.dot( rotmatx(rx),rotmaty(ry)),rotmatz(rz))
    d.crystal.set_orientation( umat )
    s = []
    if SAVEFILE:
        sf = open("fitori.dat","w")
    for h,fri,obs in args:
        ocalc = getom( d, h, fri )
        s.append(obs-ocalc)
        if SAVEFILE:
            sf.write( "%-4d %-4d %-4d %-2d "%(h[0],h[1],h[2],fri))
            sf.write( "%.6f %.6f\n"%(obs,ocalc))
    return np.array(s)