xcoll 0.6.1__tar.gz → 0.6.3__tar.gz

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.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

Files changed (141) hide show
  1. {xcoll-0.6.1 → xcoll-0.6.3}/PKG-INFO +18 -13
  2. xcoll-0.6.3/pyproject.toml +63 -0
  3. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/__init__.py +1 -1
  4. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/general.py +1 -1
  5. xcoll-0.6.3/xcoll/prebuild_kernels/__init__.py +7 -0
  6. xcoll-0.6.3/xcoll/prebuild_kernels/element_inits.py +6 -0
  7. xcoll-0.6.3/xcoll/prebuild_kernels/elements.py +20 -0
  8. xcoll-0.6.3/xcoll/rf_sweep.py +182 -0
  9. xcoll-0.6.1/pyproject.toml +0 -52
  10. xcoll-0.6.1/xcoll/__init__.py.orig +0 -26
  11. xcoll-0.6.1/xcoll/general.py.orig +0 -20
  12. xcoll-0.6.1/xcoll/initial_distribution.py.orig +0 -256
  13. xcoll-0.6.1/xcoll/rf_sweep.py +0 -197
  14. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/.git +0 -1
  15. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/.gitignore +0 -2
  16. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/CMakeLists.txt +0 -18
  17. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/ComponentMakefile +0 -192
  18. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/Makefile +0 -144
  19. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/README +0 -26
  20. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/Doxyfile +0 -1551
  21. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.asciidoc +0 -1054
  22. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.epub +0 -0
  23. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.html +0 -1607
  24. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.pdf +0 -0
  25. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__1.png +0 -0
  26. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__2.png +0 -0
  27. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__3.png +0 -0
  28. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__4.png +0 -0
  29. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__5.png +0 -0
  30. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__6.png +0 -0
  31. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__7.png +0 -0
  32. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/Makefile +0 -8
  33. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/docbook.xsl +0 -1690
  34. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/Connection.h +0 -79
  35. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FlukaIO.h +0 -58
  36. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FlukaIOServer.h +0 -33
  37. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FortranFlukaIO.h +0 -277
  38. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/Message.h +0 -89
  39. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/ParticleInfo.h +0 -76
  40. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  41. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  42. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/ClientTest.c +0 -156
  43. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/ServerTest.c +0 -123
  44. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/fclient.f +0 -149
  45. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/fserver.f +0 -118
  46. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.c +0 -264
  47. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.d +0 -69
  48. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  49. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.c +0 -211
  50. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +0 -46
  51. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  52. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.c +0 -45
  53. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +0 -29
  54. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.h +0 -17
  55. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  56. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.c +0 -84
  57. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +0 -70
  58. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  59. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer_private.h +0 -22
  60. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO_private.h +0 -16
  61. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.c +0 -533
  62. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +0 -40
  63. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  64. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.c +0 -304
  65. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +0 -66
  66. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.h +0 -30
  67. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  68. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/tags +0 -167
  69. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/AllTests.cpp +0 -8
  70. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/CommonTest.h +0 -10
  71. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/ConnectionTest.cpp +0 -99
  72. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOServerTest.cpp +0 -104
  73. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOTest.cpp +0 -439
  74. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FortranFlukaIOTest.cpp +0 -682
  75. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.c +0 -19
  76. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.h +0 -16
  77. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.c +0 -74
  78. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.h +0 -50
  79. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.c +0 -16
  80. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.h +0 -20
  81. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.c +0 -12
  82. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h +0 -18
  83. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h +0 -19
  84. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c +0 -80
  85. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h +0 -35
  86. {xcoll-0.6.1 → xcoll-0.6.3}/LICENSE +0 -0
  87. {xcoll-0.6.1 → xcoll-0.6.3}/NOTICE +0 -0
  88. {xcoll-0.6.1 → xcoll-0.6.3}/README.md +0 -0
  89. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/__init__.py +0 -0
  90. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/absorber.py +0 -0
  91. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/base.py +0 -0
  92. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/blowup.py +0 -0
  93. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/black_absorber.h +0 -0
  94. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/black_crystal.h +0 -0
  95. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/blowup.h +0 -0
  96. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/emittance_monitor.h +0 -0
  97. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/everest_block.h +0 -0
  98. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/everest_collimator.h +0 -0
  99. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/everest_crystal.h +0 -0
  100. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/transparent_collimator.h +0 -0
  101. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/elements_src/transparent_crystal.h +0 -0
  102. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/everest.py +0 -0
  103. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/monitor.py +0 -0
  104. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/beam_elements/transparent.py +0 -0
  105. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/colldb.py +0 -0
  106. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/headers/checks.h +0 -0
  107. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/headers/particle_states.py +0 -0
  108. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/initial_distribution.py +0 -0
  109. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/interaction_record/__init__.py +0 -0
  110. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/interaction_record/interaction_record.py +0 -0
  111. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/interaction_record/interaction_record_src/interaction_record.h +0 -0
  112. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/interaction_record/interaction_types.py +0 -0
  113. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/line_tools.py +0 -0
  114. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/lossmap.py +0 -0
  115. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/plot.py +0 -0
  116. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/engine.py +0 -0
  117. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/environment.py +0 -0
  118. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/__init__.py +0 -0
  119. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/amorphous.h +0 -0
  120. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/channelling.h +0 -0
  121. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/constants.h +0 -0
  122. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/crystal_parameters.h +0 -0
  123. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/everest.h +0 -0
  124. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/everest.py +0 -0
  125. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/ionisation_loss.h +0 -0
  126. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/jaw.h +0 -0
  127. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/materials.py +0 -0
  128. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +0 -0
  129. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/nuclear_interaction.h +0 -0
  130. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/everest/properties.h +0 -0
  131. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/__init__.py +0 -0
  132. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/collimator_geometry.h +0 -0
  133. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/crystal_geometry.h +0 -0
  134. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/geometry.py +0 -0
  135. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/get_s.h +0 -0
  136. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/methods.h +0 -0
  137. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/objects.h +0 -0
  138. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/rotation.h +0 -0
  139. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/segments.h +0 -0
  140. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/scattering_routines/geometry/sort.h +0 -0
  141. {xcoll-0.6.1 → xcoll-0.6.3}/xcoll/xaux.py +0 -0
