Module SampleRepresentation¶
The most extensive part of the work is to create the model for the sample.
We start with a rough overview:
At first you create a heterostructure (SampleRepresentation.Heterostructure) which consists of a certain number of layers.
Each layer is represented by an layer object which is pluged into the heterostructure object. There are different types but they are all derived from SampleRepresentation.LayerObject. Each layer carries several properties. The common ones are thickness and roughness, which are just instances of Parameters.Parameter and therefore fitable. More advanced is the energy-dependent
-tensor (susceptibility tensor) describing the optical properties of the layer (The
-tensor is used instead of the dielectric tensor as is close to zero instead of close to one. This gives higher numeric acuracy.) Its treatment differs for the different layer types:
SampleRepresentation.LayerObject: Energy-independent susceptibility tensor given as array of instances ofParameters.Parameter.SampleRepresentation.MagneticLayerObject: Energy-independent magnetic susceptibility tensor. Diagonal elements as instances ofParameters.Parameter. Off-diagonal elements created from complex magnetic term and angles.SampleRepresentation.ModelChiLayerObject: Susceptibility tensor is user-defined parametrized function of energy.SampleRepresentation.AtomLayerObject: Contains different atoms each with a formfactor and a density. The-tensor is result of a summation.
The last layer object is the most advanced and complicated one. Moreover, the formfactors of the atoms are given as objects which are instances of SampleRepresentation.Formfactor but there are many derived classes for different purposes or sources of the formfactor data resp. If you just want to get a formfactor from the Chantler tables it is enough to state the name of the atom instead of creating a formfactor object by yourself.
SampleRepresentation.Formfactor: Abstract class which just severs as interface and is base class for all the other formfactor classes.SampleRepresentation.FFfromFile: Get the energy-dependent formfactor from a text file.SampleRepresentation.FFfromChantler: Get the energy-dependent formfactor from the Chantler tables.SampleRepresentation.FFfromScaledAbsorption: Formfactor from a XAS measurement but scalable.SampleRepresentation.FFfromFitableModel: Formfactor tensor is user-defined parametrized function of energy.SampleRepresentation.MagneticFormfactor: Off-diagonal elements only given by magnetization and angles. Energy-dependent magnetic termes are user-defined-parametrized functions.SampleRepresentation.MFFfromXMCD: Off-diagonal elements only given by magnetization and angles. Energy-dependent magnetic termes are taken from an XMCD measurement.
Also related to the layer type SampleRepresentation.AtomLayerObject are the density profile classes SampleRepresentation.DensityProfile and SampleRepresentation.DensityProfile_erf. They can be used for the following scenario: You want to model a arbitrary concentration profiles of the atoms in your sample. Therefore you slice your sample in thin layers, each layer represented by an instance of SampleRepresentation.AtomLayerObject. Then you can use the density profile classes to control the atom densitiy in each layer and by this create density profiles. See also tutorial concentration_profile.
Simple Example¶
Here a short example shall be given. For more elaborate examples have a look in the folder Tutorials.
We want to create a model for a sample with two layers: one substrate with an energy-independent susceptibility and a layer of C2O.
- As always start with the creation of the parameter pool:
>>> from PyXMRTool import Parameters >>> from PyXMRTool import SampleRepresentation >>> pp=Parameters.ParameterPool()
- Then create the heterostructure with to layers:
>>> hs=SampleRepresentation.Heterostructure(2)
- Create the substrate with an isotropic (same value on each diogonal entry) energy-indepedent suszeptibility, infinite thickness (0 equals infinity here), and a fitable roughness.
>>> substrate = SampleRepresentation.LayerObject([pp.newParameter('substrate_chi')], Parameters.Parameter(0), pp.newParameter('substrate_sigma'))
- Create the layer of C2O. Densities are here number densities. The layer has fitable thickness and sigma.
>>> number_density_C2O = Parameters.Parameter(0.042) #in mol/cm^3 >>> layer1 = SampleRepresentation.AtomLayerObject( { "C" : 2*number_density_C2O, "O" : number_density_C2O}, pp.newParameter('layer_thickness'), pp.newParameter('layer_sigma'))
- Plug the layers into the substrate object.
>>> hs.setLayer(0, substrate) >>> hs.setLayer(1, layer1)