A sample is always represented by an instance of class Sample.
The sample is created by the constructor call
sample = ba.Sample()
Layers can be added individually with
sample.addLayer(layer)
or within periodic layer stacks:
sample.addStack(stack)
For the arguments, see sections Layer and LayerStack.
The layer added first is the top layer (typically vacuum). The layer added last is the bottom layer (typically substrate).
Layers are either finite (with a specified thickness) or semi-infinite (extending to infinity in one direction). There are no infinite layers (extending to infinity in both directions). As a consequence, a sample must contain at least two layers: a semi-infinite top layer and a semi-infinite bottom layer.
The top and bottom layers must be of simple Layer type, and have infinite thickness.
All other layers have finite thickness, and may also be of type LayerStack.