bosing.Absolute

class bosing.Absolute(*children, margin=None, alignment=None, phantom=False, duration=None, max_duration=Ellipsis, min_duration=Ellipsis, label=None)

基类:Element

An absolute layout element.

The child elements are arranged in absolute time. The time of each child element is relative to the start of the absolute schedule. The duration of the absolute schedule is the maximum end time of the child elements.

The children argument can be:

  • AbsoluteEntry

  • Element

  • tuple[float, Element]: Time and element.

参数:

*children (AbsoluteEntry | Element | tuple[float, Element]) -- Child elements.

示例

absolute = Absolute(
    element1,
    (1.0, element2),
    AbsoluteEntry(2.0, element3),
)
alignment
children
duration
label
margin
max_duration
measure()

Measure the minimum total duration required by the element.

This value includes both inner duration and outer margin of the element.

This value is a minimum total duration wanted by the element. If the element is a child of other element, the final total duration will be determined by alignment option and parent container type.

min_duration
phantom
plot(ax=None, *, channels=None, max_depth=5, show_label=True)

Plot arrange result with the element as root.

参数:
  • ax (matplotlib.axes.Axes | None) -- Axes to plot. If None, matplotlib.pyplot.gca is used.

  • channels (Sequence[str] | None) -- Channels to plot. If None, all channels are plotted.

  • max_depth (int) -- Maximum depth to plot. Defaults to 5.

  • show_label (bool) -- Whether to show label of elements. Defaults to True.

返回:

Axes with the plot.

返回类型:

matplotlib.axes.Axes

with_children(*children)

Create a new absolute schedule with different children.

Using this method may be more readable than specifying children in the constructor.

absolute = Absolute(duration=50e-6).with_children(
    element1,
    (100e-9, element2),
)
参数:

*children (AbsoluteEntry | Element | tuple[float, Element]) -- New child elements.

返回:

New absolute schedule.

返回类型:

Absolute