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, verbose=False, divider=2, shift_zero=1e-06, start_method=None)[source]#
Computes the 1D acceptance at
refpts
observation 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 (Refpts | None) – 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 | None) – 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 | None) – Print out some information
divider (int | None) – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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 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
tracked
andsurvived
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 valueWhen multiple
refpts
are 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, 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:
GridMode.CARTESIAN/RADIAL
: max. amplitudeGridMode.RECURSIVE
: initial step
nturns (int | None) – Number of turns for the tracking
refpts (Refpts | None) – 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 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 | None) –
defines the evaluation grid:
GridMode.CARTESIAN
: full [\(\:x, y\:\)] gridGridMode.RADIAL
: full [\(\:r, \theta\:\)] gridGridMode.RECURSIVE
: radial recursive search
use_mp (bool | None) – Use python multiprocessing (
patpass()
, default uselattice_pass()
).verbose (bool | None) – Print out some information
divider (int | None) – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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 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_poolsize
to the desired valueWhen multiple
refpts
are 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
refpts
observation 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_mode
is forced toGridMode.RECURSIVE
(most efficient in single core)verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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 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
tracked
andsurvived
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 valueWhen multiple
refpts
are 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_mode
is forced toGridMode.RECURSIVE
(most efficient in single core)verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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 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
tracked
andsurvived
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 valueWhen multiple
refpts
are 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_mode
is forced toGridMode.RECURSIVE
(most efficient in single core)verbose – Print out some information
divider – Value of the divider used in
GridMode.RECURSIVE
boundary searchshift_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 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
tracked
andsurvived
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 valueWhen multiple
refpts
are 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.