apace.plot

Module Contents

Classes

Color

TwissPlot

Convenience class to plot twiss parameters

Functions

draw_elements(ax, lattice, *, labels = True, location = 'top')

Draw the elements of a lattice onto a matplotlib axes.

draw_sub_lattices(ax, lattice, *, labels = True, location = 'top')

plot_twiss(ax, twiss, *, twiss_functions=('beta_x', 'beta_y', 'eta_x'), scales={'eta_x': 10, 'eta_x_dds': 10}, line_style='solid', line_width=1.3, alpha=1.0, show_ylabels=False)

_twiss_plot_section(ax, twiss, *, x_min=-inf, x_max=inf, y_min=None, y_max=None, annotate_elements=True, annotate_lattices=True, line_style='solid', line_width=1.3, twiss_ref=None, scales={'eta_x': 10}, overwrite=False)

find_optimal_grid(n)

floor_plan(ax, lattice, *, start_angle = 0, labels = True)

Attributes

FONT_SIZE

ELEMENT_COLOR

OPTICAL_FUNCTIONS

apace.plot.FONT_SIZE = 8
class apace.plot.Color

Attributes

RED = #EF4444
YELLOW = #FBBF24
GREEN = #10B981
BLUE = #3B82F6
ORANGE = F97316
PURPLE = #8B5CF6
CYAN = #06B6D4
WHITE = white
BLACK = black
LIGHT_GRAY = #D1D5DB
apace.plot.ELEMENT_COLOR :Dict[type, str]
apace.plot.OPTICAL_FUNCTIONS
apace.plot.draw_elements(ax, lattice, *, labels=True, location='top')

Draw the elements of a lattice onto a matplotlib axes.

Parameters
apace.plot.draw_sub_lattices(ax, lattice, *, labels=True, location='top')
Parameters
apace.plot.plot_twiss(ax, twiss, *, twiss_functions=('beta_x', 'beta_y', 'eta_x'), scales={'eta_x': 10, 'eta_x_dds': 10}, line_style='solid', line_width=1.3, alpha=1.0, show_ylabels=False)
apace.plot._twiss_plot_section(ax, twiss, *, x_min=- inf, x_max=inf, y_min=None, y_max=None, annotate_elements=True, annotate_lattices=True, line_style='solid', line_width=1.3, twiss_ref=None, scales={'eta_x': 10}, overwrite=False)
class apace.plot.TwissPlot(twiss, twiss_functions=('beta_x', 'beta_y', 'eta_x'), *, sections=None, y_min=None, y_max=None, main=True, scales={'eta_x': 10}, twiss_ref=None, title=None, pairs=None)

Convenience class to plot twiss parameters

Parameters
  • twiss (Twiss) – The name of the object.

  • tuple (List[Union[Tuple[float, float], str, Base]) – List of sections to plot. Can be either (min, max), “name” or object.

  • float (y_min) – Maximum y-limit

  • float – Minimum y-limit

  • bool (main) – Wheter to plot whole ring or only given sections

  • int] (scales Dict[str,) – Optional scaling factors for optical functions

  • twiss_ref (Twiss) – Reference twiss values. Will be plotted as dashed lines.

  • pairs (List[Tuple[Element, str]]) – List of (element, attribute)-pairs to create interactice sliders for.

Methods

update()
apace.plot.find_optimal_grid(n)
apace.plot.floor_plan(ax, lattice, *, start_angle=0, labels=True)
Parameters