GenX Reflectivity Models¶
Library for combined x-ray and neutrons simulations.¶
The neutron simulations is capable of handling non-magnetic, magnetic non-spin flip as well as neutron spin-flip reflectivity.
Classes¶
Layer¶
Layer(d=0.0 (AA), dens=1.0 (at./AA), sigma=0.0 (AA), f=1e-20j (el./at.), b=0j (fm/at.), xs_ai=0.0 (barn/at.), magn=0.0 (mu_B/at.), magn_ang=0.0 (deg.))
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
b
The neutron scattering length per formula unit in fm (femtometer = 1e-15m)
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns for neutrons
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
Stack¶
Stack(Layers=<factory>, Repetitions=1)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, crop_sld=0)
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.crop_sld
For samples with many layers this limits the number of layers that are shown on SLD graphs. Negative values just remove these layers and show a spike in SLD, instead, while postivie values exchange them by one layer of same thickness.
Instrument¶
Instrument(probe='x-ray', wavelength=1.54 (Å), I0=1.0 (arb.), Ibkg=0.0 (arb.), pol='uu', coords='2θ', tthoff=0.0 (°), incangle=0.5 (°), restype='no conv', res=0.001 ([coord]), respoints=5 (pts.), resintrange=2.0 ([coord]), footype='no corr', beamw=0.01 (mm), samplelen=10.0 (mm))
Specify parameters of the probe and reflectometry instrument.
probe
Describes the radiation and measurments used, it is one of: ‘x-ray’, ‘neutron’, ‘neutron pol’, ‘neutron pol spin flip’, ‘neutron tof’, ‘neutron pol tof’. The calculations for x-rays uses
f
for the scattering length for neutronsb
for ‘neutron pol’, ‘neutron pol spin flip’ and ‘neutron pol tof’ alternatives themagn
is used in the calculations. Note that the angle of magnetizationmagn_ang
is only used in the spin flip model.wavelength
The wavelength of the radiation given in AA (Angstroms)
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
pol
The measured polarization of the instrument. Valid options are: ‘uu’,’dd’, ‘ud’, ‘du’ or ‘ass’ the respective number 0-3 also works.
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
tthoff
Linear offset to the scattering angle calibration
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
- class genx.models.spec_nx.Buffer¶
- Rdd = 0¶
- Rdu = 0¶
- Rud = 0¶
- Ruu = 0¶
- TwoThetaQz = None¶
- parameters = None¶
- class genx.models.spec_nx.Coords(value)¶
An enumeration.
- alternate_tth = 'tth'¶
- q = 'q'¶
- tth = '2θ'¶
- genx.models.spec_nx.EnergySpecular(Energy, TwoThetaQz, sample: genx.models.spec_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Simulate the specular signal from sample when probed with instrument. Energy should be in eV.
# BEGIN Parameters Energy data.x TwoThetaQz 3.0 # END Parameters
- class genx.models.spec_nx.FootType(value)¶
An enumeration.
- gauss = 'gauss beam'¶
- none = 'no corr'¶
- square = 'square beam'¶
- class genx.models.spec_nx.Instrument(*, probe: genx.models.spec_nx.Probe = 'x-ray', wavelength: float = 1.54, I0: float = 1.0, Ibkg: float = 0.0, pol: genx.models.spec_nx.Polarization = 'uu', coords: genx.models.spec_nx.Coords = '2θ', tthoff: float = 0.0, incangle: float = 0.5, restype: genx.models.spec_nx.ResType = 'no conv', res: float = 0.001, respoints: int = 5, resintrange: float = 2.0, footype: genx.models.spec_nx.FootType = 'no corr', beamw: float = 0.01, samplelen: float = 10.0, **user_kwds)¶
Specify parameters of the probe and reflectometry instrument.
probe
Describes the radiation and measurments used, it is one of: ‘x-ray’, ‘neutron’, ‘neutron pol’, ‘neutron pol spin flip’, ‘neutron tof’, ‘neutron pol tof’. The calculations for x-rays uses
f
for the scattering length for neutronsb
for ‘neutron pol’, ‘neutron pol spin flip’ and ‘neutron pol tof’ alternatives themagn
is used in the calculations. Note that the angle of magnetizationmagn_ang
is only used in the spin flip model.wavelength
The wavelength of the radiation given in AA (Angstroms)
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
pol
The measured polarization of the instrument. Valid options are: ‘uu’,’dd’, ‘ud’, ‘du’ or ‘ass’ the respective number 0-3 also works.
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
tthoff
Linear offset to the scattering angle calibration
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
- Groups = [('Radiation', ['probe', 'wavelength', 'I0', 'Ibkg', 'pol']), ('X-Resolution', ['restype', 'res', 'respoints', 'resintrange']), ('X-Coordinates', ['coords', 'tthoff', 'incangle']), ('Footprint', ['footype', 'beamw', 'samplelen'])]¶
- I0: float = 1.0¶
- Ibkg: float = 0.0¶
- Units = {'2θ': '°', 'I0': 'arb.', 'Ibkg': 'arb.', 'beamw': 'mm', 'coords': '', 'footype': '', 'incangle': '°', 'pol': '', 'probe': '', 'q': 'Å$^-1$', 'res': '[coord]', 'resintrange': '[coord]', 'respoints': 'pts.', 'restype': '', 'samplelen': 'mm', 'tth': '°', 'tthoff': '°', 'wavelength': 'Å'}¶
- beamw: float = 0.01¶
- coords: genx.models.spec_nx.Coords = '2θ'¶
- footype: genx.models.spec_nx.FootType = 'no corr'¶
- incangle: float = 0.5¶
- pol: genx.models.spec_nx.Polarization = 'uu'¶
- probe: genx.models.spec_nx.Probe = 'x-ray'¶
- res: float = 0.001¶
- resintrange: float = 2.0¶
- respoints: int = 5¶
- restype: genx.models.spec_nx.ResType = 'no conv'¶
- samplelen: float = 10.0¶
- tthoff: float = 0.0¶
- wavelength: float = 1.54¶
- class genx.models.spec_nx.Layer(*, d: float = 0.0, dens: float = 1.0, sigma: float = 0.0, f: complex = 1e-20j, b: complex = 0j, xs_ai: float = 0.0, magn: float = 0.0, magn_ang: float = 0.0, **user_kwds)¶
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
b
The neutron scattering length per formula unit in fm (femtometer = 1e-15m)
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns for neutrons
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
- Groups = [('General', ['d', 'dens', 'sigma']), ('Neutron', ['b', 'xs_ai', 'magn', 'magn_ang']), ('X-Ray', ['f'])]¶
- Units = {'b': 'fm/at.', 'd': 'AA', 'dens': 'at./AA', 'f': 'el./at.', 'magn': 'mu_B/at.', 'magn_ang': 'deg.', 'sigma': 'AA', 'xs_ai': 'barn/at.'}¶
- b: complex = 0j¶
- d: float = 0.0¶
- dens: float = 1.0¶
- f: complex = 1e-20j¶
- magn: float = 0.0¶
- magn_ang: float = 0.0¶
- sigma: float = 0.0¶
- xs_ai: float = 0.0¶
- class genx.models.spec_nx.LayerParameters(d: List[float], dens: List[float], sigma: List[float], f: List[complex], b: List[complex], xs_ai: List[float], magn: List[float], magn_ang: List[float])¶
- b: List[complex]¶
- d: List[float]¶
- dens: List[float]¶
- f: List[complex]¶
- magn: List[float]¶
- magn_ang: List[float]¶
- sigma: List[float]¶
- xs_ai: List[float]¶
- genx.models.spec_nx.OffSpecular(TwoThetaQz, ThetaQx, sample: genx.models.spec_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Function that simulates the off-specular signal (not implemented)
# BEGIN Parameters TwoThetaQz 1.0 ThetaQx data.x # END Parameters
- genx.models.spec_nx.PolSpecular(TwoThetaQz, p1, p2, F1, F2, sample: genx.models.spec_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Specular reflectivity of polarized measurement with finite polarization. The polarization parameters are in accordance to the definition used in A.R. Wildes publication, Review of Scientific Instruments 70, 11 (1999) https://doi.org/10.1063/1.1150060
pol_params = (p1, p2, f1, f2) p1: polarizer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolarized p2: analyzer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolairzed F1/F2: Flipper efficienty, 0: 100% efficient, 1: no flipping
# BEGIN Parameters TwoThetaQz data.x p1 0. p2 0. F1 0. F2 0. # END Parameters
- class genx.models.spec_nx.Polarization(value)¶
An enumeration.
- alternate_down_down = '--'¶
- alternate_down_up = '-+'¶
- alternate_up_down = '+-'¶
- alternate_up_up = '++'¶
- asymmetry = 'ass'¶
- down_down = 'dd'¶
- down_up = 'du'¶
- up_down = 'ud'¶
- up_up = 'uu'¶
- class genx.models.spec_nx.Probe(value)¶
An enumeration.
- neutron = 'neutron'¶
- npol = 'neutron pol'¶
- npolsf = 'neutron pol spin flip'¶
- ntof = 'neutron tof'¶
- ntofpol = 'neutron pol tof'¶
- xray = 'x-ray'¶
- class genx.models.spec_nx.ResType(value)¶
An enumeration.
- fast_conv = 'fast conv'¶
- fast_conv_rel = 'fast conv + varying res. (dx/x)'¶
- fast_conv_var = 'fast conv + varying res.'¶
- full_conv_abs = 'full conv and varying res.'¶
- full_conv_rel = 'full conv and varying res. (dx/x)'¶
- none = 'no conv'¶
- genx.models.spec_nx.SLD_calculations(z, item, sample: genx.models.spec_nx.Sample, inst: genx.models.spec_nx.Instrument)¶
Calculates the scatteringlength density as at the positions z if item is None or “all” the function returns a dictonary of values. Otherwise, it returns the item as identified by its string.
# BEGIN Parameters z data.x item ‘Re’ # END Parameters
- class genx.models.spec_nx.Sample(*, Stacks: List[genx.models.spec_nx.Stack] = <factory>, Ambient: genx.models.spec_nx.Layer = <factory>, Substrate: genx.models.spec_nx.Layer = <factory>, crop_sld: int = 0, **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.crop_sld
For samples with many layers this limits the number of layers that are shown on SLD graphs. Negative values just remove these layers and show a spike in SLD, instead, while postivie values exchange them by one layer of same thickness.
- SimEnergySpecular(*args)¶
- SimOffSpecular(*args)¶
- SimPolSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- SimSpecularField(*args)¶
- Stacks: List[genx.models.spec_nx.Stack]¶
- crop_sld: int = 0¶
- genx.models.spec_nx.Specular(TwoThetaQz, sample: genx.models.spec_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Simulate the specular signal from sample when probed with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- genx.models.spec_nx.SpecularField(TwoThetaQz, sample, instrument)¶
Simulate the specular signal from sample when probed with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- class genx.models.spec_nx.Stack(*, Layers: List[genx.models.spec_nx.Layer] = <factory>, Repetitions: int = 1, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
- Layers: List[genx.models.spec_nx.Layer]¶
- Repetitions: int = 1¶
- class genx.models.spec_nx.TestSpecNX(methodName='runTest')¶
- test_energy()¶
- test_sld()¶
- test_spec_neutron()¶
- test_spec_xray()¶
- genx.models.spec_nx.footprintcorr(Q, instrument: genx.models.spec_nx.Instrument)¶
- genx.models.spec_nx.neutron_sld(abs_xs, dens, fb, wl)¶
- genx.models.spec_nx.q_limit = 1e-10¶
Minimum allowed q-value
- genx.models.spec_nx.resolution_init(TwoThetaQz, instrument: genx.models.spec_nx.Instrument)¶
Inits the dependet variable with regards to coordinates and resolution.
- genx.models.spec_nx.resolutioncorr(R, TwoThetaQz, foocor, instrument: genx.models.spec_nx.Instrument, weight)¶
Do the convolution of the reflectivity to account for resolution effects.
- genx.models.spec_nx.specular_calcs(TwoThetaQz, sample: genx.models.spec_nx.Sample, instrument: genx.models.spec_nx.Instrument, return_int=True)¶
Simulate the specular signal from sample when probed with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- genx.models.spec_nx.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
Library for combined x-ray and neutrons simulations.¶
The neutron simulations is capable of handling non-magnetic, magnetic non-spin flip as well as neutron spin-flip reflectivity. The model works with scattering lengths densities directly.
The model is equivalent to spec_nx in calculation but uses different parameterization that is more suitable for soft-matter applications.
Classes¶
Layer¶
Layer(sigma=0.0 (AA), d=0.0 (AA), sld_n=1e-20j (1e-6 1/AA^2), sld_x=0j (1e-6 1/AA^2), sld_m=0.0 (1e-6 1/AA^2), magn_ang=0.0 (deg.))
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
sld_x
The x-ray scattering length density in 1e-6 1/AA^2
sld_n
The neutron scattering length density in 1e-6 1/AA^2
sld_m
The neutron magnetic scattering length density in 1e-6 1/AA^2
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
Stack¶
Stack(Layers=<factory>, Repetitions=1)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, crop_sld=0)
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.crop_sld
For samples with many layers this limits the number of layers that are shown on SLD graphs. Negative values just remove these layers and show a spike in SLD, instead, while postivie values exchange them by one layer of same thickness.
- class genx.models.soft_nx.Buffer¶
- Rdd = 0¶
- Rdu = 0¶
- Rud = 0¶
- Ruu = 0¶
- TwoThetaQz = None¶
- parameters = None¶
- genx.models.soft_nx.EnergySpecular(Energy, TwoThetaQz, sample: genx.models.soft_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Simulate the specular signal from sample when probed with instrument. Energy should be in eV.
# BEGIN Parameters Energy data.x TwoThetaQz 3.0 # END Parameters
- class genx.models.soft_nx.Layer(*, sigma: float = 0.0, d: float = 0.0, sld_n: complex = 1e-20j, sld_x: complex = 0j, sld_m: float = 0.0, magn_ang: float = 0.0, **user_kwds)¶
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
sld_x
The x-ray scattering length density in 1e-6 1/AA^2
sld_n
The neutron scattering length density in 1e-6 1/AA^2
sld_m
The neutron magnetic scattering length density in 1e-6 1/AA^2
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
- Groups = [('General', ['d', 'sigma']), ('Neutron', ['sld_n', 'sld_m', 'magn_ang']), ('X-Ray', ['sld_x'])]¶
- Units = {'d': 'AA', 'magn_ang': 'deg.', 'sigma': 'AA', 'sld_m': '1e-6 1/AA^2', 'sld_n': '1e-6 1/AA^2', 'sld_x': '1e-6 1/AA^2'}¶
- d: float = 0.0¶
- magn_ang: float = 0.0¶
- sigma: float = 0.0¶
- sld_m: float = 0.0¶
- sld_n: complex = 1e-20j¶
- sld_x: complex = 0j¶
- class genx.models.soft_nx.LayerParameters(sigma: List[float], d: List[float], sld_n: List[complex], sld_x: List[complex], sld_m: List[float], magn_ang: List[float])¶
- d: List[float]¶
- magn_ang: List[float]¶
- sigma: List[float]¶
- sld_m: List[float]¶
- sld_n: List[complex]¶
- sld_x: List[complex]¶
- genx.models.soft_nx.OffSpecular(TwoThetaQz, ThetaQx, sample, instrument)¶
Function that simulates the off-specular signal (not implemented)
# BEGIN Parameters TwoThetaQz 1.0 ThetaQx data.x # END Parameters
- genx.models.soft_nx.SLD_calculations(z, item, sample: genx.models.soft_nx.Sample, inst: genx.models.spec_nx.Instrument)¶
Calculates the scatteringlength density as at the positions z if item is None or “all” the function returns a dictonary of values. Otherwise it returns the item as identified by its string.
# BEGIN Parameters z data.x item ‘Re’ # END Parameters
- class genx.models.soft_nx.Sample(*, Stacks: List[genx.models.soft_nx.Stack] = <factory>, Ambient: genx.models.soft_nx.Layer = <factory>, Substrate: genx.models.soft_nx.Layer = <factory>, crop_sld: int = 0, **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.crop_sld
For samples with many layers this limits the number of layers that are shown on SLD graphs. Negative values just remove these layers and show a spike in SLD, instead, while postivie values exchange them by one layer of same thickness.
- SimEnergySpecular(*args)¶
- SimOffSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- Stacks: List[genx.models.soft_nx.Stack]¶
- crop_sld: int = 0¶
- genx.models.soft_nx.Specular(TwoThetaQz, sample: genx.models.soft_nx.Sample, instrument: genx.models.spec_nx.Instrument)¶
Simulate the specular signal from sample when probed with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- class genx.models.soft_nx.Stack(*, Layers: List[genx.models.soft_nx.Layer] = <factory>, Repetitions: int = 1, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
- Layers: List[genx.models.soft_nx.Layer]¶
- Repetitions: int = 1¶
- class genx.models.soft_nx.TestSoftNX(methodName='runTest')¶
- test_energy()¶
- test_sld()¶
- test_spec_neutron()¶
- test_spec_xray()¶
- genx.models.soft_nx.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
Library for combined x-ray and neutrons simulations with adaptive layer segmentation¶
Library for specular neutron and x-ray reflectometry of more complex structures where elemental composition and/or magnetism is better described separately than within one slap model. The model sums up a set of Elements to calculate a total SLD profile and then uses adaptive layer segmentation to model it.
The actual modeling of the result structure is done with the same function as in spec_nx.
Classes¶
Layer¶
Layer(sigma=0.0 (AA), dens=1.0 (at./AA), d=0.0 (AA), f=1e-20j (el./at.), b=0j (fm/at.), xs_ai=0.0 (barn/at.), rough_type='gauss', magn=0.0 (mu_B/at.), magn_ang=0.0 (deg.), magn_void=False, sigma_mag=0.0 (AA))
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root-mean-square roughness of the top interface of the layer in Angstroms.
rough_type
Used model to get the SLD profile of the interface, gauss is an error function profile (gaussian roughness), linear is a linear profile, exp-1 and exp-2 are exponential decays from bottom or top side.
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
magn_void
If true this layer has no magnetization. In case of sigma_mag beging larger than 0, the additional roughness is only applied to the magnetic layer and inside this layer follows the chemical profile.
sigma_mag
A different roughness parameter for the magnetization of the layer, 0 is ignored
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
b
The neutron scattering length per formula unit in fm (femtometer = 1e-15m)
xs_ai
The sum of the absorption cross-section and the incoherent scattering cross-section in barns for neutrons
Stack¶
Stack(Layers=<factory>, Repetitions=1, Element=0)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Element
The Element of the model that this stack belongs to. There has to be at least one stack with Element 0. For every Element the layers are stacked on top of the substrate separately and then all Elements are summed up to calculate the total SLD. The main use case for this is either to separate magnetic from nuclear structure (nuclear Element=0, magnetic Element=1) or two or more elemental contributions for element specific diffusion. For layers that have no contribution at a certain depth one can add a layer with 0 density as spacer.
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, minimal_steps=0.5, max_diff_n=0.01, max_diff_x=0.01, smoothen=False, crop_sigma=False)
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.minimal_steps
The thickness of the minimal step between layers. Smaller values make the model more precise but slower. For data with larger q-range a smaller minimal_step is required. Try to start with 0.5-1 Å step size and increase the value until you see differences in the simulated data.
max_diff_n
Maximum neutron SLD deviation to be allowed for layers to be combined in the adaptive procedure
max_diff_x
Maximum x-ray SLD deviation to be allowed for layers to be combined in the adaptive procedure
smoothen
Default is to not use any roughness for the segmentation. If True this will add roughnesses between all segments to make the curve more smooth.
crop_sigma
For cases where roughness of an interface is in the order of layer thickness will limit the extent of roughness to the neighboring interfaces to avoid strange SLD profiles. Note: This means that the sigma parameter strictly is not an actual rms roughness anymore.
Instrument¶
Instrument(probe='x-ray', wavelength=1.54 (Å), I0=1.0 (arb.), Ibkg=0.0 (arb.), pol='uu', coords='2θ', tthoff=0.0 (°), incangle=0.5 (°), restype='no conv', res=0.001 ([coord]), respoints=5 (pts.), resintrange=2.0 ([coord]), footype='no corr', beamw=0.01 (mm), samplelen=10.0 (mm), zeeman='no corr', mag_field=0.0 (T))
Specify parameters of the probe and reflectometry instrument.
wavelength
The wavelength of the radiation given in AA (Angstroms)
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
tthoff
Linear offset to the scattering angle calibration
probe
Describes the radiation and measurments used, it is one of: ‘x-ray’, ‘neutron’, ‘neutron pol’, ‘neutron pol spin flip’, ‘neutron tof’, ‘neutron pol tof’. The calculations for x-rays uses
f
for the scattering length for neutronsb
for ‘neutron pol’, ‘neutron pol spin flip’ and ‘neutron pol tof’ alternatives themagn
is used in the calculations. Note that the angle of magnetizationmagn_ang
is only used in the spin flip model.pol
The measured polarization of the instrument. Valid options are: ‘uu’,’dd’, ‘ud’, ‘du’ or ‘ass’ the respective number 0-3 also works.
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
zeeman
Apply corrections for Zeeman-effect when using neutron pol spin-flip model with elevated magnetic field and canted magnetic moments. The configuration can be one of ‘no corr’, ‘field only’, ‘SF q (+)’ or ‘SF q (-)’. With ‘field only’, the q-values for calculation are not changed but the magnetic SLD for all layers is modified by the external field (including substrate and ambient layer). The ‘SF q (+/-)’ make an additional correct to the q-value for spin-flip channels that assumes the q-value was calculated from the incident angle (+) or the outgoing angle (-). (Direction of the beam changes due to the energy loss/gain from spin-flip in a magnetic field.)
mag_field
Strength of the external magnetic field in T.
- class genx.models.spec_adaptive.Buffer¶
- Rdd = 0¶
- Rdu = 0¶
- Rud = 0¶
- Ruu = 0¶
- TwoThetaQz = None¶
- parameters = None¶
- class genx.models.spec_adaptive.Instrument(*, probe: genx.models.spec_nx.Probe = 'x-ray', wavelength: float = 1.54, I0: float = 1.0, Ibkg: float = 0.0, pol: genx.models.spec_nx.Polarization = 'uu', coords: genx.models.spec_nx.Coords = '2θ', tthoff: float = 0.0, incangle: float = 0.5, restype: genx.models.spec_nx.ResType = 'no conv', res: float = 0.001, respoints: int = 5, resintrange: float = 2.0, footype: genx.models.spec_nx.FootType = 'no corr', beamw: float = 0.01, samplelen: float = 10.0, zeeman: genx.models.spec_adaptive.Zeeman = 'no corr', mag_field: float = 0.0, **user_kwds)¶
Specify parameters of the probe and reflectometry instrument.
wavelength
The wavelength of the radiation given in AA (Angstroms)
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
tthoff
Linear offset to the scattering angle calibration
probe
Describes the radiation and measurments used, it is one of: ‘x-ray’, ‘neutron’, ‘neutron pol’, ‘neutron pol spin flip’, ‘neutron tof’, ‘neutron pol tof’. The calculations for x-rays uses
f
for the scattering length for neutronsb
for ‘neutron pol’, ‘neutron pol spin flip’ and ‘neutron pol tof’ alternatives themagn
is used in the calculations. Note that the angle of magnetizationmagn_ang
is only used in the spin flip model.pol
The measured polarization of the instrument. Valid options are: ‘uu’,’dd’, ‘ud’, ‘du’ or ‘ass’ the respective number 0-3 also works.
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
zeeman
Apply corrections for Zeeman-effect when using neutron pol spin-flip model with elevated magnetic field and canted magnetic moments. The configuration can be one of ‘no corr’, ‘field only’, ‘SF q (+)’ or ‘SF q (-)’. With ‘field only’, the q-values for calculation are not changed but the magnetic SLD for all layers is modified by the external field (including substrate and ambient layer). The ‘SF q (+/-)’ make an additional correct to the q-value for spin-flip channels that assumes the q-value was calculated from the incident angle (+) or the outgoing angle (-). (Direction of the beam changes due to the energy loss/gain from spin-flip in a magnetic field.)
mag_field
Strength of the external magnetic field in T.
- Groups = [('Radiation', ['probe', 'wavelength', 'I0', 'Ibkg', 'pol']), ('X-Resolution', ['restype', 'res', 'respoints', 'resintrange']), ('X-Coordinates', ['coords', 'tthoff', 'incangle']), ('Footprint', ['footype', 'beamw', 'samplelen']), ('Zeeman correction', ['zeeman', 'mag_field'])]¶
- Units = {'2θ': '°', 'I0': 'arb.', 'Ibkg': 'arb.', 'beamw': 'mm', 'coords': '', 'footype': '', 'incangle': '°', 'mag_field': 'T', 'pol': '', 'probe': '', 'q': 'Å$^-1$', 'res': '[coord]', 'resintrange': '[coord]', 'respoints': 'pts.', 'restype': '', 'samplelen': 'mm', 'tth': '°', 'tthoff': '°', 'wavelength': 'Å'}¶
- mag_field: float = 0.0¶
- zeeman: genx.models.spec_adaptive.Zeeman = 'no corr'¶
- class genx.models.spec_adaptive.Layer(*, sigma: float = 0.0, dens: float = 1.0, d: float = 0.0, f: complex = 1e-20j, b: complex = 0j, xs_ai: float = 0.0, rough_type: genx.models.spec_adaptive.RoughType = 'gauss', magn: float = 0.0, magn_ang: float = 0.0, magn_void: bool = False, sigma_mag: float = 0.0, **user_kwds)¶
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root-mean-square roughness of the top interface of the layer in Angstroms.
rough_type
Used model to get the SLD profile of the interface, gauss is an error function profile (gaussian roughness), linear is a linear profile, exp-1 and exp-2 are exponential decays from bottom or top side.
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
magn_void
If true this layer has no magnetization. In case of sigma_mag beging larger than 0, the additional roughness is only applied to the magnetic layer and inside this layer follows the chemical profile.
sigma_mag
A different roughness parameter for the magnetization of the layer, 0 is ignored
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
b
The neutron scattering length per formula unit in fm (femtometer = 1e-15m)
xs_ai
The sum of the absorption cross-section and the incoherent scattering cross-section in barns for neutrons
- Groups = [('General', ['d', 'dens', 'sigma', 'rough_type']), ('Neutron Magnetic', ['magn', 'magn_ang', 'magn_void', 'sigma_mag']), ('X-Ray', ['f']), ('Neutron Nuclear', ['b', 'xs_ai'])]¶
- Units = {'b': 'fm/at.', 'd': 'AA', 'dens': 'at./AA', 'f': 'el./at.', 'magn': 'mu_B/at.', 'magn_ang': 'deg.', 'sigma': 'AA', 'sigma_mag': 'AA', 'xs_ai': 'barn/at.'}¶
- b: complex = 0j¶
- d: float = 0.0¶
- dens: float = 1.0¶
- f: complex = 1e-20j¶
- magn: float = 0.0¶
- magn_ang: float = 0.0¶
- magn_void: bool = False¶
- rough_type: genx.models.spec_adaptive.RoughType = 'gauss'¶
- sigma: float = 0.0¶
- sigma_mag: float = 0.0¶
- xs_ai: float = 0.0¶
- genx.models.spec_adaptive.PolSpecular(TwoThetaQz, p1, p2, F1, F2, sample: genx.models.spec_adaptive.Sample, instrument: genx.models.spec_adaptive.Instrument)¶
Specular reflectivity of polarized measurement with finite polarization. The polarization parameters are in accordance to the definition used in A.R. Wildes publication, Review of Scientific Instruments 70, 11 (1999) https://doi.org/10.1063/1.1150060
pol_params = (p1, p2, f1, f2) p1: polarizer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolarized p2: analyzer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolairzed F1/F2: Flipper efficienty, 0: 100% efficient, 1: no flipping
# BEGIN Parameters TwoThetaQz data.x p1 0. p2 0. F1 0. F2 0. # END Parameters
- class genx.models.spec_adaptive.RoughType(value)¶
An enumeration.
- exp1 = 'exp-1'¶
- exp2 = 'exp-2'¶
- gauss = 'gauss'¶
- linear = 'linear'¶
- genx.models.spec_adaptive.SLD_calculations(z, item, sample, inst)¶
Calculates the scatteringlength density as at the positions z if item is None or “all” the function returns a dictonary of values. Otherwise, it returns the item as identified by its string.
# BEGIN Parameters z data.x item ‘Re’ # END Parameters
- class genx.models.spec_adaptive.Sample(*, Stacks: List[genx.models.spec_adaptive.Stack] = <factory>, Ambient: genx.models.spec_adaptive.Layer = <factory>, Substrate: genx.models.spec_adaptive.Layer = <factory>, minimal_steps: float = 0.5, max_diff_n: float = 0.01, max_diff_x: float = 0.01, smoothen: bool = False, crop_sigma: bool = False, **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.minimal_steps
The thickness of the minimal step between layers. Smaller values make the model more precise but slower. For data with larger q-range a smaller minimal_step is required. Try to start with 0.5-1 Å step size and increase the value until you see differences in the simulated data.
max_diff_n
Maximum neutron SLD deviation to be allowed for layers to be combined in the adaptive procedure
max_diff_x
Maximum x-ray SLD deviation to be allowed for layers to be combined in the adaptive procedure
smoothen
Default is to not use any roughness for the segmentation. If True this will add roughnesses between all segments to make the curve more smooth.
crop_sigma
For cases where roughness of an interface is in the order of layer thickness will limit the extent of roughness to the neighboring interfaces to avoid strange SLD profiles. Note: This means that the sigma parameter strictly is not an actual rms roughness anymore.
- SimPolSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- Stacks: List[genx.models.spec_adaptive.Stack]¶
- crop_sigma: bool = False¶
- max_diff_n: float = 0.01¶
- max_diff_x: float = 0.01¶
- minimal_steps: float = 0.5¶
- resolveLayerParameters()¶
- smoothen: bool = False¶
- genx.models.spec_adaptive.Specular(TwoThetaQz, sample: genx.models.spec_adaptive.Sample, instrument: genx.models.spec_adaptive.Instrument)¶
Simulate the specular signal from sample when probed with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- class genx.models.spec_adaptive.Stack(*, Layers: List[genx.models.spec_adaptive.Layer] = <factory>, Repetitions: int = 1, Element: int = 0, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Element
The Element of the model that this stack belongs to. There has to be at least one stack with Element 0. For every Element the layers are stacked on top of the substrate separately and then all Elements are summed up to calculate the total SLD. The main use case for this is either to separate magnetic from nuclear structure (nuclear Element=0, magnetic Element=1) or two or more elemental contributions for element specific diffusion. For layers that have no contribution at a certain depth one can add a layer with 0 density as spacer.
- Element: int = 0¶
- Layers: List[genx.models.spec_adaptive.Layer]¶
- Repetitions: int = 1¶
- class genx.models.spec_adaptive.TestSpecAdaptive(methodName='runTest')¶
- test_sld()¶
- test_spec_neutron()¶
- test_zeemann()¶
- class genx.models.spec_adaptive.Zeeman(value)¶
An enumeration.
- field = 'field only'¶
- neg_sf = 'SF q (-)'¶
- none = 'no corr'¶
- pos_sf = 'SF q (+)'¶
- genx.models.spec_adaptive.calculate_segmentation(sample)¶
Calculate segmentation steps inside a sample defined by a maximum SLD slope and minimum step size. It first calculates the nuclear and magnetic SLD profile from the model and than separates it according to the given parameters.
- genx.models.spec_adaptive.next_adaptive_segment(i, rho_x_r, rho_n_p, rho_n_m, rho_m_sf, max_diff_n, max_diff_x, z)¶
- genx.models.spec_adaptive.resolve_parameters_by_element(sample)¶
Resolve the model standard parameters for each element. The first element used for normal parameter names, every other element does ignore substrate and ambience sld and is assigned to the ‘elements’ keyword as list. This makes it possible to build SLD profiles as sum of all elements.
- genx.models.spec_adaptive.specular_calc_zeemann(TwoThetaQz, sample: genx.models.spec_adaptive.Sample, instrument: genx.models.spec_adaptive.Instrument)¶
For details see spec_nx implementation with more comments.
This implements the concepts of [1] by correcting the q-position for spin-flip and adding a magnetic sld to all layers along the external field diretion.
[1] Brian B. Maranville et al., “Polarized specular neutron reflectivity”, J. Appl. Cryst. (2016). 49, 1121–1129
- genx.models.spec_adaptive.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
Library for combined x-ray and neutrons simulations for inhomogeneous samples.¶
In addition to the options from spec_nx this allows to model thickness variation over the sample surface and gradients in the roughness and thickness over a repetition of layers.
Classes¶
Layer¶
Layer(d=0.0 (AA), dens=1.0 (at./AA), sigma=0.0 (AA), f=1e-20j (el./at.), b=0j (fm/at.), xs_ai=0.0 (barn/at.), magn=0.0 (mu_B/at.), magn_ang=0.0 (deg.), sigma_gradient=0.0 (1), d_gradient=0.0 (1))
Representing a layer in the sample structur.
b
The neutron scattering length per formula unit in fm (fermi meter = 1e-15m)
d
The thickness of the layer in AA (Angstroms = 1e-10m)
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
dens
The density of formula units in units per Angstroms. Note the units!
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns for neutrons
sigma_gradient
Increase of roughness of this layer from bottom to top in stack repetitions
d_gradient
Increase of the thickness of this layer from bottom to top in stack repetitions
Stack¶
Stack(Layers=<factory>, Repetitions=1.0, sigma_gtype=0, sigma_gradient=0.0, d_gradient=0.0, dens_gradient=0.0, beta_sm=0.0, sm_scale=1.0)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayer
s in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack or m-value for analytical super-mirror model.
sigma_gtype
model for this increase in roughness (relative linlinea, relative sqrt, absolute linear, absolute sqrt)
sigma_gradient
amount of increase in roughness from bottom to top applied to all layers in the stack
d_gradient
thickness increase from bottom to top
dens_gradient
density increase from bottom to top
beta_sm
Parameter used to model neutron super-mirror coatings. There are two models implemented. If beta_sm is positive, a simplified analystical model from J. Schelten and K. Mika (Nuc. Inst. Metho. 160 (1979)) is used and the parameter represents the quality paramter for super-mirror sequences. A super-mirror sequence is generated and Repetitions is interpreted as the m-value for the sequence to calculate actual repetitions automatically.
If beta_sm is negative it is interpretated as the zeta parameter of an iterative build-up of super-mirror layers using the method described by J.B. Hayter and H.A. Mook (J. Appl. Cryst. (1989), 22, 35-41). Here, the actual given number of repetitions are used to build up a super-mirror from the critical edge upowards. The m-value follows from the number of repetitions, material parameters and zeta.
This method only works acuratly with two layers in the Stack, as the maximum and minimum SLD layers are used for the SLD calculation needed to get the layer sequences. (Other layers are simulated but their SLDs are ignored for the number of repetitions and super-lattice repetition period).
For the Schelten/Mika method, all layers are scaled to the relative size needed to produce the right super-lattice period. In Hayter/Mook only the two min/max components are set to the optimal thickness values while the rest of the stack stays with constant width.
The value of d_gradient is interpreted as a relative change from bottom to top in this case. Together with the sm_scale, that is applied to all layers.
sm_scale
A scaling parameter applied to all thicknesses in a supermirror. This can account for thickness differences introduced by the manufacturing process due to imperfect calibration.
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, crop_sld=200, sigma_inhom=0.0, lscale_inhom=0.9, flatwidth_inhom=0.3, steps_inhom=20, type_inhom='empiric PLD')
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStack
s in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.sigma_inhom
Width of the thickness distribution
lscale_inhom
For empirical PLD model this defines the width of the increas peak
flatwidth_inhom
For empirical PLD model this defines the trnsition from flat to increased probability.
steps_inhom
Number of simulations to be performed to sample the thickness distribution model
type_inhom
Function for the thickness probability. Either symmetric gaussian, semi-gaussian which does not have any probability for a higher thickness and an empirical model developed from PLD samples.
crop_sld
Useful for multilayers with a very large number of repetitions. Only keeps crop_sld number of layers on top and bottom and removes all in the center for the SLD plot. The removed layers are replace with one layer of empty space. If the parameter is negative this gap can be replaced by a “peak” that separates top and bottom, this does invalidate the x-axis of the SLD plot, though.
The empricial PLD model is base of simulations from x-ray line focus plume shapes to get thickness distribution probabilities and reduced to a smaller number of parameters. See PhD thesis Multiferroicity in oxide thin films and heterostructures, A.Glavic, RWTH Aachen, (2012) for a more detailed description of the empirical PLD model and an example application.
- class genx.models.spec_inhom.InhomType(value)¶
An enumeration.
- empiric = 'empiric PLD'¶
- gauss = 'gauss'¶
- semi_gauss = 'semi-gauss'¶
- class genx.models.spec_inhom.Layer(*, d: float = 0.0, dens: float = 1.0, sigma: float = 0.0, f: complex = 1e-20j, b: complex = 0j, xs_ai: float = 0.0, magn: float = 0.0, magn_ang: float = 0.0, sigma_gradient: float = 0.0, d_gradient: float = 0.0, **user_kwds)¶
Representing a layer in the sample structur.
b
The neutron scattering length per formula unit in fm (fermi meter = 1e-15m)
d
The thickness of the layer in AA (Angstroms = 1e-10m)
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
dens
The density of formula units in units per Angstroms. Note the units!
magn_ang
The angle of the magnetic moment in degress. 0 degrees correspond to a moment collinear with the neutron spin.
magn
The magnetic moment per formula unit (same formula unit as b and dens refer to)
sigma
The root mean square roughness of the top interface of the layer in Angstroms.
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns for neutrons
sigma_gradient
Increase of roughness of this layer from bottom to top in stack repetitions
d_gradient
Increase of the thickness of this layer from bottom to top in stack repetitions
- Groups = [('General', ['d', 'dens', 'sigma']), ('Neutron', ['b', 'xs_ai', 'magn', 'magn_ang']), ('Inhom.', ['sigma_gradient', 'd_gradient']), ('X-Ray', ['f'])]¶
- Units = {'b': 'fm/at.', 'd': 'AA', 'd_gradient': '1', 'dens': 'at./AA', 'f': 'el./at.', 'magn': 'mu_B/at.', 'magn_ang': 'deg.', 'sigma': 'AA', 'sigma_gradient': '1', 'xs_ai': 'barn/at.'}¶
- d_gradient: float = 0.0¶
- sigma_gradient: float = 0.0¶
- class genx.models.spec_inhom.LayerParameters(d: List[float], dens: List[float], sigma: List[float], f: List[complex], b: List[complex], xs_ai: List[float], magn: List[float], magn_ang: List[float], sigma_gradient: List[float], d_gradient: List[float])¶
- d_gradient: List[float]¶
- sigma_gradient: List[float]¶
- genx.models.spec_inhom.PolSpecular(TwoThetaQz, p1, p2, F1, F2, sample, instrument)¶
Specular reflectivity of polarized measurement with finite polarization. The polarization parameters are in accordance to the definition used in A.R. Wildes publication, Review of Scientific Instruments 70, 11 (1999) https://doi.org/10.1063/1.1150060
pol_params = (p1, p2, f1, f2) p1: polarizer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolarized p2: analyzer efficiency, 0: 100% spin-up, 1: 100% spin-down, 0.5: unpolairzed F1/F2: Flipper efficienty, 0: 100% efficient, 1: no flipping
# BEGIN Parameters TwoThetaQz data.x p1 0. p2 0. F1 0. F2 0. # END Parameters
- class genx.models.spec_inhom.Sample(*, Stacks: List[genx.models.spec_inhom.Stack] = <factory>, Ambient: genx.models.spec_inhom.Layer = <factory>, Substrate: genx.models.spec_inhom.Layer = <factory>, crop_sld: int = 200, sigma_inhom: float = 0.0, lscale_inhom: float = 0.9, flatwidth_inhom: float = 0.3, steps_inhom: int = 20, type_inhom: genx.models.spec_inhom.InhomType = 'empiric PLD', **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStack
s in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.sigma_inhom
Width of the thickness distribution
lscale_inhom
For empirical PLD model this defines the width of the increas peak
flatwidth_inhom
For empirical PLD model this defines the trnsition from flat to increased probability.
steps_inhom
Number of simulations to be performed to sample the thickness distribution model
type_inhom
Function for the thickness probability. Either symmetric gaussian, semi-gaussian which does not have any probability for a higher thickness and an empirical model developed from PLD samples.
crop_sld
Useful for multilayers with a very large number of repetitions. Only keeps crop_sld number of layers on top and bottom and removes all in the center for the SLD plot. The removed layers are replace with one layer of empty space. If the parameter is negative this gap can be replaced by a “peak” that separates top and bottom, this does invalidate the x-axis of the SLD plot, though.
The empricial PLD model is base of simulations from x-ray line focus plume shapes to get thickness distribution probabilities and reduced to a smaller number of parameters. See PhD thesis Multiferroicity in oxide thin films and heterostructures, A.Glavic, RWTH Aachen, (2012) for a more detailed description of the empirical PLD model and an example application.
- SimPolSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- Stacks: List[genx.models.spec_inhom.Stack]¶
- crop_sld: int = 200¶
- flatwidth_inhom: float = 0.3¶
- lscale_inhom: float = 0.9¶
- sigma_inhom: float = 0.0¶
- steps_inhom: int = 20¶
- type_inhom: genx.models.spec_inhom.InhomType = 'empiric PLD'¶
- class genx.models.spec_inhom.SigmaGradientType(value)¶
An enumeration.
- abs_lin = 'absolute linear'¶
- abs_sqrt = 'absolute sqrt'¶
- rel_lin = 'relative linear'¶
- rel_sqrt = 'relative sqrt'¶
- genx.models.spec_inhom.Specular(TwoThetaQz, sample: genx.models.spec_inhom.Sample, instrument: genx.models.spec_nx.Instrument)¶
The model function. Averadging the intensities for different layer thicknesses as found for e.g. large PLD samples.
- class genx.models.spec_inhom.Stack(*, Layers: List[genx.models.spec_inhom.Layer] = <factory>, Repetitions: float = 1.0, sigma_gtype: genx.models.spec_inhom.SigmaGradientType = 0, sigma_gradient: float = 0.0, d_gradient: float = 0.0, dens_gradient: float = 0.0, beta_sm: float = 0.0, sm_scale: float = 1.0, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayer
s in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack or m-value for analytical super-mirror model.
sigma_gtype
model for this increase in roughness (relative linlinea, relative sqrt, absolute linear, absolute sqrt)
sigma_gradient
amount of increase in roughness from bottom to top applied to all layers in the stack
d_gradient
thickness increase from bottom to top
dens_gradient
density increase from bottom to top
beta_sm
Parameter used to model neutron super-mirror coatings. There are two models implemented. If beta_sm is positive, a simplified analystical model from J. Schelten and K. Mika (Nuc. Inst. Metho. 160 (1979)) is used and the parameter represents the quality paramter for super-mirror sequences. A super-mirror sequence is generated and Repetitions is interpreted as the m-value for the sequence to calculate actual repetitions automatically.
If beta_sm is negative it is interpretated as the zeta parameter of an iterative build-up of super-mirror layers using the method described by J.B. Hayter and H.A. Mook (J. Appl. Cryst. (1989), 22, 35-41). Here, the actual given number of repetitions are used to build up a super-mirror from the critical edge upowards. The m-value follows from the number of repetitions, material parameters and zeta.
This method only works acuratly with two layers in the Stack, as the maximum and minimum SLD layers are used for the SLD calculation needed to get the layer sequences. (Other layers are simulated but their SLDs are ignored for the number of repetitions and super-lattice repetition period).
For the Schelten/Mika method, all layers are scaled to the relative size needed to produce the right super-lattice period. In Hayter/Mook only the two min/max components are set to the optimal thickness values while the rest of the stack stays with constant width.
The value of d_gradient is interpreted as a relative change from bottom to top in this case. Together with the sm_scale, that is applied to all layers.
sm_scale
A scaling parameter applied to all thicknesses in a supermirror. This can account for thickness differences introduced by the manufacturing process due to imperfect calibration.
- Groups = [('General', ['Repetitions']), ('Roughness Gradient', ['sigma_gtype', 'sigma_gradient']), ('Supermirror', ['beta_sm', 'sm_scale']), ('Other Gradients', ['d_gradient', 'dens_gradient'])]¶
- Layers: List[genx.models.spec_inhom.Layer]¶
- Repetitions: float = 1.0¶
- beta_sm: float = 0.0¶
- d_gradient: float = 0.0¶
- dens_gradient: float = 0.0¶
- resolveLayerParameter(name)¶
Add gradient for sigma and thickness to multilayers
- sigma_gradient: float = 0.0¶
- sigma_gtype: genx.models.spec_inhom.SigmaGradientType = 0¶
- sm_scale: float = 1.0¶
- class genx.models.spec_inhom.TestSpecInhom(methodName='runTest')¶
- test_gradients()¶
- test_inhom_types()¶
- test_sld()¶
- test_spec_neutron()¶
- test_spec_xray()¶
- test_supermirrors()¶
- genx.models.spec_inhom.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
Library for specular and off-specular x-ray reflectivity¶
interdiff is a model for specular and off specular simulations including the effects of interdiffusion in the calculations. The specular simulations is conducted with Parrats recursion formula. The off-specular, diffuse calculations are done with the distorted wave Born approximation (DWBA) as derived by Holy and with the extensions done by Wormington to include diffuse interfaces.
Classes¶
Layer¶
Layer(d=0.0 (AA), dens=1.0 (at./AA), sigma=5.0 (AA), sigmai=0.0 (AA), f=1e-20j (el./at.))
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The total root mean square roughness of the top interface of the layer in Angstroms. This includes both the extended “wavy” roughness sigmar and the atomic-scale interface broadening due to interdiffusion sigmai. It is defined as sqrt(sigmar**2+sigmai**2).
sigmai
The root mean square interdiffusion of the top interface of the layer in Angstroms.
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
Stack¶
Stack(Layers=<factory>, Repetitions=1)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, eta_z=100.0, eta_x=100.0, h=1.0)
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.eta_z
The out-of plane (vertical) correlation length of the roughness in the sample. Given in AA.
eta_x
The in-plane global correlation length (it is assumed equal for all layers). Given in AA.
h
The jaggedness parameter, should be between 0 (jagged) and 1.0 (smooth). This describes how jagged the interfaces are. This is also a global parameter for all interfaces. (See e.g.: [book](https://doi.org/10.1007/978-1-4612-3784-6_2) )
Instrument¶
Instrument(wavelength=1.54 (Å), coords='2θ', I0=1.0 (arb.), Ibkg=0.0 (arb.), restype='no conv', res=0.001 ([coord]), respoints=5 (pts.), resintrange=2.0 ([coord]), footype='no corr', beamw=0.01 (mm), samplelen=10.0 (mm), taylor_n=2)
Specify parameters of the probe and reflectometry instrument.
wavelength
The wavelength of the radiation given in AA (Angstroms)
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’ and ‘fast conv + varying res’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
taylor_n
The number terms taken into account in the taylor expansion of the fourier integral of the correlation function. More terms more accurate calculation but also much slower.
- class genx.models.interdiff.Coords(value)¶
An enumeration.
- alternate_tth = 'tth'¶
- q = 'q'¶
- tth = '2θ'¶
- class genx.models.interdiff.FootType(value)¶
An enumeration.
- gauss = 'gauss beam'¶
- none = 'no corr'¶
- square = 'square beam'¶
- class genx.models.interdiff.Instrument(*, wavelength: float = 1.54, coords: genx.models.interdiff.Coords = '2θ', I0: float = 1.0, Ibkg: float = 0.0, restype: genx.models.interdiff.ResType = 'no conv', res: float = 0.001, respoints: int = 5, resintrange: float = 2.0, footype: genx.models.interdiff.FootType = 'no corr', beamw: float = 0.01, samplelen: float = 10.0, taylor_n: int = 2, **user_kwds)¶
Specify parameters of the probe and reflectometry instrument.
wavelength
The wavelength of the radiation given in AA (Angstroms)
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’ and ‘fast conv + varying res’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
taylor_n
The number terms taken into account in the taylor expansion of the fourier integral of the correlation function. More terms more accurate calculation but also much slower.
- Groups = [('Radiation', ['wavelength', 'I0', 'Ibkg']), ('X-Resolution', ['restype', 'res', 'respoints', 'resintrange']), ('X-Coordinates', ['coords']), ('DWBA', ['taylor_n']), ('Footprint', ['footype', 'beamw', 'samplelen'])]¶
- I0: float = 1.0¶
- Ibkg: float = 0.0¶
- Units = {'2θ': '°', 'I0': 'arb.', 'Ibkg': 'arb.', 'beamw': 'mm', 'coords': '', 'footype': '', 'q': 'Å$^-1$', 'res': '[coord]', 'resintrange': '[coord]', 'respoints': 'pts.', 'restype': '', 'samplelen': 'mm', 'tth': '°', 'wavelength': 'Å'}¶
- beamw: float = 0.01¶
- coords: genx.models.interdiff.Coords = '2θ'¶
- footype: genx.models.interdiff.FootType = 'no corr'¶
- res: float = 0.001¶
- resintrange: float = 2.0¶
- respoints: int = 5¶
- restype: genx.models.interdiff.ResType = 'no conv'¶
- samplelen: float = 10.0¶
- taylor_n: int = 2¶
- wavelength: float = 1.54¶
- class genx.models.interdiff.Layer(*, d: float = 0.0, dens: float = 1.0, sigma: float = 5.0, sigmai: float = 0.0, f: complex = 1e-20j, **user_kwds)¶
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The total root mean square roughness of the top interface of the layer in Angstroms. This includes both the extended “wavy” roughness sigmar and the atomic-scale interface broadening due to interdiffusion sigmai. It is defined as sqrt(sigmar**2+sigmai**2).
sigmai
The root mean square interdiffusion of the top interface of the layer in Angstroms.
f
The x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
- Groups = [('General', ['d', 'dens', 'sigma', 'sigmai']), ('X-Ray', ['f'])]¶
- Units = {'d': 'AA', 'dens': 'at./AA', 'f': 'el./at.', 'sigma': 'AA', 'sigmai': 'AA'}¶
- d: float = 0.0¶
- dens: float = 1.0¶
- f: complex = 1e-20j¶
- sigma: float = 5.0¶
- sigmai: float = 0.0¶
- class genx.models.interdiff.LayerParameters(d: List[float], dens: List[float], sigma: List[float], sigmai: List[float], f: List[complex])¶
- d: List[float]¶
- dens: List[float]¶
- f: List[complex]¶
- sigma: List[float]¶
- sigmai: List[float]¶
- genx.models.interdiff.OffSpecularMingInterdiff(TwoThetaQz, ThetaQx, sample: genx.models.interdiff.Sample, instrument: genx.models.interdiff.Instrument)¶
Function that simulates the off-specular signal (not implemented)
# BEGIN Parameters TwoThetaQz 1.0 ThetaQx data.x # END Parameters
- class genx.models.interdiff.ResType(value)¶
An enumeration.
- fast_conv = 'fast conv'¶
- fast_conv_var = 'fast conv + varying res.'¶
- full_conv_abs = 'full conv and varying res.'¶
- none = 'no conv'¶
- genx.models.interdiff.SLD_calculations(z, item, sample: genx.models.interdiff.Sample, inst: genx.models.interdiff.Instrument)¶
Calculates the scatteringlength density as at the positions z
# BEGIN Parameters z data.x item “Re” # END Parameters
- class genx.models.interdiff.Sample(*, Stacks: List[genx.models.interdiff.Stack] = <factory>, Ambient: genx.models.interdiff.Layer = <factory>, Substrate: genx.models.interdiff.Layer = <factory>, eta_z: float = 100.0, eta_x: float = 100.0, h: float = 1.0, **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.eta_z
The out-of plane (vertical) correlation length of the roughness in the sample. Given in AA.
eta_x
The in-plane global correlation length (it is assumed equal for all layers). Given in AA.
h
The jaggedness parameter, should be between 0 (jagged) and 1.0 (smooth). This describes how jagged the interfaces are. This is also a global parameter for all interfaces. (See e.g.: [book](https://doi.org/10.1007/978-1-4612-3784-6_2) )
- SimOffSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- Stacks: List[genx.models.interdiff.Stack]¶
- eta_x: float = 100.0¶
- eta_z: float = 100.0¶
- h: float = 1.0¶
- genx.models.interdiff.Specular(TwoThetaQz, sample: genx.models.interdiff.Sample, instrument: genx.models.interdiff.Instrument)¶
Simulate the specular signal from sample when proped with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- class genx.models.interdiff.Stack(*, Layers: List[genx.models.interdiff.Layer] = <factory>, Repetitions: int = 1, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
- Layers: List[genx.models.interdiff.Layer]¶
- Repetitions: int = 1¶
- class genx.models.interdiff.TestInterdiff(methodName='runTest')¶
- test_offspec()¶
- test_sld()¶
- test_spec()¶
- genx.models.interdiff.q_limit = 1e-10¶
Minimum allowed q-value
- genx.models.interdiff.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
Library for specular magnetic x-ray and neutron reflectivity¶
The magnetic reflectivity is calculated according to: S.A. Stephanov and
S.K Shina PRB 61 15304. for the full anisotropic model. It also one
simpler model where the media is considered to be isotropic but with
different refractive indices for left and right circular light. The
model also has the possibility to calculate the neutron reflectivity
from the same sample structure. This model includes a interface layer
for each Layer
. This means that the model is suitable for refining
data that looks for interfacial changes of the magnetic moment. Note!
This model should be considered as a gamma version. It is still under
heavy development and the api can change significantly from version to
version. Should only be used by expert users.
Classes¶
Layer¶
Layer(d=0.0 (AA), dens=1.0 (at./AA), sigma=0.0 (AA), f=1e-20j (el./at.), fr=0j (el.), fm1=0j (el./mu_B), fm2=0j (el./mu_B^2), resdens=1.0 (rel.), resmag=1.0 (rel.), dd_l=0.0 (AA), dd_u=0.0 (AA), dmag_l=0.0 (rel.), dmag_u=0.0 (rel.), sigma_ml=0.0 (AA), sigma_mu=0.0 (AA), b=0j (fm/at.), xs_ai=0.0 (barn/at.), magn=0.0 (mu_B/at.), magn_ang=0.0 (deg.), magn_theta=0.0)
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root mean square roughness of the top interface for the layer in Angstroms.
f
The non-resonant x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
fr
The resonant x-ray scattering length of the resonant species in electrons. This is multiplied by
resdens*dens
to form the resonant scattering length. The total non-magnetic scattering length is(f + fr*resdens)*dens
.fm1
The resonant magnetic part of the scattering length - refers to the magnetic circular dichroic part. Same units as
f
fm2
The resonant magnetic part of the scattering length - refers to the magnetic linear dichroic part.
resdens
Relative fraction of resonant species in the formula unit. See
fr
for details.resmag
The relative amount of magnetic resonant atoms the total resonant magnetic atoms. The total magnetic scattering length is calculated as (for the circular dichroic term)
fm1*resmag*mag*resdens*dens
dd_u
The width of the upper interface layer in Angstroms.
dmag_u
The relative increase of the magnetic moment in the upper interface layer. Total magnetic moment is
mag*(1 + dmag_u)
.sigma_mu
The roughness of the upper magnetic interface.
dd_l
The width of the lower interface in Angstroms.
dmag_l
As
dmag_u
but for the lower interface layer.sigma_ml
The roughness of the lower magnetic interface.
b
The neutron scattering length in fm.
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns per formula unit for the neutrons
magn
The magnetic moment per formula unit. The magnetic density is
mag*dens
.magn_ang
The in-plane angle of the magnetic moment of the layer relative the projected incident beam for x-rays and relative the polarization axis for neutrons.
magn_theta
The out-of-plane angle of the magnetic moment.
magn_theta = 0
corresponds to an in-plane magnetic moment andmagn_theta = 90
corresponds to an out-of-plane magnetic moment.
Instrument¶
Instrument(probe='x-ray', wavelength=1.54 (Å), I0=1.0 (arb.), Ibkg=0.0 (arb.), xpol='tot', npol='uu', coords='2θ', incangle=0.5 (°), restype='no conv', res=0.001 ([coord]), respoints=5 (pts.), resintrange=2.0 ([coord]), footype='no corr', beamw=0.01 (mm), samplelen=10.0 (mm))
Specify parameters of the probe and reflectometry instrument.
probe
Defines the theory (model) that should calcualte the reflectivity. Should be one of: ‘x-ray anis.’, ‘x-ray simpl. anis.’, ‘x-ray’, ‘neutron pol’, ‘neutron pol tof’ or ‘neutron pol spin flip’. Neutron models use either Parratt’s formaism (non spin-flip models) or optical matrix method.
wavelength
The wavelength of the radiation given in AA (Angstroms)
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
xpol
The polarization state of the x-ray beam. Should be one of: ‘circ+’,’circ-‘,’tot’, ‘ass’, ‘sigma’, ‘pi’, ‘sigma-sigma’, ‘sigma-pi’, ‘pi-pi’ or ‘pi-sigma’
npol
The neutron polarization state. Should be ‘++’, ‘–’ or ‘+-‘,’-+’ for spin flip.
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
tthoff
Linear offset to the scattering angle calibration
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
Stack¶
Stack(Layers=<factory>, Repetitions=1)
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
Sample¶
Sample(Stacks=<factory>, Ambient=<factory>, Substrate=<factory>, slicing=False, slice_depth=1.0 (AA), sld_mult=4.0, sld_buffer=20.0, sld_delta=5.0, compress=True, dsld_max=0.1, dsld_offdiag_max=0.1, dmag_max=0.01, dsld_n_max=0.01, dabs_n_max=0.01)
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.slicing
A flag that signals if the composition profile should be sliced up.
slice_depth
The depth of the slices in the calculation of the sliced scattering length density profile.
sld_mult
A multiplication factor for a buffer that takes the roughness into account.
sld_buffer
A buffer for the slicing calculations (to assure convergence in the sld profile.
sld_delta
An extra buffer - needed at all?
compress
A flag that signals if the sliced composition profile should be compressed.
dsld_max
The maximum allowed step in the scattering length density for x-rays (diagonal terms)
dsld_offdiag_max
The maximum allowed step in the scattering length density for the offdiagonal terms of the scattering length (magnetic part)
dmag_max
The maximum allowed step (in compression) for the magnetization. Primarily intended to limit the steps in the magnetic profile for neutrons.
dsld_n_max
The maximum allowed step (in compression) for the neutron scattering length.
dabs_n_max
The maximum allowed step (in compression) for the neutron absorption (in units of barn/AA^3)
- class genx.models.mag_refl.Coords(value)¶
An enumeration.
- alternate_tth = 'tth'¶
- q = 'q'¶
- tth = '2θ'¶
- genx.models.mag_refl.EnergySpecular(Energy, TwoThetaQz, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Simulate the specular signal from sample when probed with instrument. Energy should be in eV.
# BEGIN Parameters Energy data.x TwoThetaQz 3.0 # END Parameters
- genx.models.mag_refl.EnergySpecularField(Energy, TwoThetaQz, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Simulate the specular signal from sample when probed with instrument. Energy should be in eV. Returns the wave field (complex number) of the reflected wave. No resolution is taken into account.
# BEGIN Parameters Energy data.x TwoThetaQz 3.0 # END Parameters
- class genx.models.mag_refl.FootType(value)¶
An enumeration.
- gauss = 'gauss beam'¶
- none = 'no corr'¶
- square = 'square beam'¶
- class genx.models.mag_refl.Instrument(*, probe: genx.models.mag_refl.ProbeTheory = 'x-ray', wavelength: float = 1.54, I0: float = 1.0, Ibkg: float = 0.0, xpol: genx.models.mag_refl.XRayPol = 'tot', npol: genx.models.mag_refl.NeutronPol = 'uu', coords: genx.models.mag_refl.Coords = '2θ', incangle: float = 0.5, restype: genx.models.mag_refl.ResType = 'no conv', res: float = 0.001, respoints: int = 5, resintrange: float = 2.0, footype: genx.models.mag_refl.FootType = 'no corr', beamw: float = 0.01, samplelen: float = 10.0, **user_kwds)¶
Specify parameters of the probe and reflectometry instrument.
probe
Defines the theory (model) that should calcualte the reflectivity. Should be one of: ‘x-ray anis.’, ‘x-ray simpl. anis.’, ‘x-ray’, ‘neutron pol’, ‘neutron pol tof’ or ‘neutron pol spin flip’. Neutron models use either Parratt’s formaism (non spin-flip models) or optical matrix method.
wavelength
The wavelength of the radiation given in AA (Angstroms)
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
xpol
The polarization state of the x-ray beam. Should be one of: ‘circ+’,’circ-‘,’tot’, ‘ass’, ‘sigma’, ‘pi’, ‘sigma-sigma’, ‘sigma-pi’, ‘pi-pi’ or ‘pi-sigma’
npol
The neutron polarization state. Should be ‘++’, ‘–’ or ‘+-‘,’-+’ for spin flip.
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘2θ’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
tthoff
Linear offset to the scattering angle calibration
incangle
The incident angle of the neutrons, only valid in tof mode
restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’, ‘fast conv + varying res.’, ‘full conv and varying res. (dx/x)’, ‘fast conv + varying res. (dx/x)’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian resolution function andres
is the standard deviation of that gaussian. Ifrestype
has (dx/x) in its name the gaussian standard deviation is given by res*x where x is either in tth or q.respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’, ‘fast conv + varying res’, ‘full conv and varying res. (dx/x)’ and ‘fast conv + varying res. (dx/x)’.
resintrange
Number of standard deviatons to integrate the resolution function times the reflectivity over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self expnalatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm
- Groups = [('Radiation', ['probe', 'wavelength', 'I0', 'Ibkg', 'xpol', 'npol']), ('X-Resolution', ['restype', 'res', 'respoints', 'resintrange']), ('X-Coordinates', ['coords', 'incangle']), ('Footprint', ['footype', 'beamw', 'samplelen'])]¶
- I0: float = 1.0¶
- Ibkg: float = 0.0¶
- Units = {'2θ': '°', 'I0': 'arb.', 'Ibkg': 'arb.', 'beamw': 'mm', 'coords': '', 'footype': '', 'incangle': '°', 'npol': '', 'probe': '', 'q': 'Å$^-1$', 'res': '[coord]', 'resintrange': '[coord]', 'respoints': 'pts.', 'restype': '', 'samplelen': 'mm', 'tth': '°', 'wavelength': 'Å', 'xpol': ''}¶
- beamw: float = 0.01¶
- coords: genx.models.mag_refl.Coords = '2θ'¶
- footype: genx.models.mag_refl.FootType = 'no corr'¶
- incangle: float = 0.5¶
- npol: genx.models.mag_refl.NeutronPol = 'uu'¶
- probe: genx.models.mag_refl.ProbeTheory = 'x-ray'¶
- res: float = 0.001¶
- resintrange: float = 2.0¶
- respoints: int = 5¶
- restype: genx.models.mag_refl.ResType = 'no conv'¶
- samplelen: float = 10.0¶
- wavelength: float = 1.54¶
- xpol: genx.models.mag_refl.XRayPol = 'tot'¶
- class genx.models.mag_refl.Layer(*, d: float = 0.0, dens: float = 1.0, sigma: float = 0.0, f: complex = 1e-20j, fr: complex = 0j, fm1: complex = 0j, fm2: complex = 0j, resdens: float = 1.0, resmag: float = 1.0, dd_l: float = 0.0, dd_u: float = 0.0, dmag_l: float = 0.0, dmag_u: float = 0.0, sigma_ml: float = 0.0, sigma_mu: float = 0.0, b: complex = 0j, xs_ai: float = 0.0, magn: float = 0.0, magn_ang: float = 0.0, magn_theta: float = 0.0, **user_kwds)¶
Representing a layer in the sample structur.
d
The thickness of the layer in AA (Angstroms = 1e-10m)
dens
The density of formula units in units per Angstroms. Note the units!
sigma
The root mean square roughness of the top interface for the layer in Angstroms.
f
The non-resonant x-ray scattering length per formula unit in electrons. To be strict it is the number of Thompson scattering lengths for each formula unit.
fr
The resonant x-ray scattering length of the resonant species in electrons. This is multiplied by
resdens*dens
to form the resonant scattering length. The total non-magnetic scattering length is(f + fr*resdens)*dens
.fm1
The resonant magnetic part of the scattering length - refers to the magnetic circular dichroic part. Same units as
f
fm2
The resonant magnetic part of the scattering length - refers to the magnetic linear dichroic part.
resdens
Relative fraction of resonant species in the formula unit. See
fr
for details.resmag
The relative amount of magnetic resonant atoms the total resonant magnetic atoms. The total magnetic scattering length is calculated as (for the circular dichroic term)
fm1*resmag*mag*resdens*dens
dd_u
The width of the upper interface layer in Angstroms.
dmag_u
The relative increase of the magnetic moment in the upper interface layer. Total magnetic moment is
mag*(1 + dmag_u)
.sigma_mu
The roughness of the upper magnetic interface.
dd_l
The width of the lower interface in Angstroms.
dmag_l
As
dmag_u
but for the lower interface layer.sigma_ml
The roughness of the lower magnetic interface.
b
The neutron scattering length in fm.
xs_ai
The sum of the absorption cross section and the incoherent scattering cross section in barns per formula unit for the neutrons
magn
The magnetic moment per formula unit. The magnetic density is
mag*dens
.magn_ang
The in-plane angle of the magnetic moment of the layer relative the projected incident beam for x-rays and relative the polarization axis for neutrons.
magn_theta
The out-of-plane angle of the magnetic moment.
magn_theta = 0
corresponds to an in-plane magnetic moment andmagn_theta = 90
corresponds to an out-of-plane magnetic moment.
- Groups = [('General', ['d', 'dens', 'sigma']), ('Neutron', ['b', 'xs_ai']), ('X-Ray', ['f', 'fr', 'fm1', 'fm2', 'resdens', 'resmag']), ('Magnetic', ['magn', 'magn_ang', 'magn_theta']), ('Magn. Interfaces', ['dd_u', 'dmag_u', 'sigma_mu', 'dd_l', 'dmag_l', 'sigma_ml'])]¶
- Units = {'b': 'fm/at.', 'd': 'AA', 'dd_l': 'AA', 'dd_u': 'AA', 'dens': 'at./AA', 'dmag_l': 'rel.', 'dmag_u': 'rel.', 'f': 'el./at.', 'fm1': 'el./mu_B', 'fm2': 'el./mu_B^2', 'fr': 'el.', 'mag': 'mu_B', 'magn': 'mu_B/at.', 'magn_ang': 'deg.', 'phi_m': 'deg.', 'resdens': 'rel.', 'resmag': 'rel.', 'sigma': 'AA', 'sigma_c': 'AA', 'sigma_ml': 'AA', 'sigma_mu': 'AA', 'theta_m': 'deg.', 'xs_ai': 'barn/at.'}¶
- b: complex = 0j¶
- d: float = 0.0¶
- dd_l: float = 0.0¶
- dd_u: float = 0.0¶
- dens: float = 1.0¶
- dmag_l: float = 0.0¶
- dmag_u: float = 0.0¶
- f: complex = 1e-20j¶
- fm1: complex = 0j¶
- fm2: complex = 0j¶
- fr: complex = 0j¶
- magn: float = 0.0¶
- magn_ang: float = 0.0¶
- magn_theta: float = 0.0¶
- resdens: float = 1.0¶
- resmag: float = 1.0¶
- sigma: float = 0.0¶
- sigma_ml: float = 0.0¶
- sigma_mu: float = 0.0¶
- xs_ai: float = 0.0¶
- class genx.models.mag_refl.LayerParameters(d: List[float], dens: List[float], sigma: List[float], magn: List[float], magn_ang: List[float], magn_theta: List[float], f: List[complex], fr: List[complex], fm1: List[complex], fm2: List[complex], resdens: List[float], resmag: List[float], b: List[complex], xs_ai: List[float], dd_l: List[float], dd_u: List[float], dmag_l: List[float], dmag_u: List[float], sigma_ml: List[float], sigma_mu: List[float])¶
- b: List[complex]¶
- d: List[float]¶
- dd_l: List[float]¶
- dd_u: List[float]¶
- dens: List[float]¶
- dmag_l: List[float]¶
- dmag_u: List[float]¶
- f: List[complex]¶
- fm1: List[complex]¶
- fm2: List[complex]¶
- fr: List[complex]¶
- magn: List[float]¶
- magn_ang: List[float]¶
- magn_theta: List[float]¶
- resdens: List[float]¶
- resmag: List[float]¶
- sigma: List[float]¶
- sigma_ml: List[float]¶
- sigma_mu: List[float]¶
- xs_ai: List[float]¶
- class genx.models.mag_refl.NBuffer¶
- Rdd = 0¶
- Rdu = 0¶
- Rud = 0¶
- Ruu = 0¶
- TwoThetaQz = None¶
- parameters = None¶
- class genx.models.mag_refl.NeutronPol(value)¶
An enumeration.
- alternate_down_down = '--'¶
- alternate_down_up = '-+'¶
- alternate_up_down = '+-'¶
- alternate_up_up = '++'¶
- asymmetry = 'ass'¶
- down_down = 'dd'¶
- down_up = 'du'¶
- up_down = 'ud'¶
- up_up = 'uu'¶
- genx.models.mag_refl.OffSpecular(TwoThetaQz, ThetaQx, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Function that simulates the off-specular signal (not implemented)
# BEGIN Parameters TwoThetaQz 1.0 ThetaQx data.x # END Parameters
- class genx.models.mag_refl.ProbeTheory(value)¶
An enumeration.
- npol = 'neutron pol'¶
- npolsf = 'neutron pol spin flip'¶
- ntofpol = 'neutron pol tof'¶
- xray_aniso = 'x-ray anis.'¶
- xray_iso = 'x-ray'¶
- xray_simple_aniso = 'x-ray simpl. anis.'¶
- class genx.models.mag_refl.ResType(value)¶
An enumeration.
- fast_conv = 'fast conv'¶
- fast_conv_var = 'fast conv + varying res.'¶
- full_conv_var = 'full conv and varying res.'¶
- none = 'no conv'¶
- genx.models.mag_refl.SLD_calculations(z, item, sample: genx.models.mag_refl.Sample, inst: genx.models.mag_refl.Instrument)¶
Calculates the scatteringlength density as at the positions z if item is None or “all” the function returns a dictonary of values. Otherwise it returns the item as identified by its string.
# BEGIN Parameters z data.x item “Re sld_c” # END Parameters
- class genx.models.mag_refl.Sample(*, Stacks: List[genx.models.mag_refl.Stack] = <factory>, Ambient: genx.models.mag_refl.Layer = <factory>, Substrate: genx.models.mag_refl.Layer = <factory>, slicing: bool = False, slice_depth: float = 1.0, sld_mult: float = 4.0, sld_buffer: float = 20.0, sld_delta: float = 5.0, compress: bool = True, dsld_max: float = 0.1, dsld_offdiag_max: float = 0.1, dmag_max: float = 0.01, dsld_n_max: float = 0.01, dabs_n_max: float = 0.01, **user_kwds)¶
Describe global sample by listing ambient, substrate and layer parameters.
Stacks
A
list
consiting ofStacks
in the stacks the first item is the layer closest to the bottomAmbient
A
Layer
describing the Ambient (enviroment above the sample). Only the scattering lengths and density of the layer is used.Substrate
A
Layer
describing the substrate (enviroment below the sample). Only the scattering lengths, density and roughness of the layer is used.slicing
A flag that signals if the composition profile should be sliced up.
slice_depth
The depth of the slices in the calculation of the sliced scattering length density profile.
sld_mult
A multiplication factor for a buffer that takes the roughness into account.
sld_buffer
A buffer for the slicing calculations (to assure convergence in the sld profile.
sld_delta
An extra buffer - needed at all?
compress
A flag that signals if the sliced composition profile should be compressed.
dsld_max
The maximum allowed step in the scattering length density for x-rays (diagonal terms)
dsld_offdiag_max
The maximum allowed step in the scattering length density for the offdiagonal terms of the scattering length (magnetic part)
dmag_max
The maximum allowed step (in compression) for the magnetization. Primarily intended to limit the steps in the magnetic profile for neutrons.
dsld_n_max
The maximum allowed step (in compression) for the neutron scattering length.
dabs_n_max
The maximum allowed step (in compression) for the neutron absorption (in units of barn/AA^3)
- Groups = [('Slicing', ['slicing', 'slice_depth', 'sld_mult', 'sld_buffer', 'sld_delta']), ('Compression', ['compress', 'dsld_max', 'dsld_offdiag_max', 'dmag_max', 'dsld_n_max', 'dabs_n_max'])]¶
- SimEnergySpecular(*args)¶
- SimEnergySpecularField(*args)¶
- SimOffSpecular(*args)¶
- SimSLD(*args)¶
- SimSpecular(*args)¶
- SimSpecularElectricField(*args)¶
- Stacks: List[genx.models.mag_refl.Stack]¶
- Units = {'slice_depth': 'AA'}¶
- compress: bool = True¶
- dabs_n_max: float = 0.01¶
- dmag_max: float = 0.01¶
- dsld_max: float = 0.1¶
- dsld_n_max: float = 0.01¶
- dsld_offdiag_max: float = 0.1¶
- sld_buffer: float = 20.0¶
- sld_delta: float = 5.0¶
- sld_mult: float = 4.0¶
- slice_depth: float = 1.0¶
- slicing: bool = False¶
- genx.models.mag_refl.Specular(TwoThetaQz, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Simulate the specular signal from sample when proped with instrument
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- genx.models.mag_refl.SpecularElectricField(TwoThetaQz, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Simulate the specular signal from sample when probed with instrument. Returns the wave field (complex number) of the reflected wave. No resolution is taken into account.
# BEGIN Parameters TwoThetaQz data.x # END Parameters
- class genx.models.mag_refl.Stack(*, Layers: List[genx.models.mag_refl.Layer] = <factory>, Repetitions: int = 1, **user_kwds)¶
A collection of Layer objects that can be repeated.
Layers
A
list
consiting ofLayers
in the stack the first item is the layer closest to the bottomRepetitions
The number of repsetions of the stack
- Layers: List[genx.models.mag_refl.Layer]¶
- Repetitions: int = 1¶
- class genx.models.mag_refl.TestSpecNX(methodName='runTest')¶
- test_energy()¶
- test_sld()¶
- test_spec_neutron()¶
- test_spec_slicing()¶
- test_spec_xray()¶
- class genx.models.mag_refl.XBuffer¶
- W = None¶
- coords = None¶
- g_0 = None¶
- parameters = None¶
- wavelength = None¶
- class genx.models.mag_refl.XRayPol(value)¶
An enumeration.
- alternate_pi = 'pi'¶
- alternate_pi_pi = 'pi-pi'¶
- alternate_pi_sigma = 'pi-sigma'¶
- alternate_sigma = 'sigma'¶
- alternate_sigma_pi = 'sigma-pi'¶
- alternate_sigma_sigma = 'sigma-sigma'¶
- asymmetry = 'ass'¶
- circ_minus = 'circ-'¶
- circ_plus = 'circ+'¶
- pi = 'π'¶
- pi_pi = 'π-π'¶
- pi_sigma = 'π-σ'¶
- sigma = 'σ'¶
- sigma_pi = 'σ-π'¶
- sigma_sigma = 'σ-σ'¶
- total = 'tot'¶
- genx.models.mag_refl.analytical_reflectivity(sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument, theta, TwoThetaQz, xray_energy, return_amplitude=True)¶
- genx.models.mag_refl.compose_sld(sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument, theta, xray_energy, layer=None)¶
Composes the sld for a slicing model
- Parameters
sample – The sample
instrument – The instrument
theta – The incident angle
xray_energy – The xray energy either scalar or array
layer – Defines which layer number to return. If None (default) returns the entire profile.
- genx.models.mag_refl.compose_sld_anal(z, sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument)¶
Compose a analytical profile funciton
- genx.models.mag_refl.convolute_reflectivity(R, instrument: genx.models.mag_refl.Instrument, foocor, TwoThetaQz, weight)¶
- genx.models.mag_refl.correct_reflectivity(R, TwoThetaQz, instrument: genx.models.mag_refl.Instrument, theta, weight)¶
- genx.models.mag_refl.extract_anal_iso_pars(sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument, theta, xray_energy, pol, Q=None)¶
Note Q is only used for Neutron TOF :param lamda:
- genx.models.mag_refl.footprint_correction(instrument: genx.models.mag_refl.Instrument, theta)¶
- genx.models.mag_refl.neturon_sld(abs_xs, b, dens, wl)¶
- genx.models.mag_refl.reflectivity_xmag(sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument, theta, TwoThetaQz, xray_energy, return_amplitude=True)¶
- genx.models.mag_refl.slicing_reflectivity(sample: genx.models.mag_refl.Sample, instrument: genx.models.mag_refl.Instrument, theta, TwoThetaQz, xray_energy, return_amplitude=True)¶
- genx.models.mag_refl.standard_xray()¶
return the defied standard x-ray reflectivity to compare against other models
- genx.models.mag_refl.theta_limit = 1e-08¶
model.Instrument(res = 0.001,theory = 'neutron spin-pol', footype = 'no corr',beamw = 0.01, wavelength = 4.4,respoints = 5,xpol = 'circ+',Ibkg = 0.0, I0 = 1.0,samplelen = 10.0,npol = '++',restype = 'no conv', coords = 'tth',resintrange = 2)
wavelength
The wavalelngth of the radiation givenin AA (Angstroms)
coords
The coordinates of the data given to the SimSpecular function. The available alternatives are: ‘q’ or ‘tth’. Alternatively the numbers 0 (q) or 1 (tth) can be used.
I0
The incident intensity (a scaling factor)
Ibkg
The background intensity. Added as a constant value to the calculated reflectivity
res
The resolution of the instrument given in the coordinates of
coords
. This assumes a gaussian reloution function andres
is the standard deviation of that gaussian.restype
Describes the rype of the resolution calculated. One of the alterantives: ‘no conv’, ‘fast conv’, ‘full conv and varying res.’ or ‘fast conv + varying res.’. The respective numbers 0-3 also works. Note that fast convolution only alllows a single value into res wheras the other can also take an array with the same length as the x-data (varying resolution)
respoints
The number of points to include in the resolution calculation. This is only used for ‘full conv and vaying res.’ and ‘fast conv + varying res’
resintrange
Number of standard deviatons to integrate the resolution fucntion times the relfectivty over
footype
Which type of footprint correction is to be applied to the simulation. One of: ‘no corr’, ‘gauss beam’ or ‘square beam’. Alternatively, the number 0-2 are also valid. The different choices are self explanatory.
beamw
The width of the beam given in mm. For ‘gauss beam’ it should be the standard deviation. For ‘square beam’ it is the full width of the beam.
samplelen
The length of the sample given in mm