structure module

Define helper functions to visualize elements.

Todo

Information on the objective under the cursor (hover).

patch_kwargs(elt: Element, x_axis: Literal['z_abs', 'elt_idx'], idx: int | None = None, color: tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None = None, alpha: float | None = None) dict

Give kwargs for the patch function.

_limits(elts: ListOfElements, x_axis: Literal['z_abs', 'elt_idx']) tuple[float, float]

Give the limits of the plot.

plot_structure(elts: ListOfElements, ax: Axes, x_axis: Literal['z_abs', 'elt_idx'] = 'z_abs') None

Plot structure of the linac under study.

_plot_aperture(x_0: float, width: float, **kwargs) Rectangle

Add a thin line to show an aperture.

_plot_bend(x_0: float, width: float, **kwargs) Rectangle

Add a greyed rectangle to show a bend.

_plot_drift(x_0: float, width: float, **kwargs) Rectangle

Add a little rectangle to show a drift.

_plot_field_map(x_0: float, width: float, elt: FieldMap, **kwargs) Ellipse

Add an ellipse to show a field_map.

_plot_edge(x_0: float, width: float, **kwargs) Rectangle

Add a thin line to show an edge.

_plot_quad(x_0: float, width: float, **kwargs) Polygon

Add a crossed large rectangle to show a quad.

outline_sections(elts: ListOfElements, ax: Axes, x_axis: Literal['z_abs', 'elt_idx', 'last_elt_of_sec'] = 'z_abs') None

Add light grey rectangles behind the plot to show the sections.