Changeset 2170
- Timestamp:
- Mar 14, 2016 9:13:28 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r2167 r2170 291 291 generalData['vdWRadii'].append(Info['Vdrad']) 292 292 if atom[ct] in generalData['Isotope']: 293 if generalData['Isotope'][atom[ct]] not in generalData['Isotopes'][atom[ct]]: 294 isotope = generalData['Isotopes'][atom[ct]].keys()[-1] 295 generalData['Isotope'][atom[ct]] = isotope 293 296 generalData['AtomMass'].append(Info['Isotopes'][generalData['Isotope'][atom[ct]]]['Mass']) 294 297 else: 295 298 generalData['Isotope'][atom[ct]] = 'Nat. Abund.' 299 if 'Nat. Abund.' not in generalData['Isotopes'][atom[ct]]: 300 isotope = generalData['Isotopes'][atom[ct]].keys()[-1] 301 generalData['Isotope'][atom[ct]] = isotope 296 302 generalData['AtomMass'].append(Info['Mass']) 297 303 generalData['NoAtoms'][atom[ct]] = atom[cs-1]*float(atom[cs+1]) … … 624 630 item = Indx[Obj.GetId()] 625 631 isotope = Obj.GetValue() 626 generalData['Isotope'][item] = isotope632 data['General']['Isotope'][item] = isotope 627 633 indx = generalData['AtomTypes'].index(item) 628 634 data['General']['AtomMass'][indx] = generalData['Isotopes'][item][isotope]['Mass'] … … 677 683 colorTxt.SetBackgroundColour(wx.Colour(R,G,B)) 678 684 elemSizer.Add(colorTxt,0,WACV) 685 679 686 return elemSizer 680 687 … … 2885 2892 PWDR = data['Histograms'][HistName] 2886 2893 G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,HistName) 2887 2894 sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId( 2895 G2frame,G2frame.PatternId, 'Sample Parameters')) 2896 scale = sample['Scale'][0] 2897 background = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId( 2898 G2frame,G2frame.PatternId, 'Background')) 2888 2899 limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId( 2889 2900 G2frame,G2frame.PatternId, 'Limits'))[1] … … 2893 2904 wx.MessageBox("Can't simulate neutron TOF patterns yet",caption='Data error',style=wx.ICON_EXCLAMATION) 2894 2905 return 2895 profile = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1] 2896 2897 G2pwd.StackSim(data['Layers'],HistName,limits,inst,profile) 2906 profile = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1] 2907 G2pwd.StackSim(data['Layers'],HistName,scale,background,limits,inst,profile) 2898 2908 G2plt.PlotPatterns(G2frame,plotType='PWDR') 2899 2909 -
trunk/GSASIIpwd.py
r2167 r2170 1737 1737 ################################################################################ 1738 1738 1739 def StackSim(Layers,HistName, limits,inst,profile):1739 def StackSim(Layers,HistName,scale,background,limits,inst,profile): 1740 1740 '''Simulate powder pattern from stacking faults using DIFFaX 1741 1741 … … 1744 1744 'Layers':[],'Stacking':[],'Transitions':[]} 1745 1745 param: HistName str: histogram name to simulate 'PWDR...' 1746 param: scale float: scale factor 1747 param: background dict: background parameters 1746 1748 param: limits list: min/max 2-theta to be calculated 1747 1749 param: inst dict: instrumnet parameters dictionary … … 1779 1781 iBeg = np.searchsorted(x0,limits[0]) 1780 1782 iFin = np.searchsorted(x0,limits[1]) 1783 if iFin-iBeg > 20000: 1784 iFin = iBeg+19999 1781 1785 x = x0[iBeg:iFin] 1782 1786 dx = x0[iBeg+1]-x0[iBeg] … … 1851 1855 print 'DIFFaX time = %.2fs'%(time.time()-time0) 1852 1856 X = np.loadtxt('GSASII-DIFFaX.spc') 1853 profile[3][:len(X.T[1])] = X.T[1] 1857 bakType,backDict,backVary = SetBackgroundParms(background) 1858 backDict['Lam1'] = G2mth.getWave(inst) 1859 # GSASIIpath.IPyBreak() 1860 iB = np.searchsorted(profile[0],X.T[0])[0] 1861 iF = np.searchsorted(profile[0],X.T[-1])[0] 1862 if not iF: 1863 iF = -1 1864 profile[4][iB:iF] = getBackground('',backDict,bakType,inst['Type'][0],X.T[0])[0] 1865 profile[3][iB:iF] = X.T[1]*scale+profile[4][iB:iF] 1866 if not np.any(profile[1]): #fill dummy data x,y,w,yc,yb,yd 1867 rv = st.poisson(profile[3][iB:iF]) 1868 profile[1][iB:iF] = rv.rvs() 1869 Z = np.ones_like(profile[3][iB:iF]) 1870 Z[1::2] *= -1 1871 profile[1][iB:iF] = profile[3][iB:iF]+np.abs(profile[1][iB:iF]-profile[3][iB:iF])*Z 1872 profile[2][iB:iF] = np.where(profile[1][iB:iF]>0.,1./profile[1][iB:iF],1.0) 1873 profile[5][iB:iF] = profile[1][iB:iF]-profile[3][iB:iF] 1874 1875 1854 1876 #cleanup files.. 1855 1877 os.remove('data.sfc')
Note: See TracChangeset
for help on using the changeset viewer.