@@ -1,28 +1,33 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: xcoll
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Xsuite collimation package
5
- Home-page: https://github.com/xsuite/xcoll
6
- License: Apache 2.0
5
+ License: Apache-2.0
7
6
  Author: Frederik F. Van der Veken
8
7
  Author-email: frederik@cern.ch
9
- Requires-Python: >=3.8
10
- Classifier: License :: Other/Proprietary License
8
+ Requires-Python: >=3.10
9
+ Classifier: License :: OSI Approved :: Apache Software License
11
10
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
11
  Classifier: Programming Language :: Python :: 3.10
15
12
  Classifier: Programming Language :: Python :: 3.11
16
13
  Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
17
15
  Provides-Extra: tests
18
16
  Requires-Dist: numpy (>=1.0)
19
17
  Requires-Dist: pandas (>=1.4)
20
- Requires-Dist: ruamel-yaml (>=0.17.31,<0.18.0) ; extra == "tests"
21
- Requires-Dist: xdeps (>=0.10.5)
22
- Requires-Dist: xobjects (>=0.5.0)
23
- Requires-Dist: xpart (>=0.23.0)
24
- Requires-Dist: xtrack (>=0.84.6)
18
+ Requires-Dist: pytest ; extra == "tests"
19
+ Requires-Dist: pytest-html ; extra == "tests"
20
+ Requires-Dist: pytest-xdist ; extra == "tests"
21
+ Requires-Dist: ruamel-yaml (>=0.17.31,<0.18.15)
22
+ Requires-Dist: xdeps (>=0.10.6)
23
+ Requires-Dist: xobjects (>=0.5.2)
24
+ Requires-Dist: xpart (>=0.23.1)
25
+ Requires-Dist: xtrack (>=0.89.3)
26
+ Project-URL: Bug Tracker, https://github.com/xsuite/xsuite/issues
27
+ Project-URL: Documentation, https://xsuite.readthedocs.io/
28
+ Project-URL: Homepage, https://github.com/xsuite/xcoll
25
29
  Project-URL: Repository, https://github.com/xsuite/xcoll
