at.plot.standalone#
AT plotting functions
Functions
|
Plots the acceptance |
|
Compute and plot the 2D ring geometry in cartesian coordinates. |
|
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:
GridMode.CARTESIAN/RADIAL
: max. amplitudeGridMode.RECURSIVE
: initial step
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:
GridMode.CARTESIAN
: ((-1, 1), (0, 1))GridMode.RADIAL/RECURSIVE
: ((0, 1), (\(\pi\), 0))
grid_mode (GridMode) –
Defines the evaluation grid:
GridMode.CARTESIAN
: full [\(\:x, y\:\)] gridGridMode.RADIAL
: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE
: radial recursive search
use_mp (bool) – Use python multiprocessing (
patpass()
, default uselattice_pass()
). In case multiprocessing is not enabled, grid_mode is forced toGridMode.RECURSIVE
(most efficient in single core)verbose (bool) – Print out some information
divider (int) – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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:
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