structure module

Define helper functions to visualize elements.

Todo

Information on the objective under the cursor (hover).

patch_kwargs(elt, x_axis, idx=None, color=None, alpha=None, pos='in')[source]

Give kwargs for the patch function.

In particular: position and color.

Parameters:
Return type:

dict[str, Any]

_limits(elts, x_axis)[source]

Give the limits of the plot.

Parameters:
Return type:

tuple[float, float]

plot_structure(elts, ax, x_axis='z_abs')[source]

Plot structure of the linac under study.

Parameters:
Return type:

None

_plot_aperture(x_0, width, **kwargs)[source]

Add a thin line to show an aperture.

Parameters:
Return type:

Rectangle

_plot_bend(x_0, width, **kwargs)[source]

Add a greyed rectangle to show a bend.

Parameters:
Return type:

Rectangle

_plot_drift(x_0, width, **kwargs)[source]

Add a little rectangle to show a drift.

Parameters:
Return type:

Rectangle

_plot_field_map(x_0, width, elt, **kwargs)[source]

Add an ellipse to show a field_map.

Parameters:
Return type:

Ellipse

_plot_edge(x_0, width, **kwargs)[source]

Add a thin line to show an edge.

Parameters:
Return type:

Rectangle

_plot_quad(x_0, width, **kwargs)[source]

Add a crossed large rectangle to show a quad.

Parameters:
Return type:

Polygon

outline_sections(elts, ax, x_axis='z_abs')[source]

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

Parameters:
Return type:

None