Changeset 2175 for trunk/GSASIIpwd.py
- Timestamp:
- Mar 17, 2016 1:52:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwd.py
r2174 r2175 1738 1738 ################################################################################ 1739 1739 1740 def StackSim(Layers, HistName,scale,background,limits,inst,profile):1740 def StackSim(Layers,ctrls,HistName='',scale=0.,background={},limits=[],inst={},profile=[]): 1741 1741 '''Simulate powder pattern from stacking faults using DIFFaX 1742 1742 … … 1779 1779 sf.close() 1780 1780 #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+200001786 Dx = (x0[iFin]-x0[iBeg])/(iFin-iBeg)1787 1781 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',]} 1790 1794 cf.close() 1791 1795 #make DIFFaX data file … … 1796 1800 elif 'N' in inst['Type'][0]: 1797 1801 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') 1807 1814 df.write('STRUCTURAL\n') 1808 1815 a,b,c = Layers['Cell'][1:4] … … 1893 1900 #cleanup files.. 1894 1901 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') 1895 1907 os.remove('data.sfc') 1896 1908 os.remove('control.dif')
Note: See TracChangeset
for help on using the changeset viewer.