xcoll 0.3.6__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xcoll/__init__.py +12 -4
- xcoll/beam_elements/__init__.py +7 -5
- xcoll/beam_elements/absorber.py +41 -7
- xcoll/beam_elements/base.py +1161 -244
- xcoll/beam_elements/collimators_src/black_absorber.h +118 -0
- xcoll/beam_elements/collimators_src/black_crystal.h +111 -0
- xcoll/beam_elements/collimators_src/everest_block.h +40 -28
- xcoll/beam_elements/collimators_src/everest_collimator.h +129 -50
- xcoll/beam_elements/collimators_src/everest_crystal.h +217 -73
- xcoll/beam_elements/everest.py +60 -113
- xcoll/colldb.py +250 -750
- xcoll/general.py +2 -2
- xcoll/headers/checks.h +1 -1
- xcoll/headers/particle_states.h +2 -2
- xcoll/initial_distribution.py +195 -0
- xcoll/install.py +177 -0
- xcoll/interaction_record/__init__.py +1 -0
- xcoll/interaction_record/interaction_record.py +252 -0
- xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
- xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
- xcoll/line_tools.py +83 -0
- xcoll/lossmap.py +209 -0
- xcoll/manager.py +2 -937
- xcoll/rf_sweep.py +1 -1
- xcoll/scattering_routines/everest/amorphous.h +239 -0
- xcoll/scattering_routines/everest/channeling.h +245 -0
- xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
- xcoll/scattering_routines/everest/everest.h +8 -30
- xcoll/scattering_routines/everest/everest.py +13 -10
- xcoll/scattering_routines/everest/jaw.h +27 -197
- xcoll/scattering_routines/everest/materials.py +2 -0
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
- xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
- xcoll/scattering_routines/geometry/__init__.py +6 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +219 -0
- xcoll/scattering_routines/geometry/crystal_geometry.h +150 -0
- xcoll/scattering_routines/geometry/geometry.py +26 -0
- xcoll/scattering_routines/geometry/get_s.h +92 -0
- xcoll/scattering_routines/geometry/methods.h +111 -0
- xcoll/scattering_routines/geometry/objects.h +154 -0
- xcoll/scattering_routines/geometry/rotation.h +23 -0
- xcoll/scattering_routines/geometry/segments.h +226 -0
- xcoll/scattering_routines/geometry/sort.h +184 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/METADATA +1 -1
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/RECORD +48 -33
- xcoll/beam_elements/collimators_src/absorber.h +0 -141
- xcoll/collimator_settings.py +0 -457
- xcoll/impacts/__init__.py +0 -1
- xcoll/impacts/impacts.py +0 -102
- xcoll/impacts/impacts_src/impacts.h +0 -99
- xcoll/scattering_routines/everest/crystal.h +0 -1302
- xcoll/scattering_routines/everest/scatter.h +0 -169
- xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/LICENSE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/NOTICE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/WHEEL +0 -0
xcoll/__init__.py
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
# copyright ############################### #
|
|
2
2
|
# This file is part of the Xcoll Package. #
|
|
3
|
-
# Copyright (c) CERN,
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
4
|
# ######################################### #
|
|
5
5
|
|
|
6
6
|
from .general import _pkg_root, __version__, citation
|
|
7
7
|
|
|
8
|
-
from .beam_elements import BlackAbsorber, EverestBlock, EverestCollimator, EverestCrystal, element_classes
|
|
8
|
+
from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal, element_classes
|
|
9
|
+
from .install import install_elements
|
|
10
|
+
from .line_tools import assign_optics_to_collimators, open_collimators, send_to_parking, enable_scattering, disable_scattering
|
|
9
11
|
from .scattering_routines.everest import materials, Material, CrystalMaterial
|
|
10
|
-
from .
|
|
11
|
-
from .
|
|
12
|
+
from .colldb import CollimatorDatabase
|
|
13
|
+
from .interaction_record import InteractionRecord
|
|
12
14
|
from .rf_sweep import RFSweep
|
|
15
|
+
from .initial_distribution import *
|
|
16
|
+
from .lossmap import LossMap
|
|
17
|
+
|
|
18
|
+
# Deprecated
|
|
19
|
+
from .manager import CollimatorManager
|
|
13
20
|
|
|
14
21
|
# print("If you use Xcoll in your simulations, please cite us :-)")
|
|
15
22
|
# print(citation)
|
|
23
|
+
|
xcoll/beam_elements/__init__.py
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
# Copyright (c) CERN, 2024. #
|
|
4
4
|
# ######################################### #
|
|
5
5
|
|
|
6
|
-
from .base import BaseBlock, BaseCollimator
|
|
7
|
-
from .absorber import BlackAbsorber
|
|
6
|
+
from .base import BaseBlock, BaseCollimator, BaseCrystal
|
|
7
|
+
from .absorber import BlackAbsorber, BlackCrystal
|
|
8
8
|
from .everest import EverestBlock, EverestCollimator, EverestCrystal
|
|
9
9
|
|
|
10
|
-
_all_collimator_types = {BlackAbsorber, EverestCollimator, EverestCrystal}
|
|
11
|
-
|
|
12
10
|
block_classes = tuple(v for v in globals().values()
|
|
13
11
|
if isinstance(v, type) and issubclass(v, BaseBlock) and v != BaseBlock)
|
|
12
|
+
# Includes crystals
|
|
14
13
|
collimator_classes = tuple(v for v in globals().values()
|
|
15
|
-
if isinstance(v, type) and issubclass(v, BaseCollimator)
|
|
14
|
+
if isinstance(v, type) and (issubclass(v, BaseCollimator) or issubclass(v, BaseCrystal))
|
|
15
|
+
and v != BaseCollimator and v != BaseCrystal)
|
|
16
|
+
crystal_classes = tuple(v for v in globals().values()
|
|
17
|
+
if isinstance(v, type) and issubclass(v, BaseCrystal) and v != BaseCrystal)
|
|
16
18
|
element_classes = block_classes + collimator_classes
|
xcoll/beam_elements/absorber.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# copyright ############################### #
|
|
2
2
|
# This file is part of the Xcoll Package. #
|
|
3
|
-
# Copyright (c) CERN,
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
4
|
# ######################################### #
|
|
5
5
|
|
|
6
6
|
import xtrack as xt
|
|
7
7
|
import xobjects as xo
|
|
8
|
-
from .base import BaseCollimator, InvalidXcoll
|
|
8
|
+
from .base import BaseCollimator, BaseCrystal, InvalidXcoll
|
|
9
|
+
from ..scattering_routines.geometry import XcollGeometry
|
|
9
10
|
from ..general import _pkg_root
|
|
10
11
|
|
|
11
12
|
|
|
@@ -14,16 +15,16 @@ class BlackAbsorber(BaseCollimator):
|
|
|
14
15
|
'_tracking': xo.Int8
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
_extra_c_sources = [
|
|
18
|
-
_pkg_root.joinpath('beam_elements','collimators_src','absorber.h')
|
|
19
|
-
]
|
|
20
|
-
|
|
21
18
|
isthick = True
|
|
22
19
|
allow_track = True
|
|
23
20
|
behaves_like_drift = True
|
|
24
21
|
skip_in_loss_location_refinement = True
|
|
25
22
|
|
|
26
|
-
_depends_on = [BaseCollimator,
|
|
23
|
+
_depends_on = [BaseCollimator, XcollGeometry]
|
|
24
|
+
|
|
25
|
+
_extra_c_sources = [
|
|
26
|
+
_pkg_root.joinpath('beam_elements','collimators_src','black_absorber.h')
|
|
27
|
+
]
|
|
27
28
|
|
|
28
29
|
_skip_in_to_dict = BaseCollimator._skip_in_to_dict
|
|
29
30
|
_store_in_to_dict = BaseCollimator._store_in_to_dict
|
|
@@ -33,6 +34,39 @@ class BlackAbsorber(BaseCollimator):
|
|
|
33
34
|
if '_xobject' not in kwargs:
|
|
34
35
|
kwargs.setdefault('_tracking', True)
|
|
35
36
|
super().__init__(**kwargs)
|
|
37
|
+
if not isinstance(self._context, xo.ContextCpu):
|
|
38
|
+
raise ValueError('BlackAbsorber is currently not supported on GPU.')
|
|
39
|
+
|
|
40
|
+
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
41
|
+
return InvalidXcoll(length=-self.length, _context=_context, _buffer=_buffer, _offset=_offset)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class BlackCrystal(BaseCrystal):
|
|
45
|
+
_xofields = { **BaseCrystal._xofields,
|
|
46
|
+
'_tracking': xo.Int8
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
isthick = True
|
|
50
|
+
allow_track = True
|
|
51
|
+
behaves_like_drift = True
|
|
52
|
+
skip_in_loss_location_refinement = True
|
|
53
|
+
|
|
54
|
+
_depends_on = [BaseCrystal, XcollGeometry]
|
|
55
|
+
|
|
56
|
+
_extra_c_sources = [
|
|
57
|
+
_pkg_root.joinpath('beam_elements','collimators_src','black_crystal.h')
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
_skip_in_to_dict = BaseCrystal._skip_in_to_dict
|
|
61
|
+
_store_in_to_dict = BaseCrystal._store_in_to_dict
|
|
62
|
+
_internal_record_class = BaseCrystal._internal_record_class
|
|
63
|
+
|
|
64
|
+
def __init__(self, **kwargs):
|
|
65
|
+
if '_xobject' not in kwargs:
|
|
66
|
+
kwargs.setdefault('_tracking', True)
|
|
67
|
+
super().__init__(**kwargs)
|
|
68
|
+
if not isinstance(self._context, xo.ContextCpu):
|
|
69
|
+
raise ValueError('BlackCrystal is currently not supported on GPU.')
|
|
36
70
|
|
|
37
71
|
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
38
72
|
return InvalidXcoll(length=-self.length, _context=_context, _buffer=_buffer, _offset=_offset)
|