xcoll 0.3.3__py3-none-any.whl → 0.3.5__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.

Potentially problematic release.


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

Files changed (317) hide show
  1. xcoll/beam_elements/__init__.py +5 -0
  2. xcoll/beam_elements/absorber.py +2 -1
  3. xcoll/beam_elements/base.py +32 -17
  4. xcoll/beam_elements/collimators_src/absorber.h +5 -0
  5. xcoll/beam_elements/everest.py +14 -25
  6. xcoll/colldb.py +50 -27
  7. xcoll/general.py +1 -1
  8. xcoll/headers/checks.h +7 -1
  9. xcoll/impacts/impacts.py +2 -1
  10. xcoll/impacts/impacts_src/impacts.h +1 -6
  11. xcoll/manager.py +5 -5
  12. xcoll/rf_sweep.py +90 -19
  13. xcoll/scattering_routines/everest/__init__.py +5 -0
  14. xcoll/scattering_routines/everest/everest.py +1 -1
  15. xcoll/scattering_routines/fluka/build_fluka_input.py +58 -0
  16. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  17. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  18. xcoll/scattering_routines/fluka/flukaio/src/Connection.d +68 -48
  19. xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  20. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +46 -37
  21. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  22. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +28 -25
  23. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  24. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +67 -47
  25. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  26. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +39 -33
  27. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  28. xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +66 -47
  29. xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  30. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/METADATA +3 -2
  31. xcoll-0.3.5.dist-info/NOTICE +2 -0
  32. xcoll-0.3.5.dist-info/RECORD +111 -0
  33. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/WHEEL +1 -1
  34. xcoll/beam_elements/collimators_src/base_block.h +0 -14
  35. xcoll/beam_elements/collimators_src/base_collimator.h +0 -14
  36. xcoll/beam_elements/collimators_src/invalid_collimator.h +0 -15
  37. xcoll/install_collimators.py +0 -180
  38. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  39. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  40. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  41. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  42. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  43. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  44. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  45. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  46. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  47. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  48. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  49. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  281. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  282. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  283. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  284. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -662
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -110
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  290. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -475
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -20
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  296. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  297. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  298. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  303. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  304. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  307. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  308. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  309. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  310. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  316. xcoll-0.3.3.dist-info/RECORD +0 -391
  317. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/LICENSE +0 -0
