# model - Reflectivity Models¶

 Repeat Repeat a layer or stack. Slab A block of material. Stack Reflectometry layer stack Layer Component of a material description.

Reflectometry models

Reflectometry models consist of 1-D stacks of layers. Layers are joined by gaussian interfaces. The layers themselves may be uniform, or the scattering density may vary with depth in the layer.

Note

By importing model, the definition of material.Scatterer changes so that materials can be stacked into layers using operator overloading: - the | operator, (previously known as “bitwise or”) joins stacks - the * operator repeats stacks (n times, n is an int)

This will affect all instances of the Scatterer class, and all of its subclasses.

class refl1d.model.Repeat(stack, repeat=1, interface=None, name=None, magnetism=None)[source]

Repeat a layer or stack.

If an interface parameter is provide, the roughness between the multilayers may be different from the roughness between the repeated stack and the following layer.

Note: Repeat is not a type of Stack, but it does have a stack inside.

constraints()

Constraints

find(z)[source]

Find the layer at depth z.

Returns layer, start, end

interface = None
ismagnetic
layer_parameters()
magnetism
name = None
parameters()[source]

Returns a dictionary of parameters specific to the layer. These will be added to the dictionary containing interface, thickness and magnetism parameters.

penalty()[source]

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]

Use the probe to render the layer into a microslab representation.

thickness
to_dict()[source]

Return a dictionary representation of the Repeat object

class refl1d.model.Slab(material=None, thickness=0, interface=0, name=None, magnetism=None)[source]

A block of material.

constraints()

Constraints

find(z)

Find the layer at depth z.

Returns layer, start, end

interface = None
ismagnetic
layer_parameters()
magnetism
name = None
parameters()[source]

Returns a dictionary of parameters specific to the layer. These will be added to the dictionary containing interface, thickness and magnetism parameters.

penalty()

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]

Use the probe to render the layer into a microslab representation.

thickness = None
to_dict()[source]

Return a dictionary representation of the Slab object

class refl1d.model.Stack(base=None, name='Stack')[source]

Reflectometry layer stack

A reflectometry sample is defined by a stack of layers. Each layer has an interface describing how the top of the layer interacts with the bottom of the overlaying layer. The stack may contain

add(other)[source]
constraints()

Constraints

find(z)[source]

Find the layer at depth z.

Returns layer, start, end

insert(idx, other)[source]

Insert structure into a stack. If the inserted element is another stack, the stack will be expanded to accommodate. You cannot make nested stacks.

interface = None
ismagnetic
layer_parameters()
magnetism
name = None
parameters()[source]

Returns a dictionary of parameters specific to the layer. These will be added to the dictionary containing interface, thickness and magnetism parameters.

penalty()[source]

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]

Use the probe to render the layer into a microslab representation.

thickness
to_dict()[source]

Return a dictionary representation of the Stack object

class refl1d.model.Layer[source]

Bases: object

Component of a material description.

thickness (Parameter: angstrom)
Thickness of the layer
interface (Parameter: angstrom)
Interface for the top of the layer.
magnetism (Magnetism info)
Magnetic profile anchored to the layer.
constraints()[source]

Constraints

find(z)[source]

Find the layer at depth z.

Returns layer, start, end

interface = None
ismagnetic
layer_parameters()[source]
magnetism
name = None
parameters()[source]

Returns a dictionary of parameters specific to the layer. These will be added to the dictionary containing interface, thickness and magnetism parameters.

penalty()[source]

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]

Use the probe to render the layer into a microslab representation.

thickness = None
to_dict()[source]

Return a dictionary representation of the Slab object