Changeset 2175 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Mar 17, 2016 1:52:26 PM (7 years ago)
Author:
vondreele
Message:

modify DIFFaXDialog - more parameters
add selected are plot as a pylab plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r2174 r2175  
    17381738################################################################################
    17391739
    1740 def StackSim(Layers,HistName,scale,background,limits,inst,profile):
     1740def StackSim(Layers,ctrls,HistName='',scale=0.,background={},limits=[],inst={},profile=[]):
    17411741    '''Simulate powder pattern from stacking faults using DIFFaX
    17421742   
     
    17791779    sf.close()
    17801780    #make DIFFaX control.dif file - future use GUI to set some of these flags
    1781     x0 = profile[0]
    1782     iBeg = np.searchsorted(x0,limits[0])
    1783     iFin = np.searchsorted(x0,limits[1])
    1784     if iFin-iBeg > 20000:
    1785         iFin = iBeg+20000
    1786     Dx = (x0[iFin]-x0[iBeg])/(iFin-iBeg)
    17871781    cf = open('control.dif','w')
    1788     cf.write('GSASII-DIFFaX.dat\n0\n0\n3\n')
    1789     cf.write('%.6f %.6f %.6f\n1\n1\nend\n'%(x0[iBeg],x0[iFin],Dx))
     1782    if ctrls == '0\n0\n3\n':
     1783        x0 = profile[0]
     1784        iBeg = np.searchsorted(x0,limits[0])
     1785        iFin = np.searchsorted(x0,limits[1])
     1786        if iFin-iBeg > 20000:
     1787            iFin = iBeg+20000
     1788        Dx = (x0[iFin]-x0[iBeg])/(iFin-iBeg)
     1789        cf.write('GSASII-DIFFaX.dat\n'+ctrls)
     1790        cf.write('%.6f %.6f %.6f\n1\n1\nend\n'%(x0[iBeg],x0[iFin],Dx))
     1791    else:
     1792        cf.write('GSASII-DIFFaX.dat\n'+ctrls)
     1793        inst = {'Type':['XSC','XSC',]}
    17901794    cf.close()
    17911795    #make DIFFaX data file
     
    17961800    elif 'N' in inst['Type'][0]:
    17971801        df.write('NEUTRON\n')
    1798     df.write('%.4f\n'%(G2mth.getMeanWave(inst)))
    1799     U = forln2*inst['U'][1]/10000.
    1800     V = forln2*inst['V'][1]/10000.
    1801     W = forln2*inst['W'][1]/10000.
    1802     HWHM = U*nptand(x0[iBeg:iFin]/2.)**2+V*nptand(x0[iBeg:iFin]/2.)+W
    1803     HW = np.mean(HWHM)
    1804 #    df.write('PSEUDO-VOIGT 0.015 -0.0036 0.009 0.605 TRIM\n')
    1805 #    df.write('GAUSSIAN %.6f TRIM\n'%(HW))     #fast option - might not really matter
    1806     df.write('GAUSSIAN %.6f %.6f %.6f TRIM\n'%(U,V,W))    #slow - make a GUI option?
     1802    if ctrls == '0\n0\n3\n':
     1803        df.write('%.4f\n'%(G2mth.getMeanWave(inst)))
     1804        U = forln2*inst['U'][1]/10000.
     1805        V = forln2*inst['V'][1]/10000.
     1806        W = forln2*inst['W'][1]/10000.
     1807        HWHM = U*nptand(x0[iBeg:iFin]/2.)**2+V*nptand(x0[iBeg:iFin]/2.)+W
     1808        HW = np.mean(HWHM)
     1809    #    df.write('PSEUDO-VOIGT 0.015 -0.0036 0.009 0.605 TRIM\n')
     1810    #    df.write('GAUSSIAN %.6f TRIM\n'%(HW))     #fast option - might not really matter
     1811        df.write('GAUSSIAN %.6f %.6f %.6f TRIM\n'%(U,V,W))    #slow - make a GUI option?
     1812    else:
     1813        df.write('0.10\nNone\n')
    18071814    df.write('STRUCTURAL\n')
    18081815    a,b,c = Layers['Cell'][1:4]
     
    18931900    #cleanup files..
    18941901        os.remove('GSASII-DIFFaX.spc')
     1902    elif os.path.exists('GSASII-DIFFaX.sadp'):
     1903        Sadp = np.fromfile('GSASII-DIFFaX.sadp','>u2')
     1904        Sadp = np.reshape(Sadp,(256,-1))
     1905        Layers['Sadp']['Img'] = Sadp
     1906        os.remove('GSASII-DIFFaX.sadp')
    18951907    os.remove('data.sfc')
    18961908    os.remove('control.dif')
Note: See TracChangeset for help on using the changeset viewer.