at.acceptance.acceptance#

Acceptance computation

Functions

get_acceptance(ring, planes, npoints, amplitudes)

Computes the acceptance at repfts observation points

get_1d_acceptance(ring, plane, resolution, ...)

Computes the 1D acceptance at refpts observation points

get_horizontal_acceptance(ring, resolution, ...)

Computes the 1D horizontal acceptance at refpts observation points

get_vertical_acceptance(ring, resolution, ...)

Computes the 1D vertical acceptance at refpts observation points

get_momentum_acceptance(ring, resolution, ...)

Computes the 1D momentum acceptance at refpts observation points

get_1d_acceptance(ring, plane, resolution, amplitude, nturns=1024, refpts=None, dp=None, offset=None, grid_mode=GridMode.RADIAL, use_mp=False, verbose=False, divider=2, shift_zero=1e-06, start_method=None)[source]#

Computes the 1D acceptance at refpts observation points

See get_acceptance()

Parameters:
  • ring (Lattice) – Lattice definition

  • plane (str) – Plane to scan for the acceptance. Allowed values are: 'x', 'xp', 'y', 'yp', 'dp', 'ct'

  • resolution (float) – Minimum distance between 2 grid points

  • amplitude (float) –

    Search range:

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

  • refpts (Type[Element] | Element | Callable[[Element], bool] | str | None | int | Sequence[int] | bool | Sequence[bool] | RefptsCode) – Observation points. Default: start of the machine

  • dp (float | None) – static momentum offset

  • offset (Sequence[float] | None) – initial orbit. Default: closed orbit

  • grid_mode (GridMode | None) –

    defines the evaluation grid:

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

  • verbose (bool | None) – Print out some information

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

  • shift_zero (float | None) – Epsilon offset applied on all 6 coordinates

  • start_method (str | None) – 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 used for MacOS to speed-up the calculation or to solve runtime errors, however it is considered unsafe.

Returns:
  • boundary – (len(refpts),2) array: 1D acceptance

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

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

In case of multiple tracked and survived are lists of arrays, with one array per ref. point.

Note

  • When``use_mp=True`` all the available CPUs will be used. This behavior can be changed by setting at.DConstant.patpass_poolsize to the desired value

get_acceptance(ring, planes, npoints, amplitudes, nturns=1024, refpts=None, dp=None, offset=None, bounds=None, grid_mode=GridMode.RADIAL, use_mp=False, verbose=True, divider=2, shift_zero=1e-06, start_method=None)[source]#

Computes the acceptance at repfts observation points

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'

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

  • amplitudes

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

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

  • refpts (Type[Element] | Element | Callable[[Element], bool] | str | None | int | Sequence[int] | bool | Sequence[bool] | RefptsCode) – Observation points. Default: start of the machine

  • dp (float | None) – static momentum offset

  • offset (Sequence[float]) – initial orbit. Default: closed orbit

  • bounds

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

  • grid_mode (GridMode | None) –

    defines the evaluation grid:

  • use_mp (bool | None) – Use python multiprocessing (patpass(), default use lattice_pass()).

  • verbose (bool | None) – Print out some information

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

  • shift_zero (float | None) – Epsilon offset applied on all 6 coordinates

  • start_method (str | None) – 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 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

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

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

In case of multiple refpts, return values are lists of arrays, with one array per ref. point.

Examples

>>> bf,sf,gf = ring.get_acceptance(planes, npoints, amplitudes)
>>> plt.plot(*gf,'.')
>>> plt.plot(*sf,'.')
>>> plt.plot(*bf)
>>> plt.show()

Note

  • When``use_mp=True`` all the available CPUs will be used. This behavior can be changed by setting at.DConstant.patpass_poolsize to the desired value

get_horizontal_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#

Computes the 1D horizontal acceptance at refpts observation points

See get_acceptance()

Parameters:
Keyword Arguments:
  • nturns – Number of turns for the tracking

  • refpts – Observation points. Default: start of the machine

  • dp – static momentum offset

  • offset – initial orbit. Default: closed orbit

  • grid_mode

    defines the evaluation grid:

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

  • verbose – Print out some information

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

  • shift_zero – Epsilon offset applied on all 6 coordinates

  • start_method – 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 used for MacOS to speed-up the calculation or to solve runtime errors, however it is considered unsafe.

Returns:
  • boundary – (len(refpts),2) array: 1D acceptance

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

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

In case of multiple tracked and survived are lists of arrays, with one array per ref. point.

Note

  • When``use_mp=True`` all the available CPUs will be used. This behavior can be changed by setting at.DConstant.patpass_poolsize to the desired value

get_momentum_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#

Computes the 1D momentum acceptance at refpts observation points

See get_acceptance()

Parameters:
Keyword Arguments:
  • nturns – Number of turns for the tracking

  • refpts – Observation points. Default: start of the machine

  • dp – static momentum offset

  • offset – initial orbit. Default: closed orbit

  • grid_mode

    defines the evaluation grid:

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

  • verbose – Print out some information

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

  • shift_zero – Epsilon offset applied on all 6 coordinates

  • start_method – 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 used for MacOS to speed-up the calculation or to solve runtime errors, however it is considered unsafe.

Returns:
  • boundary – (len(refpts),2) array: 1D acceptance

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

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

In case of multiple tracked and survived are lists of arrays, with one array per ref. point.

Note

  • When``use_mp=True`` all the available CPUs will be used. This behavior can be changed by setting at.DConstant.patpass_poolsize to the desired value

get_vertical_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#

Computes the 1D vertical acceptance at refpts observation points

See get_acceptance()

Parameters:
Keyword Arguments:
  • nturns – Number of turns for the tracking

  • refpts – Observation points. Default: start of the machine

  • dp – static momentum offset

  • offset – initial orbit. Default: closed orbit

  • grid_mode

    defines the evaluation grid:

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

  • verbose – Print out some information

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

  • shift_zero – Epsilon offset applied on all 6 coordinates

  • start_method – 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 used for MacOS to speed-up the calculation or to solve runtime errors, however it is considered unsafe.

Returns:
  • boundary – (len(refpts),2) array: 1D acceptance

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

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

In case of multiple tracked and survived are lists of arrays, with one array per ref. point.

Note

  • When``use_mp=True`` all the available CPUs will be used. This behavior can be changed by setting at.DConstant.patpass_poolsize to the desired value