-
Notifications
You must be signed in to change notification settings - Fork 6
Xrrmodel
ttrainor edited this page Jan 8, 2012
·
3 revisions
Setup your imports
>>from matplotlib import pyplot >>import xrr
Build up the multilayer structure:
The first layer (0) is the base layer, it is always assumed infinitely thick for the R calc (ie all phase shift calcs). For the FY calc, the layer 0 thickness sets the depth to which the yield is calculated, unless calc_params[12], pdepth, is > 0. If pdepth is greater than zero than its assumed to be a multiplier - the depth of the FY integration in the base layer is calc from this multiplier times the penetration depth (which is angle dependent). This is much faster since it limits the integration range to small values at low angles. In either case you may have to play with these parameter to see when it no longer contributes to the FY (if the element of interest is in the base layer) The top layer should be a low density layer that approximates air
The thicknesses are in angstroms
>>d = num.array([50000.0, 100.0, 10.0, 1000.0],dtype=num.double)
The corresponding densities of the layers, these are g/cm^3
>>rho = num.array([3.0, 4.0, 1.7, 0.0002],dtype=num.double)
Debye-Waller type interface roughness parameters: r = r*exp(-(q*sigma)^2)
The first value is the 1/0 interface roughness ie the interface between the first layer and the base layer there are nlayer - 1 total interfaces.
>>sigma = num.array([10, 10, 10],dtype=num.double)
List of all elements that make up the multilayer composition: N, O, Al, Si, Fe
>>elem_z = num.array([7, 8, 13, 14, 26],dtype=num.double)
Composition is a matrix giving the mole fraction or stiochiometric coefficients of each of the above elements in each layer.
Note if the sum of the comp numbers for a layer does not sum to 1 then they will be normalized to mole fraction -> base layer = SiO2 -> layer 1 = Al (with trace of Fe) -> layer 2 = SiAlFeO (arb ratios) -> layer 3 = N2 therefore, comp[0] = fraction of N in each layer etc.. {{{ >>comp = [ [0.0, 0.0, 0.0, 1.0], # N [2.0, 0.0, 0.52, 0.0], # O [0.0, 0.999, 0.07, 0.0], # Al [1.0, 0.0, 0.4, 0.0], # Si [0.00001, 0.001, 0.1, 0.0]] # Fe >>comp = num.array(comp,dtype = num.double)
theta is the arrays of angles for the calculation
>>theta = num.arange(0.01, 1.0, 0.01, dtype=num.double)
calc_params holds a bunch of parameter stuff
>>calc_params = {'energy':10000.,'wconv':0.01,'slen':10.,'bvert':0.01, 'aflag':1.,'fyidx':4,'fyenergy':7000., 'delz':5.0,'pdepth':3.0}
Create an instance of the model
>>ref = xrr.RefModel(d=d,rho=rho,sigma=sigma,comp=comp,elem_z=elem_z, theta=theta,params=calc_params)
plot R
>>pyplot.subplot(3,1,1) >>pyplot.semilogy() >>ref.calc_R() >>pyplot.plot(ref.theta,ref.R,'g.')
Run the FY calcs
>>ref.calc_FY() >>pyplot.subplot(3,1,1) >>pyplot.plot(ref.theta,ref.R,'r') >>pyplot.subplot(3,1,2) >>pyplot.plot(ref.theta,ref.Y)
histogram of Fe dist
>>pyplot.subplot(3,1,3) >>idx = num.arange(len(comp[4])) >>pyplot.bar(idx,comp[4])