at.plot.standalone#

AT plotting functions

Functions

plot_acceptance(ring, planes, *args, **kwargs)

Plots the acceptance

plot_geometry(ring[, start_coordinates, ...])

Compute and plot the 2D ring geometry in cartesian coordinates.

plot_sigma(sigma[, axis, scale, ax])

Plot the projection of the phase space defined by a \(\Sigma\)-matrix on the selected plane.

plot_acceptance(ring, planes, *args, **kwargs)[source]#

Plots the acceptance

Computes the acceptance at repfts observation points using get_acceptance() and plots the tracked and survived particles, and the acceptance boundary.

Parameters:
  • ring (Lattice) – Lattice definition

  • planes – max. dimension 2, Plane(s) to scan for the acceptance. Allowed values are: ‘x’, ‘xp’, ‘y’, ‘yp’, ‘dp’, ‘ct’

Keyword Arguments:
  • acceptance (tuple[ndarray, ndarray, ndarray]) – tuple containing pre-computed acceptance (boundary, survived, grid)

  • npoints – (len(planes),) array: number of points in each dimension

  • amplitudes

    (len(planes),) array: set the search range:

  • nturns (int) – Number of turns for the tracking

  • obspt (Refpts) – Observation points. Default: start of the machine

  • dp (float) – Static momentum offset

  • offset – Initial orbit. Default: closed orbit

  • bounds

    Defines the tracked range: range=bounds*amplitude. It can be used to select quadrants. For example, default values are:

  • grid_mode (GridMode) –

    Defines the evaluation grid:

  • use_mp (bool) – Use python multiprocessing (patpass(), default use lattice_pass()). In case multiprocessing is not enabled, grid_mode is forced to GridMode.RECURSIVE (most efficient in single core)

  • verbose (bool) – Print out some information

  • divider (int) – Value of the divider used in GridMode.RECURSIVE boundary search

  • shift_zero

  • start_method (str) – Python multiprocessing start method. The default None uses the python default that is considered safe. Available parameters: ‘fork’, ‘spawn’, ‘forkserver’. The default for linux is ‘fork’, the default for macOS and Windows is ‘spawn’. ‘fork’ may be used for macOS to speed up the calculation or to solve runtime errors, however it is considered unsafe.

Returns:
  • boundary – (2,n) array: 2D acceptance

  • tracked – (2,n) array: Coordinates of tracked particles

  • survived – (2,n) array: Coordinates of surviving particles

Example

>>> ring.plot_acceptance(planes, npoints, amplitudes)
>>> plt.show()
plot_geometry(ring, start_coordinates=(0, 0, 0), centered=False, ax=None, **kwargs)[source]#

Compute and plot the 2D ring geometry in cartesian coordinates.

Parameters:
  • ring (Lattice) – Lattice description

  • start_coordinates (tuple[float, float, float]) – x,y,angle at starting point

  • centered (bool) – it True the coordinates origin is the center of the ring

  • ax (Axes | None) – axes for the plot. If not given, new axes are created

Keyword arguments are forwarded to the underlying plot() function

Returns:
  • geomdata – recarray containing, x, y, angle

  • radius – machine radius

  • ax – plot axis

Example

>>> ring.plot_geometry()
plot_sigma(sigma, axis=('x', 'xp'), scale=1.0, ax=None, **kwargs)[source]#

Plot the projection of the phase space defined by a \(\Sigma\)-matrix on the selected plane.

Parameters:
  • sigma\(\Sigma\)-matrix

  • axis (tuple[str, str]) – tuple if indices defining the plane of the \(\Sigma\) projection. Allowed values are: ‘x’, ‘xp’, ‘y’, ‘yp’, ‘dp’, ‘ct’. Default: (‘x’, ‘xp’)

  • scale (float) – Scaling factor for the emittance

  • ax (Axes | None) – axes for the plot. If not given, new axes are created

Keyword arguments are forwarded to the underlying plot() function