at.plot.standalone#
AT plotting functions
Functions
|
Plot the resulting longitudinal Hamiltonian of a ring (defining the RF bucket). |
|
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_RF_bucket_hamiltonian(ring, ct_range=None, dp_range=None, num_points=400, num_levels=41, plot_separatrix=True, **kwargs)[source]#
Plot the resulting longitudinal Hamiltonian of a ring (defining the RF bucket). The Hamiltonian is calculated by summing all the cavities in the ring. Harmonic cavities are supported by the function.
A perfectly tuned lattice is assumed, the cavities’ frequency is nominal and the TimeLag is set in a way ensuring ct=0 for the synchronous phase by using
set_cavity_phase()
.- Parameters:
ring – Lattice description
ct_range (tuple) – Forced lower and upper ct values for the plot. Default to \(\pm 1.1 \times C / (2h)\)
dp_range (tuple) – Forced lower and upper dp values for the plot. Default to twice the RF acceptance of the bucket.
num_points (int) – Number of points for 1D grid (ct/dp) Default to 400.
num_levels (int) – Number of levels for contour plot. Odd number of levels allow to center the colorbar around 0. Default to 41.
plot_separatrix (bool) – Flag to plot the separatrix contour (\(\mathcal{H}=0\)).
- Returns:
CT – (num_points,num_points) array: ct grid
DP – (num_points,num_points) array: dp grid
hamiltonian – (num_points,num_points) array: Hamiltonian values
along (CT,DP)
- 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