Changeset 699 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Aug 7, 2012 2:54:06 PM (9 years ago)
Author:
vondreele
Message:

implement restore data window after refine
implement sample parameters save & load
more on strain fitting
implement input of fractions & other math statements for atom positions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r698 r699  
    196196        print 'Bad refinement - no result'
    197197        return result[0],wave
    198        
    199            
     198                   
    200199def ImageLocalMax(image,w,Xpix,Ypix):
    201200    w2 = w*2
     
    324323    xy = fsolve(func,xy0,args=(azm,phi,R0,R1,A,B))+cent
    325324    return xy
     325   
     326def GetDetXYfromThAzm(Th,Azm,data):
     327    dsp = data['wavelength']/(2.0*npsind(Th))
     328   
     329    return GetDetectorXY(dsp,azm,data)
    326330                   
    327331def GetTthAzmDsp(x,y,data):
     
    409413    cent = data['center']   
    410414    dist = data['distance']
    411     cent = data['center']
    412415    tilt = data['tilt']
    413416    phi = data['rotation']
     
    746749def FitStrSta(Image,StrSta,Controls,Masks):
    747750   
    748     print Image.shape
    749     print StrSta
    750     print Controls
    751     print Masks
     751#    print 'Masks:',Masks
     752    wave = Controls['wavelength']
     753    dist = Controls['distance']
     754    center = Controls['center']
     755    rot = Controls['rotation']
     756    tilt = Controls['tilt']
     757    imSize = Controls['size']
     758    pixSize = Controls['pixelSize']
     759    azmOff = Controls['azmthOff']
     760    scalex = 1000./pixSize[0]
     761    scaley = 1000./pixSize[1]
     762
     763    for ring in StrSta['d-zero']:
     764        ellipse = GetEllipse(ring['Dset'],Controls)
     765        Ring,delt = makeRing(ring['Dset'],ellipse,ring['pixLimit'],ring['cutoff'],scalex,scaley,Image)
     766        Ring = np.array(Ring).T
     767        ring['ImxyObs'] = np.array(Ring[:2])      #need to apply masks to this to eliminate bad points
     768        [x,y] = np.array(makeIdealRing(ellipse)).T
     769        Tth,azm = GetTthAzm(x,y,Controls)
     770        th = Tth/2.
     771        th += np.sum(StrSta['strain']*calcFij(StrAta['phi'],0.,azm,th))
     772        Tth = th*2.
     773       
     774
     775def calcFij(omg,phi,azm,th):
     776    ''' Uses parameters as defined by Bob He & Kingsley Smity, Adv. in X-Ray Anal. 41, 501 (1997)
     777    omg: his omega = sample omega rotation; 0 when incident beam || sample surface, 90
     778            when perp. to sample surface
     779    phi: his phi = sample phi rotation; usually = 0, axis rotates with omg.
     780    azm: his chi = azimuth around incident beam
     781    th:  his theta = theta
     782    '''
     783    a = npsind(th)*npcosd(omg)+npsind(azm)*npcosd(th)*npsind(omg)
     784    b = -npcosd(azm)*npcosd(th)
     785    c = npsind(th)*npsind(omg)-npsind(azm)*npcosd(th)*npcosd(omg)
     786    d = a*npcosd(phi)-b*npsind(phi)
     787    e = a*npsind(phi)+b*npcosd(phi)
     788    Fij = np.array([
     789        [d**2,d*e,c*d],
     790        [d*e,e**2,c*e],
     791        [c*d,c*e,c**2]])
     792    return -Fij*nptand(th)
     793       
Note: See TracChangeset for help on using the changeset viewer.