at.acceptance.acceptance#
Acceptance computation
Functions
|
Computes the acceptance at |
|
Computes the 1D acceptance at |
|
Computes the 1D horizontal acceptance at |
|
Computes the 1D vertical acceptance at refpts observation points |
|
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, gpu_pool=None, verbose=False, divider=2, shift_zero=1e-06, start_method=None, **kwargs)[source]#
Computes the 1D acceptance at
refptsobservation pointsSee
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:
GridMode.CARTESIAN/RADIAL: max. amplitudeGridMode.RECURSIVE: initial step
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
grid_mode (GridMode | None) –
defines the evaluation grid:
GridMode.CARTESIAN: full [\(\:x, y\:\)] gridGridMode.RADIAL: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE: radial recursive search
use_mp (bool | MPMode) – Flag to activate CPU or GPU multiprocessing (default: False). In case multiprocessing is not enabled,
grid_modeis forced toGridMode.RECURSIVE(most efficient in single core)gpu_pool (list[int] | None) – List of GPU id to use when use_mp is
at.tracking.MPMode.GPU. If None specified, if gets first GPU.verbose (bool | None) – Print out some information
divider (int | None) – Value of the divider used in
GridMode.RECURSIVEboundary searchshift_zero (float | None) – Epsilon offset applied on all 6 coordinates
start_method (str | None) – Python multiprocessing start method. The default
Noneuses 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 on macOS to speed up the calculation or to solve runtime errors, however it is considered unsafe.
- Returns:
boundary – (len(refpts),2) array: 1D acceptance
survived – (n,) array: Coordinates of surviving particles
tracked – (n,) array: Coordinates of tracked particles
In case of multiple
trackedandsurvivedare 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_poolsizeto the desired valueWhen multiple
refptsare provided particles are first projected to the beginning of the ring with tracking. Then, all particles are tracked up tonturns. This allows to do most of the work in a single function call and allows for full parallelization.
- get_acceptance(ring, planes, npoints, amplitudes, nturns=1024, refpts=None, dp=None, offset=None, bounds=None, grid_mode=GridMode.RADIAL, use_mp=False, gpu_pool=None, verbose=False, divider=2, shift_zero=1e-06, start_method=None, **kwargs)[source]#
Computes the acceptance at
repftsobservation 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:
GridMode.CARTESIAN/RADIAL: max. amplitudeGridMode.RECURSIVE: initial step
nturns (int) – 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
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 | MPMode) – Flag to activate CPU or GPU multiprocessing (default: False)
gpu_pool (list[int] | None) – List of GPU id to use when use_mp is
at.tracking.MPMode.GPU. If None specified, if gets first GPU.verbose (bool) – Print out some information
divider (int) – Value of the divider used in
GridMode.RECURSIVEboundary searchshift_zero (float) – Epsilon offset applied on all 6 coordinates
start_method (str | None) – Python multiprocessing start method. The default
Noneuses 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 on 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_poolsizeto the desired valueWhen multiple
refptsare provided particles are first projected to the beginning of the ring with tracking. Then, all particles are tracked up tonturns. This allows to do most of the work in a single function call and allows for full parallelization.
- get_horizontal_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#
Computes the 1D horizontal acceptance at
refptsobservation pointsSee
get_acceptance()- Parameters:
ring (Lattice) – Lattice definition
resolution (float) – Minimum distance between 2 grid points
amplitude (float) –
Search range:
GridMode.CARTESIAN/RADIAL: max. amplitudeGridMode.RECURSIVE: initial step
- 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:
GridMode.CARTESIAN: full [\(\:x, y\:\)] gridGridMode.RADIAL: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE: radial recursive search
use_mp – Use python multiprocessing (
patpass(), default uselattice_pass()). In case multiprocessing is not enabled,grid_modeis forced toGridMode.RECURSIVE(most efficient in single core)gpu_pool – List of GPU id to use when use_mp is
at.tracking.MPMode.GPU. If None specified, if gets first GPU.verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVEboundary searchshift_zero – Epsilon offset applied on all 6 coordinates
start_method – Python multiprocessing start method. The default
Noneuses 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 on macOS to speed up the calculation or to solve runtime errors, however it is considered unsafe.
- Returns:
boundary – (len(refpts),2) array: 1D acceptance
survived – (n,) array: Coordinates of surviving particles
tracked – (n,) array: Coordinates of tracked particles
In case of multiple
trackedandsurvivedare 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_poolsizeto the desired valueWhen multiple
refptsare provided particles are first projected to the beginning of the ring with tracking. Then, all particles are tracked up tonturns. This allows to do most of the work in a single function call and allows for full parallelization.
- get_momentum_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#
Computes the 1D momentum acceptance at refpts observation points
See
get_acceptance()- Parameters:
ring (Lattice) – Lattice definition
resolution (float) – Minimum distance between 2 grid points
amplitude (float) –
Search range:
GridMode.CARTESIAN/RADIAL: max. amplitudeGridMode.RECURSIVE: initial step
- 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:
GridMode.CARTESIAN: full [\(\:x, y\:\)] gridGridMode.RADIAL: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE: radial recursive search
use_mp – Use python multiprocessing (
patpass(), default uselattice_pass()). In case multiprocessing is not enabled,grid_modeis forced toGridMode.RECURSIVE(most efficient in single core)gpu_pool – List of GPU id to use when use_mp is
at.tracking.MPMode.GPU. If None specified, if gets first GPU.verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVEboundary searchshift_zero – Epsilon offset applied on all 6 coordinates
start_method – Python multiprocessing start method. The default
Noneuses 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 on macOS to speed up the calculation or to solve runtime errors, however it is considered unsafe.
- Returns:
boundary – (len(refpts),2) array: 1D acceptance
survived – (n,) array: Coordinates of surviving particles
tracked – (n,) array: Coordinates of tracked particles
In case of multiple
trackedandsurvivedare 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_poolsizeto the desired valueWhen multiple
refptsare provided particles are first projected to the beginning of the ring with tracking. Then, all particles are tracked up tonturns. This allows to do most of the work in a single function call and allows for full parallelization.
- get_vertical_acceptance(ring, resolution, amplitude, *args, **kwargs)[source]#
Computes the 1D vertical acceptance at refpts observation points
See
get_acceptance()- Parameters:
ring (Lattice) – Lattice definition
resolution (float) – Minimum distance between 2 grid points
amplitude (float) –
Search range:
GridMode.CARTESIAN/RADIAL: max. amplitudeGridMode.RECURSIVE: initial step
- 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:
GridMode.CARTESIAN: full [\(\:x, y\:\)] gridGridMode.RADIAL: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE: radial recursive search
use_mp – Use python multiprocessing (
patpass(), default uselattice_pass()). In case multiprocessing is not enabled,grid_modeis forced toGridMode.RECURSIVE(most efficient in single core)gpu_pool – List of GPU id to use when use_mp is
at.tracking.MPMode.GPU. If None specified, if gets first GPU.verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVEboundary searchshift_zero – Epsilon offset applied on all 6 coordinates
start_method – Python multiprocessing start method. The default
Noneuses 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 on macOS to speed up the calculation or to solve runtime errors, however it is considered unsafe.
- Returns:
boundary – (len(refpts),2) array: 1D acceptance
survived – (n,) array: Coordinates of surviving particles
tracked – (n,) array: Coordinates of tracked particles
In case of multiple
trackedandsurvivedare 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_poolsizeto the desired valueWhen multiple
refptsare provided particles are first projected to the beginning of the ring with tracking. Then, all particles are tracked up tonturns. This allows to do most of the work in a single function call and allows for full parallelization.