30
+ Project-URL: download, https://pypi.python.org/pypi/xcoll
26
31
  Description-Content-Type: text/markdown
27
32
 
28
33
  # xcoll
@@ -0,0 +1,63 @@
1
+ [project]
2
+ name = "xcoll"
3
+ version = "0.6.3"
4
+ description = "Xsuite collimation package"
5
+ authors = [
6
+ {name="Frederik F. Van der Veken", email="frederik@cern.ch"},
7
+ {name="Simone O. Solstrand", email="simone.otelie.solstrand@cern.ch"},
8
+ {name="Björn Lindstrom", email="bjorn.lindstrom@cern.ch"},
9
+ {name="Giacomo Broggi", email="giacomo.broggi@cern.ch"},
10
+ {name="André Donadon Servelle", email="andre.donadon.servelle@cern.ch"},
11
+ {name="Dora E. Veres", email="dora.erzsebet.veres@cern.ch"},
12
+ {name="Despina Demetriadou", email="despina.demetriadou@cern.ch"},
13
+ {name="Andrey Abramov", email="andrey.abramov@cern.ch"},
14
+ {name="Giovanni Iadarola", email="giovanni.iadarola@cern.ch"}
15
+ ]
16
+ readme = "README.md"
17
+ license = {text="Apache-2.0"}
18
+
19
+ requires-python = ">=3.10"
20
+
21
+ dependencies = [
22
+ "ruamel-yaml (>=0.17.31,<0.18.15)",
23
+ "numpy>=1.0",
24
+ "pandas>=1.4",
25
+ "xobjects>=0.5.2",
26
+ "xdeps>=0.10.6",
27
+ "xpart>=0.23.1",
28
+ "xtrack>=0.89.3",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ tests = ["pytest", "pytest-html", "pytest-xdist"]
33
+
34
+ [project.urls]
35
+ homepage = "https://github.com/xsuite/xcoll"
36
+ repository = "https://github.com/xsuite/xcoll"
37
+ documentation = "https://xsuite.readthedocs.io/"
38
+ "Bug Tracker" = "https://github.com/xsuite/xsuite/issues"
39
+ download = "https://pypi.python.org/pypi/xcoll"
40
+
41
+ [project.entry-points.xobjects]
42
+ include = "xcoll"
43
+
44
+ [tool.poetry]
45
+ exclude = ["xcoll/lib", "xcoll/config"]
46
+
47
+ [poetry.group.dev.dependencies]
48
+ pytest = ">=7.3"
49
+ xaux = ">=0.3.5"
50
+
51
+ [build-system]
52
+ # Needed for pip install -e (BTW: need pip version 22)
53
+ requires = ["poetry-core>=1.0.8"]
54
+ build-backend = "poetry.core.masonry.api"
55
+
56
+ # pyproject.toml
57
+ #[tool.pytest.ini_options]
58
+ #addopts = "-ra --durations=10 --durations-min=1"
59
+ #python_functions = ["test_"]
60
+ #testpaths = [
61
+ # "tests",
62
+ #]
63
+
@@ -11,7 +11,7 @@ from .beam_elements import BlackAbsorber, BlackCrystal, TransparentCollimator, T
11
11
  from .scattering_routines.everest import materials, Material, CrystalMaterial
12
12
  from .colldb import CollimatorDatabase
13
13
  from .interaction_record import InteractionRecord
14
- from .rf_sweep import RFSweep
14
+ from .rf_sweep import RFSweep, prepare_rf_sweep
15
15
  from .lossmap import LossMap, MultiLossMap
16
16
 
17
17
 
@@ -12,5 +12,5 @@ citation = "F.F. Van der Veken, et al.: Recent Developments with the New Tools f
12
12
  # ======================
13
13
  # Do not change
14
14
  # ======================
15
- __version__ = '0.6.1'
15
+ __version__ = '0.6.3'
16
16
  # ======================
@@ -0,0 +1,7 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xcoll package. #
3
+ # Copyright (c) CERN, 2025. #
4
+ # ######################################### #
5
+
6
+ from .elements import DEFAULT_XCOLL_ELEMENTS
7
+ from .element_inits import XCOLL_ELEMENTS_INIT_DEFAULTS
@@ -0,0 +1,6 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xcoll package. #
3
+ # Copyright (c) CERN, 2025. #
4
+ # ######################################### #
5
+
6
+ XCOLL_ELEMENTS_INIT_DEFAULTS = {}
@@ -0,0 +1,20 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xcoll package. #
3
+ # Copyright (c) CERN, 2025. #
4
+ # ######################################### #
5
+
6
+ from ..beam_elements import *
7
+
8
+
9
+ DEFAULT_XCOLL_ELEMENTS = [
10
+ BlackAbsorber,
11
+ BlackCrystal,
12
+ TransparentCollimator,
13
+ TransparentCrystal,
14
+ EverestBlock,
15
+ EverestCollimator,
16
+ EverestCrystal,
17
+ BlowUp,
18
+ # ParticleStatsMonitor,
19
+ EmittanceMonitor
20
+ ]
@@ -0,0 +1,182 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xcoll package. #
3
+ # Copyright (c) CERN, 2025. #
4
+ # ######################################### #
5
+
6
+ import numpy as np
7
+ import scipy.constants as sc
8
+
9
+ import xtrack as xt
10
+
11
+
12
+ def prepare_rf_sweep(line, cavities=None, sweep=None, sweep_per_turn=None, num_turns=None):
13
+ rf_sweep = RFSweep(line=line, cavities=cavities)
14
+ rf_sweep.prepare(sweep=sweep, sweep_per_turn=sweep_per_turn, num_turns=num_turns)
15
+
16
+
17
+ class RFSweep:
18
+ def __init__(self, line, cavities=None):
19
+ self.line = line
20
+ if line._var_management is None:
21
+ raise ValueError("Line must have a `var_management` to use RFSweep!" \
22
+ + "Do not use `optimize_for_tracking` as it will "
23
+ + "disable expressions, which are needed for RFSweep.")
24
+ self.env = line.env
25
+ self.cavities = cavities
26
+ self.env['rf_sweep_df'] = 0
27
+
28
+ @property
29
+ def current_sweep_value(self):
30
+ return self.env['rf_sweep_df']
31
+
32
+ def prepare(self, sweep=None, sweep_per_turn=None, num_turns=None):
33
+ if sweep_per_turn is not None:
34
+ if np.isclose(sweep_per_turn, 0):
35
+ raise ValueError("Variable `sweep_per_turn` must be non-zero!")
36
+ if sweep is not None:
37
+ raise ValueError("Provide either `sweep` or `sweep_per_turn`, not both.")
38
+ if num_turns is not None:
39
+ raise ValueError("Variable `num_turns` cannot be set when using `sweep_per_turn`.")
40
+ self.sweep_per_turn = sweep_per_turn
41
+ elif sweep is not None:
42
+ if np.isclose(sweep, 0):
43
+ raise ValueError("Variable `sweep` must be non-zero!")
44
+ if num_turns is None:
45
+ num_turns = int(abs(sweep))
46
+ if num_turns <= 0:
47
+ raise ValueError("When using `sweep`, `num_turns` must be a positive integer.")
48
+ self.sweep_per_turn = sweep / num_turns
49
+ else:
50
+ raise ValueError("Either `sweep` or `sweep_per_turn` must be provided.")
51
+ self._get_cavity_data(self.sweep_per_turn)
52
+ self._install_zeta_shift()
53
+ self.tw = self.line.twiss()
54
+ self.reset() # Initialize rf_sweep_df
55
+ self.env['rf_sweep'].dzeta = f"{self.L} * rf_sweep_df / ({self.f_RF} + rf_sweep_df)"
56
+ for cavs in self.cavities:
57
+ for cav in cavs['names']:
58
+ scale_factor = int(np.round(cavs['freq'] / self.f_RF))
59
+ if scale_factor == 1:
60
+ self.env.ref[cav].frequency += self.env.ref["rf_sweep_df"]
61
+ else:
62
+ self.env.ref[cav].frequency += scale_factor * self.env.ref["rf_sweep_df"]
63
+ self.line.enable_time_dependent_vars = True
64
+ print("Enabled time-dependent variables in the line.")
65
+
66
+
67
+ def reset(self):
68
+ if self.sweep_per_turn is None:
69
+ raise ValueError("RFSweep not prepared. Call `prepare` first.")
70
+ t_turn = self.tw.T_rev0
71
+ current_time = self.env['t_turn_s']
72
+ if current_time == 0:
73
+ self.env['rf_sweep_df'] = f"(t_turn_s + {t_turn}) / {t_turn} * {self.sweep_per_turn}"
74
+ else:
75
+ self.env['rf_sweep_df'] = f"(t_turn_s - {current_time} + {t_turn}) / {t_turn} * {self.sweep_per_turn}"
76
+
77
+
78
+ def info(self, sweep=None, num_turns=None):
79
+ if sweep is not None:
80
+ raise DeprecationWarning("The `sweep` argument is deprecated.")
81
+ if num_turns is not None:
82
+ raise DeprecationWarning("The `num_turns` argument is deprecated.")
83
+ if self.sweep_per_turn is None:
84
+ raise ValueError("RFSweep not prepared. Call `prepare` first.")
85
+ existing_sweep = self.current_sweep_value
86
+
87
+ beta0 = self.line.particle_ref.beta0[0]
88
+ E = self.line.particle_ref.energy0[0]
89
+ q = self.line.particle_ref.q0
90
+ h = self.f_RF * self.L / beta0 / sc.c
91
+ eta = self.tw.slip_factor
92
+
93
+ bucket_height = np.sqrt(abs(q*self.V*beta0**2 / (np.pi*h*eta*E) * (
94
+ 2*np.cos(self.phi) + (2*self.phi-np.pi)*np.sin(self.phi)
95
+ )))
96
+ delta_shift = -self.sweep_per_turn / self.f_RF / eta
97
+ bucket_turns = bucket_height * 2 / abs(delta_shift)
98
+ print(f"The current frequency is {self.f_RF + existing_sweep}Hz, adding "
99
+ + f"{self.sweep_per_turn}Hz per turn.")
100
+ print(f"This sweep will move the center of the bucket with \u0394\u03B4 = "
101
+ + f"{delta_shift} per turn.")
102
+ print(f"This implies one bucket shift every {bucket_turns} turns.")
103
+ if self.tw.qs * bucket_turns < 3:
104
+ print(f"Warning: This is a very fast sweep, moving ~1 bucket in "
105
+ + f"~{round(self.tw.qs * bucket_turns, 2)} synchrotron oscillations "
106
+ + f"(on average). If the bucket moves faster than a particle "
107
+ + f"can follow, that particle will move out of the bucket and "
108
+ + f"remain uncaptured.")
109
+
110
+
111
+ # For backward compatibility
112
+ def track(self, sweep=0, particles=None, num_turns=0, verbose=True, *args, **kwargs):
113
+ self.prepare(sweep, num_turns)
114
+ self.line.track(particles=particles, *args, **kwargs)
115
+
116
+
117
+ def _get_cavity_data(self, sweep):
118
+ tt = self.line.get_table()
119
+ tt_c = tt.rows[[nn for nn, ttt in zip(tt.name, tt.element_type)
120
+ if 'Cavity' in ttt and 'CrabCavity' not in ttt]]
121
+ mask = tt_c.parent_name == None # Unsliced cavities
122
+ if self.cavities is None:
123
+ self.cavities = np.unique(list(tt_c.name[mask]) + list(tt_c.parent_name[~mask]))
124
+ else:
125
+ if isinstance(self.cavities, str):
126
+ self.cavities = [self.cavities]
127
+ for cav in self.cavities:
128
+ if cav not in self.env.elements:
129
+ raise ValueError(f"Cavity `{cav}` not found in environment!")
130
+ if len(self.cavities) == 0:
131
+ raise ValueError("No cavities found in the line!")
132
+ freq = np.array([self.env[cav].frequency for cav in self.cavities])
133
+ volt = np.array([self.env[cav].voltage for cav in self.cavities])
134
+ lag = np.array([self.env[cav].lag for cav in self.cavities])
135
+ s_pos = []
136
+ name_first_in_line = []
137
+ for cav in self.cavities:
138
+ if cav in tt_c.name:
139
+ s_pos.append(tt_c.rows[cav].s_start[0])
140
+ name_first_in_line.append(cav)
141
+ elif cav in tt_c.parent_name:
142
+ s_pos.append(tt_c.rows[tt_c.parent_name == cav].s_start.min())
143
+ name_first_in_line.append(tt_c.rows[tt_c.parent_name == cav].name[0])
144
+ else:
145
+ raise ValueError(f"Cavity `{cav}` not found in the line!")
146
+ idx = np.argsort(freq)
147
+ boundaries = np.where(~np.isclose(freq[idx][1:], freq[idx][:-1],
148
+ rtol=1e-8, atol=1e-12)
149
+ )[0] + 1
150
+ groups = []
151
+ for gidx in np.split(idx, boundaries):
152
+ groups.append({
153
+ 'names': self.cavities[gidx],
154
+ 'freq': np.mean(freq[gidx]),
155
+ 'voltage': volt[gidx].sum(),
156
+ 's_pos': np.array(s_pos)[gidx],
157
+ 'lag': lag[gidx],
158
+ 'name_first_in_line': np.array(name_first_in_line)[gidx],
159
+ })
160
+ self.cavities = sorted(groups, key=lambda g: (g['voltage'], g['freq']), reverse=True)
161
+ if np.isclose(self.cavities[0]['voltage'], 0):
162
+ raise ValueError("No active cavity found!")
163
+ self.f_RF = self.cavities[0]['freq']
164
+ self.phi = np.deg2rad(self.cavities[0]['lag'].mean())
165
+ self.V = self.cavities[0]['voltage']
166
+ self.L = self.line.get_length()
167
+ if len(self.cavities) > 1:
168
+ print("Found multiple cavities with different frequencies:")
169
+ for g in self.cavities:
170
+ print(f"{g['freq']}Hz at {g['voltage']}V: {g['names']}")
171
+ print(r"The sweep ($\Delta f$ = " + f"{sweep}Hz per turn) will be "
172
+ + f"performed with respect to the highest voltage cavity at "
173
+ + f"{self.f_RF}Hz. The other cavities will be shifted "
174
+ + f"accordingly.")
175
+
176
+
177
+ def _install_zeta_shift(self):
178
+ if 'rf_sweep' not in self.env.elements:
179
+ idx = np.argsort(self.cavities[0]['s_pos'])
180
+ first_cavity = self.cavities[0]['name_first_in_line'][idx[0]]
181
+ self.env.elements['rf_sweep'] = xt.ZetaShift(dzeta=0)
182
+ self.line.insert('rf_sweep', at=f'{first_cavity}@start')
@@ -1,52 +0,0 @@
1
- [tool.poetry]
2
- name = "xcoll"
3
- version = "0.6.1"
4
- description = "Xsuite collimation package"
5
- homepage = "https://github.com/xsuite/xcoll"
6
- repository = "https://github.com/xsuite/xcoll"
7
- authors = [
8
- "Frederik F. Van der Veken <frederik@cern.ch>",
9
- "Simone O. Solstrand <simone.otelie.solstrand@cern.ch>",
10
- "Björn Lindstrom <bjorn.lindstrom@cern.ch>",
11
- "Giacomo Broggi <giacomo.broggi@cern.ch>",
12
- "André Donadon Servelle <andre.donadon.servelle@cern.ch>",
13
- "Dora E. Veres <dora.erzsebet.veres@cern.ch>",
14
- "Despina Demetriadou <despina.demetriadou@cern.ch>",
15
- "Andrey Abramov <andrey.abramov@cern.ch>",
16
- "Giovanni Iadarola <giovanni.iadarola@cern.ch>"
17
- ]
18
- readme = "README.md"
19
- license = "Apache 2.0"
20
- include = ["LICENSE", "NOTICE"]
21
-
22
-
23
- [tool.poetry.dependencies]
24
- python = ">=3.8"
25
- ruamel-yaml = { version = "^0.17.31", optional = true }
26
- numpy = ">=1.0"
27
- pandas = ">=1.4"
28
- xobjects = ">=0.5.0"
29
- xdeps = ">=0.10.5"
30
- xpart = ">=0.23.0"
31
- xtrack = ">=0.84.6"
32
-
33
- [poetry.group.dev.dependencies]
34
- pytest = ">=7.3"
35
- xaux = ">=0.3.5"
36
-
37
- [tool.poetry.extras]
38
- tests = ["pytest", "ruamel-yaml", "pytest-html", "pytest-xdist"]
39
-
40
- [build-system]
41
- # Needed for pip install -e (BTW: need pip version 22)
42
- requires = ["poetry-core>=1.0.8"]
43
- build-backend = "poetry.core.masonry.api"
44
-
45
- # pyproject.toml
46
- [tool.pytest.ini_options]
47
- addopts = "-ra --durations=10 --durations-min=1"
48
- python_functions = ["test_"]
49
- testpaths = [
50
- "tests",
51
- ]
52
-
@@ -1,26 +0,0 @@
1
- # copyright ############################### #
2
- # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2025. #
4
- # ######################################### #
5
-
6
- from .general import _pkg_root, __version__, citation
7
-
8
- <<<<<<< HEAD
9
- from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal, \
10
- Geant4Collimator, BlowUp, EmittanceMonitor, collimator_classes, crystal_classes, element_classes
11
- =======
12
- from .beam_elements import BlackAbsorber, BlackCrystal, TransparentCollimator, TransparentCrystal, \
13
- EverestBlock, EverestCollimator, EverestCrystal, BlowUp, EmittanceMonitor, \
14
- collimator_classes, crystal_classes, element_classes
15
- >>>>>>> main
16
- from .scattering_routines.everest import materials, Material, CrystalMaterial
17
- from .scattering_routines.geant4 import Geant4Engine
18
- from .colldb import CollimatorDatabase
19
- from .interaction_record import InteractionRecord
20
- from .rf_sweep import RFSweep
21
- from .lossmap import LossMap, MultiLossMap
22
-
23
-
24
- # print("If you use Xcoll in your simulations, please cite us :-)")
25
- # print(citation)
26
-
@@ -1,20 +0,0 @@
1
- # copyright ############################### #
2
- # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2024. #
4
- # ######################################### #
5
-
6
- from pathlib import Path
7
-
8
- _pkg_root = Path(__file__).parent.absolute()
9
-
10
- citation = "F.F. Van der Veken, et al.: Recent Developments with the New Tools for Collimation Simulations in Xsuite, Proceedings of HB2023, Geneva, Switzerland."
11
-
12
- # ======================
13
- # Do not change
14
- # ======================
15
- <<<<<<< HEAD
16
- __version__ = '0.5.11.dev0+geant4'
17
- =======
18
- __version__ = '0.6.0'
19
- >>>>>>> main
20
- # ======================