@@ -1,475 +0,0 @@
1
- import re
2
- import io
3
- import numpy as np
4
- import warnings
5
-
6
- import pandas as pd
7
-
8
- import xtrack as xt
9
- import collimasim as cs
10
-
11
- from enum import Enum, unique
12
-
13
- @unique
14
- class MissingCollimatorAction(Enum):
15
- ERROR = "error"
16
- WARN = "warn"
17
- SKIP = "skip"
18
-
19
-
20
- # Suppress some pandas warning that do not apply to the use case at hand
21
- pd.options.mode.chained_assignment = None
22
-
23
-
24
- def _calc_betagamma(E0, E):
25
- gamma = float(E)/E0
26
- beta = np.sqrt(1.-(1./gamma)**2)
27
-
28
- return beta*gamma
29
-
30
-
31
- def _norm_to_geom_emittance(norm_emittance, E0, E):
32
- betagamma = _calc_betagamma(E0, E)
33
- return norm_emittance / betagamma
34
-
35
-
36
- def _geom_to_norm_emittance(geom_emittance, E0, E):
37
- betagamma = _calc_betagamma(E0, E)
38
- return betagamma * geom_emittance
39
-
40
-
41
- def _get_twiss_header(tfsfile):
42
- header = None
43
- line_no = 0
44
- with open(tfsfile, "r") as filein:
45
- for idx, line in enumerate(filein):
46
- if line.startswith("*"): # This is the header line, preamble lines start with @
47
- header = line.replace("*", "").strip().split() # Strip the comment char
48
- line_no = idx + 1 # As zero counted
49
- break # End the loop early - information found
50
-
51
- return header, line_no
52
-
53
-
54
- def _load_collimators_tfs(tfsfile):
55
- header, header_line_no = _get_twiss_header(tfsfile)
56
-
57
- required_columns = {"KEYWORD", "NAME", "BETX", "BETY", "ALFX", "ALFY", "DX", "DY", "X", "Y", "PT"}
58
-
59
- if not required_columns.issubset(set(required_columns)):
60
- raise KeyError("The required columns in the MAD-X"
61
- " TFS file are: {}".format(" ".join(list(required_columns))))
62
-
63
- twiss = pd.read_csv(tfsfile, delim_whitespace=True, skiprows=header_line_no+1,
64
- index_col=False, names=header)
65
-
66
- twiss_coll = twiss[twiss["KEYWORD"] == "COLLIMATOR"] # Collimators only
67
- twiss_coll = twiss[list(required_columns)] # Reduce the data fields
68
- twiss_coll["NAME"] = twiss_coll["NAME"].str.lower() # Make the names lowercase for easy processing
69
-
70
- twiss_coll.rename(columns={key: key.lower() for key in list(twiss_coll.columns)}, inplace=True)
71
- twiss_coll.rename(columns={'pt': 'delta'}, inplace=True) # rename PT to delta for consistency
72
- twiss_coll = twiss_coll.set_index("name").T
73
-
74
- return twiss_coll.to_dict()
75
-
76
-
77
- def _load_collimators_xtrack(xt_twiss):
78
- required_columns = {"name", "betx", "bety", "alfx", "alfy", "dx", "dy", "x", "y", "delta"}
79
- twiss_coll = pd.DataFrame({key: xt_twiss[key] for key in required_columns})
80
- twiss_coll = twiss_coll.set_index('name').T
81
-
82
- return twiss_coll.to_dict()
83
-
84
-
85
- def _colldb_format_detector(colldb_file):
86
- # Detect the likely format of a colldb file
87
- lines = []
88
- formats = ('collgaps', 'old_colldb', 'new_colldb', 'yaml_colldb')
89
- formats_found = {fmt: False for fmt in formats}
90
-
91
- all_old_colldb_lines = True
92
- all_collgaps_lines = True
93
- has_yaml_syntax = False
94
- with open(colldb_file, 'r') as infile:
95
- for l_no, line in enumerate(infile):
96
- line = line.strip()
97
- if line.startswith("#"):
98
- continue # Comment
99
- if len(line.strip()) == 0:
100
- continue # Empty line
101
- lines.append(line)
102
- # Detect based on the number of items on a line or
103
- # special charecters for the case of yaml
104
- if line == '---' or ':' in line:
105
- has_yaml_syntax = True
106
- elif len(line.split()) == 1: # Line from an old CollDB
107
- all_collgaps_lines = False
108
- elif len(line.split()) == 13: # Line from collgaps
109
- all_old_colldb_lines = False
110
- else:
111
- all_collgaps_lines = False
112
- all_old_colldb_lines = False
113
-
114
- formats_found['yaml_colldb'] = has_yaml_syntax
115
- formats_found['old_colldb'] = all_old_colldb_lines
116
- formats_found['collgaps'] = all_collgaps_lines
117
- # The default case is the new CollDB
118
- # The loader there has checking for valid formats
119
- formats_found['new_colldb'] = not all_old_colldb_lines \
120
- and not all_collgaps_lines \
121
- and not has_yaml_syntax
122
- assert sum(formats_found.values()) == 1
123
-
124
- likely_format = [key for key in formats_found if formats_found[key] == True][0]
125
- print(f"Detected CollDB format: {likely_format}")
126
- return likely_format
127
-
128
-
129
- def _load_colldb_yaml(filename):
130
- raise ValueError('Loading of yaml format CollDB not implemented yet.')
131
-
132
-
133
- def _load_colldb_old(filename):
134
-
135
- float_num = r'[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?' # Float
136
- sep = r'\s+'
137
-
138
- # Not sure what the value 3 from last is, so it is not named
139
- coll_re = re.compile(r'''
140
- #{sep}
141
- (?P<name>.+){sep}
142
- (?P<name_lower>.+){sep}
143
- (?P<nsigma>{float_num}){sep}
144
- (?P<material>[a-zA-Z]+){sep}
145
- (?P<length>{float_num}){sep}
146
- (?P<angle>{float_num}){sep}
147
- ({float_num}){sep}
148
- (?P<betax>{float_num}){sep}
149
- (?P<betay>{float_num}){sep}
150
- '''.format(sep=sep, float_num=float_num), re.VERBOSE)
151
-
152
- with open(filename, "r") as infile:
153
- colldb_contents = infile.read()
154
-
155
- # List of dicts for each match (collimator)
156
- matches = [m.groupdict() for m in coll_re.finditer(colldb_contents)]
157
-
158
- # Make into a dict by name for easy access
159
- collimator_data = {}
160
- for m in matches:
161
- cname = m["name"].lower()
162
- collimator_data[cname] = {"nsigma" : float(m["nsigma"]),
163
- "angle" : float(m["angle"]),
164
- "length" : float(m["length"]),
165
- "material": m["material"],
166
- }
167
-
168
- #print(collimator_data)
169
- return collimator_data
170
-
171
-
172
- def _load_colldb_new(filename):
173
- with open(filename, "r") as infile:
174
- coll_data_string = ""
175
- family_settings = {}
176
- family_types = {}
177
- onesided = {}
178
- tilted = {}
179
-
180
- for l_no, line in enumerate(infile):
181
- if line.startswith("#"):
182
- continue # Comment
183
- if len(line.strip()) == 0:
184
- continue # Empty line
185
- sline = line.split()
186
- if len(sline) < 6:
187
- if sline[0].lower() == "nsig_fam":
188
- family_settings[sline[1]] = sline[2]
189
- family_types[sline[1]] = sline[3]
190
- elif sline[0].lower() == "onesided":
191
- onesided[sline[1]] = int(sline[2])
192
- elif sline[0].lower() == "tilted":
193
- tilted[sline[1]] = [float(sline[2]), float(sline[3])]
194
- elif sline[0].lower() == "settings":
195
- pass # Acknowledge and ignore this line
196
- else:
197
- raise ValueError(f"Unknown setting {line}")
198
- else:
199
- coll_data_string += line
200
-
201
- names = ["name", "opening", "material", "length", "angle", "offset"]
202
-
203
- df = pd.read_csv(io.StringIO(coll_data_string), delim_whitespace=True,
204
- index_col=False, skip_blank_lines=True, names=names)
205
-
206
- df["angle"] = np.deg2rad(df["angle"]) # convert to radians
207
- df["name"] = df["name"].str.lower() # Make the names lowercase for easy processing
208
- df["nsigma"] = df["opening"].apply(lambda s: float(family_settings.get(s, s)))
209
- df["type"] = df["opening"].apply(lambda s: family_types.get(s, "UNKNOWN"))
210
- df["side"] = df["name"].apply(lambda s: onesided.get(s, 0))
211
- df["tilt_left"] = df["name"].apply(lambda s: np.deg2rad(tilted.get(s, [0, 0])[0]))
212
- df["tilt_right"] = df["name"].apply(lambda s: np.deg2rad(tilted.get(s, [0, 0])[1]))
213
- df = df.set_index("name").T
214
-
215
- # Ensure the collimators marked as one-sided or tilted are actually defined
216
- defined_set = set(df.columns) # The data fram was transposed so columns are names
217
- onesided_set = set(onesided.keys())
218
- tilted_set = set(tilted.keys())
219
- if not onesided_set.issubset(defined_set):
220
- different = onesided_set - defined_set
221
- raise SystemExit('One-sided collimators not defined: {}'.format(", ".join(different)))
222
- if not tilted_set.issubset(defined_set):
223
- different = tilted_set - defined_set
224
- raise SystemExit('Tilted collimators not defined: {}'.format(",".join(different)))
225
- return df.to_dict()
226
-
227
-
228
- def _load_collgaps(filename):
229
- names = ["id", "name", "angle", "betax", "betay", "halfgap", "material",
230
- "length", "sigx", "sigy", "tilt1", "tilt2", "nsigma"]
231
-
232
- df = pd.read_csv(filename, delim_whitespace=True, index_col=False, names=names, header=0, comment='#')
233
- df["name"] = df["name"].str.lower() # Make the names lowercase for easy processing
234
- df = df.set_index("name").T
235
-
236
- return df.to_dict()
237
-
238
-
239
- class Geant4CollimationManager:
240
-
241
- def __init__(self, collimator_file, bdsim_config_file, tfs_file, emittance_norm, reference_pdg_id,
242
- reference_kinetic_energy, relative_energy_cut, seed, material_rename_map={}, batchMode=True):
243
-
244
- unit_GeV = 1e9 # GeV to MeV
245
-
246
- # Energy units in Xtrack are eV
247
- self.collimator_file = collimator_file
248
- self.bdsim_config_file = bdsim_config_file
249
- self.tfs_file = tfs_file
250
- self.reference_pdg_id = reference_pdg_id
251
- self.reference_kinetic_energy = reference_kinetic_energy
252
- self.relative_energy_cut = relative_energy_cut
253
- self.seed = seed
254
-
255
- self.material_rename_map = material_rename_map
256
-
257
- # Allow for an asymmetric beam via a in iterable emittance assignment
258
- try:
259
- iter(emittance_norm)
260
- self.emit_norm_x = emittance_norm[0]
261
- self.emit_norm_y = emittance_norm[1]
262
- except TypeError:
263
- self.emit_norm_x = emittance_norm
264
- self.emit_norm_y = emittance_norm
265
-
266
- # Initialise BDSIM (the Geant4 kernel)
267
- self.g4link = cs.XtrackInterface(bdsimConfigFile=self.bdsim_config_file,
268
- referencePdgId=self.reference_pdg_id,
269
- referenceEk=self.reference_kinetic_energy / unit_GeV, # BDSIM expects GeV
270
- relativeEnergyCut=self.relative_energy_cut,
271
- seed=self.seed, batchMode=batchMode)
272
- # Batch mode disables visualisation
273
-
274
- self.reference_mass = self.g4link.getReferenceMass() * unit_GeV # BDSIM gives the mass in GeV
275
-
276
- # Load the collimator settings and optics separately as not sure if all MAD-X collimators are needed
277
- if isinstance(self.tfs_file, xt.twiss.TwissTable):
278
- self._collimator_optics = _load_collimators_xtrack(self.tfs_file)
279
- elif isinstance(self.tfs_file, str):
280
- self._collimator_optics = _load_collimators_tfs(self.tfs_file)
281
- else:
282
- raise Exception('Collimator optics can only be an Xtrack twiss dict,'
283
- ' or a path to a MAD-X twiss file')
284
- self._collimator_settings = self._load_collimator_data(self.collimator_file)
285
-
286
- self.collimators = {}
287
- self._load_collimators()
288
- #self._load_collimators_collgaps()
289
-
290
- # Debug
291
- #for cname in self.collimators:
292
- # print(cname, self.collimators[cname]["nsigma"], self.collimators[cname]["halfgap"])
293
-
294
- #with open(f"cgaps_{self.collimator_file}", "w") as outfile:
295
- # for cname in self.collimators:
296
- # outfile.write("{} {} {}\n".format(cname,
297
- # self.collimators[cname]["nsigma"],
298
- # self.collimators[cname]["halfgap"]))
299
-
300
- def _load_collimator_data(self, collimator_file):
301
- detected_format = _colldb_format_detector(collimator_file)
302
- loader_dispatch = {'collgaps': _load_collgaps,
303
- 'new_colldb': _load_colldb_new,
304
- 'old_colldb': _load_colldb_old,
305
- 'yaml_colldb': _load_colldb_yaml}
306
-
307
- data = loader_dispatch[detected_format](collimator_file)
308
- return data
309
-
310
- def _calc_collimator_halfgap(self, name):
311
- # Calculate the geometric emittances first
312
- totalEnergy = self.reference_kinetic_energy + self.reference_mass
313
- emit_geom_x = _norm_to_geom_emittance(self.emit_norm_x, self.reference_mass, totalEnergy)
314
- emit_geom_y = _norm_to_geom_emittance(self.emit_norm_y, self.reference_mass, totalEnergy)
315
-
316
- betx = self._collimator_optics[name]["betx"]
317
- bety = self._collimator_optics[name]["bety"]
318
-
319
- nsigma = self._collimator_settings[name]["nsigma"]
320
- angle = self._collimator_settings[name]["angle"]
321
-
322
- a = nsigma * np.sqrt(betx * emit_geom_x)
323
- b = nsigma * np.sqrt(bety * emit_geom_y)
324
-
325
- x = a * np.cos(angle)
326
- y = b * np.sin(angle)
327
-
328
- return np.sqrt(x**2 + y**2)
329
-
330
- def _load_collimators(self):
331
-
332
- for cname in self._collimator_settings:
333
- cdata = self._collimator_settings[cname]
334
- copt = self._collimator_optics[cname]
335
-
336
- halfgap = self._calc_collimator_halfgap(cname)
337
-
338
- mat_def = cdata["material"]
339
- material = self.material_rename_map.get(mat_def, mat_def)
340
-
341
- # Compute the offset for the collimators - placed around the closed orbit
342
- x_offset = copt['x']# + copt["delta"] * copt['dx']
343
- y_offset = copt['y']# + copt["delta"] * copt['dy']
344
-
345
- self.g4link.addCollimator(cname, material, cdata["length"], apertureLeft=halfgap, apertureRight=halfgap,
346
- rotation=cdata["angle"], xOffset=x_offset, yOffset=y_offset,
347
- jawTiltLeft=cdata.get("tilt_left", 0.), jawTiltRight=cdata.get("tilt_right", 0.),
348
- side=cdata.get("side", 0))
349
-
350
- # Merge all the info about the collimator in the same dictionary for storage
351
- self.collimators[cname] = {**cdata, **copt}
352
- self.collimators[cname]["halfgap"] = halfgap
353
-
354
- def _load_collimators_collgaps(self):
355
- collimators = np.genfromtxt(self.collimator_file, dtype=None, encoding=None, comments='#')
356
-
357
- # This would be nicer with pandas, but don't need the dependency just for this one bit
358
- for coll in collimators:
359
- name = coll[1]
360
- material = coll[6]
361
- length = float(coll[7])
362
- angle = float(coll[2])
363
- halfgap = float(coll[5])
364
-
365
- # TODO: add the closed orbit at the collimator
366
- # side=0 means both jaws
367
- side = 0 # Default for now
368
-
369
- self.g4link.addCollimator(name, material, length, aperture=halfgap*2,
370
- rotation=angle, xOffset=0, yOffset=0, side=0)
371
-
372
- self.collimators[name] = {"material": material,
373
- "length": length,
374
- "halfgap": halfgap,
375
- "angle": angle,
376
- "side": side,
377
- }
378
-
379
- def process_collimator(self, collimator_name, particles):
380
- self.g4link.clearData() # Clear the old data - bunch particles and hits
381
-
382
- print(f"Processing collimator: {collimator_name}")
383
-
384
- # This temp delta is necessary because for primary particles, the coordinates are
385
- # modified in place. But for the longitudinal plane there are 3 coordinates that must
386
- # be updated, so pass a copy of the delta for the update in place and trigger the
387
- # correct update of the 3 coordinates later
388
- delta_temp = particles._delta.copy()
389
-
390
- # Using a list allows to package the required coordinates without copying
391
- coordinates = [particles.x, particles.y, particles.px, particles.py,
392
- particles.zeta, delta_temp, particles.s,
393
- particles.particle_id, particles.state,
394
- particles.at_element, particles.at_turn]
395
-
396
- self.g4link.addParticles(coordinates)
397
- # The collimators must be defined already in the g4manager
398
- self.g4link.selectCollimator(collimator_name)
399
-
400
- self.g4link.collimate() # Performs the physical interaction simulation
401
-
402
- # Modifies the primary coordinates in place and returns a list of arrays for the
403
- # coordinates of the secondary particles.
404
- products = self.g4link.collimateReturn(coordinates)
405
-
406
- # Force the update using the private member _delta
407
- # as the update_delta method only updates the delta for active particles
408
- particles._delta[:len(delta_temp)] = delta_temp
409
- particles.update_delta(delta_temp)
410
-
411
- return products
412
-
413
- def make_xtg4_collimator(self, name):
414
- name = name.lower()
415
- if name not in self.collimators:
416
- raise KeyError(f"Collimator {name} is not defined in the Geant4 model")
417
-
418
- g4coll = cs.Geant4Collimator(name=name, g4manager=self)
419
- xtg4coll = xt.BeamInteraction(name=name, interaction_process=g4coll,
420
- length=self.collimators[name]["length"])
421
-
422
- return xtg4coll
423
-
424
- def place_all_collimators(self, sequence, on_missing=None):
425
- # Make the collimators
426
- for name in self.collimators:
427
- coll = self.make_xtg4_collimator(name)
428
- self.place_xtg4_collimator(sequence, coll, on_missing=on_missing)
429
-
430
-
431
- def place_xtg4_collimator(self, sequence, xtg4_collimator, on_missing=None):
432
- '''
433
- A function to expand a collimator from a marker or an active-length-only
434
- collimator to a full-size element. To achieve that, all the elements found
435
- inside the collimator length are discarded, and the outer-most drifts are
436
- trimmed to fit the thick collimator.
437
- '''
438
-
439
- coll_name = xtg4_collimator.interaction_process.name
440
- coll_length = xtg4_collimator.length
441
-
442
- if on_missing is None:
443
- on_missing = "warn"
444
- exception_type = MissingCollimatorAction(on_missing)
445
-
446
- try:
447
- coll_idx = sequence.element_names.index(coll_name.lower())
448
- except ValueError:
449
- msg = f"Collimator {coll_name} not found in sequence"
450
- if exception_type == MissingCollimatorAction.ERROR:
451
- raise ValueError(msg)
452
- elif exception_type == MissingCollimatorAction.WARN:
453
- warnings.warn(msg)
454
-
455
- s_pos = sequence.get_s_elements()
456
-
457
- s_ups = s_pos[coll_idx]
458
- s_dns = s_pos[coll_idx + 1]
459
- s_cent = (s_ups + s_dns) / 2
460
- len_c_xt = s_dns - s_ups
461
-
462
- coll_edge_ups = s_cent - coll_length / 2
463
- coll_edge_dns = s_cent + coll_length / 2
464
-
465
- sequence.insert_element(at_s=coll_edge_ups, element=xtg4_collimator, name=coll_name.lower())
466
-
467
-
468
- class Geant4Collimator:
469
- def __init__(self, name, g4manager):
470
- self.name = name
471
- self.g4manager = g4manager
472
-
473
- def interact(self, particles):
474
- # The track method is needed for tracking in Xtrack
475
- return self.g4manager.process_collimator(self.name, particles)
@@ -1,6 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: collimasim
3
- Version: 0.0.1
4
- Summary: Python bindings of BDSIM (Geant4) for collimation studies
5
- Author: Andrey Abramov, Laurie Nevay
6
- Author-email: andrey.abramov@cern.ch
@@ -1,20 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- setup.py
4
- src/collimasim/__init__.py
5
- src/collimasim/pyCollimatorPass.py
6
- src/collimasim/xtrack_collimator.py
7
- src/collimasim.egg-info/PKG-INFO
8
- src/collimasim.egg-info/SOURCES.txt
9
- src/collimasim.egg-info/dependency_links.txt
10
- src/collimasim.egg-info/not-zip-safe
11
- src/collimasim.egg-info/top_level.txt
12
- tests/test_pyat.py
13
- tests/test_pyat_passmethod.py
14
- tests/test_pyat_tracking.py
15
- tests/test_xtrack.py
16
- tests/test_xtrack_angle.py
17
- tests/test_xtrack_colldb_load.py
18
- tests/test_xtrack_interaction.py
19
- tests/test_xtrack_tilt.py
20
- tests/test_xtrack_tracking.py
@@ -1,25 +0,0 @@
1
- # Test suite for collimasim
2
-
3
- To run all the tests successfully, both `Xsuite` and `pyAT` must be installed
4
-
5
- To run with pytest, the extension `pytest-forked` must be installed
6
-
7
- ```
8
- pip install pytest-forked
9
- ```
10
-
11
- and then
12
-
13
- ```
14
- pytest --forked --continue-on-collection-errors
15
- ```
16
- in the `collimasim/tests` directory to run the tests.
17
-
18
- This is because collimasim is currently not re-entry safe.
19
- Once an instance of BDSIM has been launched in a process,
20
- no further instances can be launched in that process.
21
- This appears to be due to the global state not being reset
22
- properly after the BDISM instance terminates.
23
- To be investigated in the future.
24
- The flag --continue-on-collection-errors ensures that
25
- the Xsuite tests run if pyAT isn't isntalled and vice versa.
@@ -1,18 +0,0 @@
1
- # Automatically converted collimator DB from old format file 'CollDB_HL.data'
2
- # Families
3
- NSIG_FAM tcph 10.000000 PRIMARY
4
- NSIG_FAM tcpv 80.000000 PRIMARY
5
- NSIG_FAM tcsh 11.500000 SECONDARY
6
- NSIG_FAM tcsv 89.500000 SECONDARY
7
- #
8
- # Collimators
9
- # name opening/fam mat. length[m] angle[deg] offset[m]
10
- tcp.a.b1 tcph C 0.600000 0.000000 0.000000
11
- tcp.b.b1 tcpv C 0.600000 90.00000 0.000000
12
- tcs.b1.b1 tcsv C 1.000000 90.00000 0.000000
13
- tcs.a1.b1 tcsh C 1.000000 0.000000 0.000000
14
- tcs.a2.b1 tcsh C 1.000000 0.000000 0.000000
15
- tcs.b2.b1 tcsv C 1.000000 90.00000 0.000000
16
- #
17
- # Additional Collimator Settings
18
- SETTINGS
@@ -1,68 +0,0 @@
1
- # Database for cleaning insertion collimators. Prepared: 23 Jun 2021
2
- 6
3
-
4
- #
5
- TCP.A.B1
6
- tcp.a.b1
7
- 10
8
- C
9
- 0.6
10
- 0
11
- 0.0000000000000000
12
- 647.6350305671534
13
- 53.02571504616053
14
-
15
- #
16
- TCP.B.B1
17
- tcp.b.b1
18
- 80
19
- C
20
- 0.6
21
- 1.5707963267948966
22
- 0.0000000000000000
23
- 603.3821034080673
24
- 58.54786181209406
25
-
26
- #
27
- TCS.B1.B1
28
- tcs.b1.b1
29
- 89.5
30
- C
31
- 1.0
32
- 1.5707963267948966
33
- 0.0000000000000000
34
- 290.63093200994945
35
- 154.51051797015745
36
-
37
- #
38
- TCS.A1.B1
39
- tcs.a1.b1
40
- 11.5
41
- C
42
- 1.0
43
- 0
44
- 0.0000000000000000
45
- 73.34173975049991
46
- 390.8874328919145
47
-
48
- #
49
- TCS.A2.B1
50
- tcs.a2.b1
51
- 11.5
52
- C
53
- 1.0
54
- 0
55
- 0.0000000000000000
56
- 465.66698081057984
57
- 488.78492630379634
58
-
59
- #
60
- TCS.B2.B1
61
- tcs.b2.b1
62
- 89.5
63
- C
64
- 1.0
65
- 1.5707963267948966
66
- 0.0000000000000000
67
- 1783.19687950021
68
- 362.409353541563
@@ -1,15 +0,0 @@
1
- # Automatically converted collimator DB from old format file 'CollDB_HL.data'
2
- # Families
3
- NSIG_FAM dummy 5.000000 PRIMARY
4
- #
5
- # Collimators
6
- # name opening/fam mat. length[m] angle[deg] offset[m]
7
- coll_open 90 W 10.00000 0.000000 0.000000
8
- coll_skew dummy W 0.60000 45.000000 0.000000
9
- coll_skew_tilted dummy W 0.60000 45.000000 0.000000
10
- #
11
-
12
- #ONESIDED dummy1 1
13
- TILTED coll_skew_tilted 4 -9
14
- # Additional Collimator Settings
15
- SETTINGS