- Setup imports
>>import xrr
>>import compound
- Build some chemical components
>>N2 = compound.Component(formula={'N':2})
>>qtz = compound.Component(formula={'Si':1,'O':2})
>>fe2o3 = compound.Component(formula={'Fe':2,'O':3})
>>al2o3 = compound.Component(formula={'Al':2,'O':3}) - Build some layers
>>subs = xrr.Layer(comp=[(qtz,1.),(fe2o3,0.000001)],density=2.65,thickness=1000.,roughness=10.)
>>m1 = xrr.Layer(comp=[(qtz,1.),(fe2o3,0.0001)],density=2.45,thickness=30.,roughness=10.)
>>m2 = xrr.Layer(comp=[(N2,1.)],density=0.001,thickness=1000.,roughness=0.)
>>top = xrr.Layer(comp=[(N2,1.)],density=0.001,thickness=1000.,roughness=0.)
- Parameters
>>delta = 5.
>>theta = num.arange(0.01, 1.0, 0.01)
>>calc_params = {'energy':10000.,'wconv':0.01,'slen':20.,'bvert':0.01,
'aflag':1.,'fyidx':0,'fyenergy':7000.,'delz':delta,'pdepth':2.0} - Create model
>>model = xrr.Model(substrate=subs,layers=[m1,m2],top=top, theta=theta, params=calc_params)
>>model.slabify(delta=delta)
- FY/R on init'd model
>>model.calc_FY(fyel='Fe',fyenergy='Fe Ka')
>>model.plot(ty='calc')
- various other potential plots
>>model.plot(ty='density')
>>model.plot(ty='comp')
>>model.plot(ty='el')
>>model.plot(ty='frac')
>>model.slab.comp_mb()
- Change the element distribution
Note distribution models are defined
throughout the entire interface region!
However, they do not apply to the component
distributions within the substrate or top layers
(these are fixed)
>>dist = {'type':'erf','cen':40.,'sig':20.,'CX':1.}
>>model.slab.add_dpar('Fe2_O3',dist=dist,norm=1,init=True)
>>
>>dist = {'type':'gauss','cen':70.,'sig':10.,'CX':30.}
>>model.slab.add_dpar('Fe2_O3',dist=dist)
>>
>>dist = {'type':'erf','cen':40.,'sig':20.,'CX':1.}
>>model.slab.add_dpar('Si_O2',dist=dist,norm=1,init=True)
>>
>>model.slab.calc_dist() - Recompute the FY
>>model.calc_FY()
>>model.plot(ty='calc',hold=True)
>>model.plot(ty='density')
>>model.plot(ty='comp')
>>model.slab.comp_mb()
- Modify the distribution and recompute FY/R
>>dist = {'cen':60.,'sig':40.,'CX':1.}
>>model.slab.set_dpar('Fe2_O3',dist=dist,didx=0,norm=1)
>>model.slab.calc_dist()
>>model.calc_FY()
>>model.plot(ty='calc',hold=True)
>>model.plot(ty='density')
>>model.plot(ty='comp')
>>model.slab.comp_mb()