xcoll 0.5.11__py3-none-any.whl → 0.6.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.

Potentially problematic release.


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

Files changed (333) hide show
  1. xcoll/__init__.py +5 -18
  2. xcoll/beam_elements/__init__.py +1 -0
  3. xcoll/beam_elements/absorber.py +12 -2
  4. xcoll/beam_elements/base.py +162 -62
  5. xcoll/beam_elements/blowup.py +1 -0
  6. xcoll/beam_elements/elements_src/black_absorber.h +57 -58
  7. xcoll/beam_elements/elements_src/black_crystal.h +49 -50
  8. xcoll/beam_elements/elements_src/everest_block.h +21 -11
  9. xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
  10. xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
  11. xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
  12. xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
  13. xcoll/beam_elements/everest.py +16 -5
  14. xcoll/beam_elements/monitor.py +1 -0
  15. xcoll/beam_elements/transparent.py +83 -0
  16. xcoll/colldb.py +15 -6
  17. xcoll/general.py +1 -1
  18. xcoll/headers/particle_states.py +51 -0
  19. xcoll/initial_distribution.py +129 -103
  20. xcoll/interaction_record/interaction_record.py +2 -1
  21. xcoll/interaction_record/interaction_types.py +2 -2
  22. xcoll/line_tools.py +163 -74
  23. xcoll/lossmap.py +519 -127
  24. xcoll/plot.py +109 -0
  25. xcoll/rf_sweep.py +6 -0
  26. xcoll/scattering_routines/engine.py +600 -0
  27. xcoll/scattering_routines/environment.py +297 -0
  28. xcoll/scattering_routines/everest/amorphous.h +95 -71
  29. xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
  30. xcoll/scattering_routines/everest/constants.h +1 -1
  31. xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
  32. xcoll/scattering_routines/everest/everest.h +8 -3
  33. xcoll/scattering_routines/everest/everest.py +2 -1
  34. xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
  35. xcoll/scattering_routines/everest/jaw.h +19 -24
  36. xcoll/scattering_routines/everest/materials.py +2 -0
  37. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  38. xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
  39. xcoll/scattering_routines/everest/properties.h +4 -73
  40. xcoll/xaux.py +73 -0
  41. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
  42. xcoll-0.6.0.dist-info/RECORD +135 -0
  43. xcoll/_manager.py +0 -22
  44. xcoll/headers/particle_states.h +0 -25
  45. xcoll/install.py +0 -35
  46. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  47. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  48. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  49. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  50. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  51. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  52. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  53. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  54. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  55. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  283. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  284. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  285. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  286. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  287. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  288. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  289. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  290. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  298. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
  299. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  300. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
  301. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  302. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  303. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  304. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  307. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  311. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  312. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  313. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  314. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  315. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
  316. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  317. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  318. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  319. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  324. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
  325. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
  326. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
  327. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  328. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  329. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
  330. xcoll-0.5.11.dist-info/RECORD +0 -413
  331. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
  332. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
  333. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
xcoll/__init__.py CHANGED
@@ -1,32 +1,19 @@
1
1
  # copyright ############################### #
2
2
  # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2024. #
3
+ # Copyright (c) CERN, 2025. #
4
4
  # ######################################### #
5
5
 
6
6
  from .general import _pkg_root, __version__, citation
7
7
 
8
- from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal, \
9
- BlowUp, EmittanceMonitor, collimator_classes, crystal_classes, element_classes
8
+ from .beam_elements import BlackAbsorber, BlackCrystal, TransparentCollimator, TransparentCrystal, \
9
+ EverestBlock, EverestCollimator, EverestCrystal, BlowUp, EmittanceMonitor, \
10
+ collimator_classes, crystal_classes, element_classes
10
11
  from .scattering_routines.everest import materials, Material, CrystalMaterial
11
12
  from .colldb import CollimatorDatabase
12
13
  from .interaction_record import InteractionRecord
13
14
  from .rf_sweep import RFSweep
14
- from .lossmap import LossMap
15
+ from .lossmap import LossMap, MultiLossMap
15
16
 
16
- # Deprecated
17
- from ._manager import CollimatorManager
18
- from .install import install_elements
19
- from .line_tools import assign_optics_to_collimators, open_collimators, send_to_parking, enable_scattering, disable_scattering
20
- def generate_pencil_on_collimator(line, name, *args, **kwargs):
21
- from warnings import warn
22
- warn("`xcoll.generate_pencil_on_collimator()` is deprecated and will be removed. Use "
23
- + "`line[coll].generate_pencil()` instead.", FutureWarning)
24
- return line[name].generate_pencil(*args, **kwargs)
25
- def generate_delta_from_dispersion(line, at_element, *args, **kwargs):
26
- from warnings import warn
27
- warn("`xcoll.generate_delta_from_dispersion()` is deprecated and will be removed. Use "
28
- + "`line[at_element].generate_delta()` instead.", FutureWarning)
29
- return line[name].generate_delta(*args, **kwargs)
30
17
 
31
18
  # print("If you use Xcoll in your simulations, please cite us :-)")
32
19
  # print(citation)
@@ -5,6 +5,7 @@
5
5
 
6
6
  from .base import BaseBlock, BaseCollimator, BaseCrystal
7
7
  from .absorber import BlackAbsorber, BlackCrystal
8
+ from .transparent import TransparentCollimator, TransparentCrystal
8
9
  from .everest import EverestBlock, EverestCollimator, EverestCrystal
9
10
  from .blowup import BlowUp
10
11
  from .monitor import EmittanceMonitor
@@ -16,11 +16,16 @@ class BlackAbsorber(BaseCollimator):
16
16
  }
17
17
 
18
18
  isthick = True
19
+ needs_rng = False
19
20
  allow_track = True
21
+ allow_double_sided = True
20
22
  behaves_like_drift = True
23
+ allow_rot_and_shift = False
24
+ allow_loss_refinement = True
21
25
  skip_in_loss_location_refinement = True
22
26
 
23
- _depends_on = [BaseCollimator, XcollGeometry]
27
+ _noexpr_fields = BaseCollimator._noexpr_fields
28
+ _depends_on = [BaseCollimator, XcollGeometry]
24
29
 
25
30
  _extra_c_sources = [
26
31
  _pkg_root.joinpath('beam_elements','elements_src','black_absorber.h')
@@ -47,11 +52,16 @@ class BlackCrystal(BaseCrystal):
47
52
  }
48
53
 
49
54
  isthick = True
55
+ needs_rng = False
50
56
  allow_track = True
57
+ allow_double_sided = False
51
58
  behaves_like_drift = True
59
+ allow_rot_and_shift = False
60
+ allow_loss_refinement = True
52
61
  skip_in_loss_location_refinement = True
53
62
 
54
- _depends_on = [BaseCrystal, XcollGeometry]
63
+ _noexpr_fields = BaseCrystal._noexpr_fields
64
+ _depends_on = [BaseCrystal, XcollGeometry]
55
65
 
56
66
  _extra_c_sources = [
57
67
  _pkg_root.joinpath('beam_elements','elements_src','black_crystal.h')
@@ -10,6 +10,7 @@ import xtrack as xt
10
10
 
11
11
  from ..interaction_record import InteractionRecord
12
12
  from ..general import _pkg_root
13
+ from ..headers.particle_states import particle_states_src
13
14
 
14
15
 
15
16
  OPEN_JAW = 3
@@ -22,14 +23,16 @@ class InvalidXcoll(xt.BeamElement):
22
23
  }
23
24
 
24
25
  isthick = True
25
- behaves_like_drift = True
26
+ needs_rng = False
26
27
  allow_track = False
27
- skip_in_loss_location_refinement = True
28
+ behaves_like_drift = True
29
+ allow_rot_and_shift = False
28
30
  allow_loss_refinement = True
31
+ skip_in_loss_location_refinement = True
29
32
 
30
33
  # InvalidXcoll catches unallowed cases, like backtracking through a collimator
31
34
  _extra_c_sources = [
32
- _pkg_root.joinpath('headers','particle_states.h'),
35
+ particle_states_src,
33
36
  _pkg_root.joinpath('headers','checks.h')
34
37
  ]
35
38
 
@@ -51,12 +54,16 @@ class BaseBlock(xt.BeamElement):
51
54
  }
52
55
 
53
56
  isthick = True
57
+ needs_rng = False
54
58
  allow_track = False
59
+ allow_double_sided = True
55
60
  behaves_like_drift = True
61
+ allow_rot_and_shift = False
62
+ allow_loss_refinement = True
56
63
  skip_in_loss_location_refinement = True
57
64
 
58
65
  _skip_in_to_dict = ['_record_interactions']
59
- _store_in_to_dict = ['record_impacts', 'record_exits', 'record_scatterings']
66
+ _store_in_to_dict = ['name', 'record_impacts', 'record_exits', 'record_scatterings']
60
67
 
61
68
  _depends_on = [InvalidXcoll]
62
69
 
@@ -64,15 +71,42 @@ class BaseBlock(xt.BeamElement):
64
71
 
65
72
  # This is an abstract class and cannot be instantiated
66
73
  def __new__(cls, *args, **kwargs):
67
- if cls == BaseBlock:
74
+ if cls is BaseBlock:
68
75
  raise Exception("Abstract class `BaseBlock` cannot be instantiated!")
69
76
  instance = super().__new__(cls)
70
77
  return instance
71
78
 
72
79
  def __init__(self, **kwargs):
80
+ to_assign = {}
73
81
  if '_xobject' not in kwargs:
82
+ # Set name (useful for bookkeeping like in FLUKA)
83
+ to_assign['name'] = kwargs.pop('name', None)
84
+ # Set active
74
85
  kwargs.setdefault('active', True)
86
+ to_assign['record_impacts'] = kwargs.pop('record_impacts', False)
87
+ to_assign['record_exits'] = kwargs.pop('record_exits', False)
88
+ to_assign['record_scatterings'] = kwargs.pop('record_scatterings', False)
75
89
  super().__init__(**kwargs)
90
+ # Careful: non-xofields are not passed correctly between copy's / to_dict. This messes with flags etc..
91
+ # We also have to manually initialise them for xobject generation
92
+ for key, val in to_assign.items():
93
+ setattr(self, key, val)
94
+ BaseBlock._verify_consistency(self)
95
+
96
+ def copy(self, **kwargs):
97
+ obj = super().copy(**kwargs)
98
+ obj.name = self.name
99
+ return obj
100
+
101
+ @property
102
+ def name(self):
103
+ if not hasattr(self, '_name'):
104
+ self._name = None
105
+ return self._name
106
+
107
+ @name.setter
108
+ def name(self, val):
109
+ self._name = val
76
110
 
77
111
  def enable_scattering(self):
78
112
  if hasattr(self, '_tracking'):
@@ -93,6 +127,8 @@ class BaseBlock(xt.BeamElement):
93
127
 
94
128
  @record_impacts.setter
95
129
  def record_impacts(self, val):
130
+ if not isinstance(val, bool):
131
+ raise ValueError("`record_impacts` must be a boolean value.")
96
132
  if val and not self.record_impacts:
97
133
  self._record_interactions += 1
98
134
  elif not val and self.record_impacts:
@@ -104,6 +140,8 @@ class BaseBlock(xt.BeamElement):
104
140
 
105
141
  @record_exits.setter
106
142
  def record_exits(self, val):
143
+ if not isinstance(val, bool):
144
+ raise ValueError("`record_exits` must be a boolean value.")
107
145
  if val and not self.record_exits:
108
146
  self._record_interactions += 2
109
147
  elif not val and self.record_exits:
@@ -115,6 +153,8 @@ class BaseBlock(xt.BeamElement):
115
153
 
116
154
  @record_scatterings.setter
117
155
  def record_scatterings(self, val):
156
+ if not isinstance(val, bool):
157
+ raise ValueError("`record_scatterings` must be a boolean value.")
118
158
  if val and not self.record_scatterings:
119
159
  self._record_interactions += 4
120
160
  elif not val and self.record_scatterings:
@@ -161,14 +201,20 @@ class BaseCollimator(BaseBlock):
161
201
  '_nemitt_y': xo.Float64
162
202
  }
163
203
 
164
- isthick = BaseBlock.isthick
165
- allow_track = BaseBlock.allow_track
166
- behaves_like_drift = BaseBlock.behaves_like_drift
167
- skip_in_loss_location_refinement = BaseBlock.skip_in_loss_location_refinement
204
+ isthick = True
205
+ needs_rng = False
206
+ allow_track = False
168
207
  allow_double_sided = True
208
+ behaves_like_drift = True
209
+ allow_rot_and_shift = False
210
+ allow_loss_refinement = True
211
+ skip_in_loss_location_refinement = True
169
212
 
170
- _skip_in_to_dict = [*BaseBlock._skip_in_to_dict, *[f for f in _xofields if f.startswith('_')]]
171
- _store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance']
213
+ _noexpr_fields = {'align', 'side', 'name'}
214
+ _skip_in_to_dict = [*BaseBlock._skip_in_to_dict,
215
+ *[f for f in _xofields if f.startswith('_')]]
216
+ _store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap',
217
+ 'side', 'align', 'emittance']
172
218
 
173
219
  _depends_on = [BaseBlock]
174
220
 
@@ -177,7 +223,7 @@ class BaseCollimator(BaseBlock):
177
223
 
178
224
  # This is an abstract class and cannot be instantiated
179
225
  def __new__(cls, *args, **kwargs):
180
- if cls == BaseCollimator:
226
+ if cls is BaseCollimator:
181
227
  raise Exception("Abstract class `BaseCollimator` cannot be instantiated!")
182
228
  instance = super().__new__(cls)
183
229
  return instance
@@ -207,6 +253,10 @@ class BaseCollimator(BaseBlock):
207
253
  for key in ['jaw_L', 'jaw_R', 'jaw_LU', 'jaw_LD', 'jaw_RU', 'jaw_RD', 'gap', 'gap_L', 'gap_R']:
208
254
  if key in kwargs:
209
255
  raise ValueError(f"Cannot use both `jaw` and `{key}`!")
256
+ if hasattr(kwargs['jaw'], '__iter__') and hasattr(kwargs['jaw'][0], '__iter__'):
257
+ for key in ['tilt', 'tilt_L', 'tilt_R']:
258
+ if key in kwargs:
259
+ raise ValueError(f"Cannot specify jaw corners and `{key}`!")
210
260
  to_assign['jaw'] = kwargs.pop('jaw')
211
261
  elif 'jaw_L' in kwargs or 'jaw_R' in kwargs:
212
262
  for key in ['jaw_LU', 'jaw_LD', 'jaw_RU', 'jaw_RD', 'gap', 'gap_L', 'gap_R']:
@@ -233,20 +283,21 @@ class BaseCollimator(BaseBlock):
233
283
  if key in kwargs:
234
284
  raise ValueError(f"Cannot use both `tilt` and `{key}`!")
235
285
  to_assign['tilt'] = kwargs.pop('tilt')
236
- else:
237
- to_assign['tilt_L'] = kwargs.pop('tilt_L', 0)
238
- to_assign['tilt_R'] = kwargs.pop('tilt_R', 0)
286
+ elif 'tilt_L' in kwargs or 'tilt_R' in kwargs:
287
+ to_assign['tilt_L'] = kwargs.pop('tilt_L', None)
288
+ to_assign['tilt_R'] = kwargs.pop('tilt_R', None)
289
+ kwargs.setdefault('_sin_yL', 0)
290
+ kwargs.setdefault('_cos_yL', 1)
291
+ kwargs.setdefault('_sin_yR', 0)
292
+ kwargs.setdefault('_cos_yR', 1)
239
293
 
240
294
  # Set gap
241
295
  if 'gap' in kwargs:
242
- for key in ['jaw', 'jaw_L', 'jaw_R', 'jaw_LU', 'jaw_LD', 'jaw_RU', 'jaw_RD', 'gap_L', 'gap_R']:
296
+ for key in ['gap_L', 'gap_R']:
243
297
  if key in kwargs:
244
298
  raise ValueError(f"Cannot use both `gap` and `{key}`!")
245
299
  to_assign['gap'] = kwargs.pop('gap')
246
300
  elif 'gap_L' in kwargs or 'gap_R' in kwargs:
247
- for key in ['jaw', 'jaw_L', 'jaw_R', 'jaw_LU', 'jaw_LD', 'jaw_RU', 'jaw_RD', 'gap']:
248
- if key in kwargs:
249
- raise ValueError(f"Cannot use both `gap` and `{key}`!")
250
301
  to_assign['gap_L'] = kwargs.pop('gap_L', None)
251
302
  to_assign['gap_R'] = kwargs.pop('gap_R', None)
252
303
  kwargs.setdefault('_gap_L', OPEN_GAP)
@@ -263,7 +314,8 @@ class BaseCollimator(BaseBlock):
263
314
  self._optics = None
264
315
  for key, val in to_assign.items():
265
316
  setattr(self, key, val)
266
- self._verify_consistency()
317
+ self._update_tilts()
318
+ BaseCollimator._verify_consistency(self)
267
319
 
268
320
 
269
321
  # Main collimator angle
@@ -366,7 +418,7 @@ class BaseCollimator(BaseBlock):
366
418
  return
367
419
  # If we got here, val is incompatible
368
420
  raise ValueError(f"The attribute `jaw` should be of the form [L, R] or "
369
- + f"[[LU, RU], [LD, RD], but got {val}.")
421
+ + f"[[LU, LD], [RU, RD], but got {val}.")
370
422
 
371
423
  @property
372
424
  def jaw_L(self):
@@ -408,7 +460,8 @@ class BaseCollimator(BaseBlock):
408
460
 
409
461
  @property
410
462
  def jaw_LU(self):
411
- if not self.jaw_L is None:
463
+ if not np.isclose((self._jaw_LU + self._jaw_LD) / 2,
464
+ OPEN_JAW, atol=1.e-10): # open position
412
465
  return self._jaw_LU
413
466
 
414
467
  @jaw_LU.setter # This assumes jaw_LD remains fixed, hence both jaw_L and the tilt change
@@ -425,7 +478,8 @@ class BaseCollimator(BaseBlock):
425
478
 
426
479
  @property
427
480
  def jaw_LD(self):
428
- if not self.jaw_L is None:
481
+ if not np.isclose((self._jaw_LU + self._jaw_LD) / 2,
482
+ OPEN_JAW, atol=1.e-10): # open position
429
483
  return self._jaw_LD
430
484
 
431
485
  @jaw_LD.setter # This assumes jaw_LU remains fixed, hence both jaw_L and the tilt change
@@ -442,7 +496,8 @@ class BaseCollimator(BaseBlock):
442
496
 
443
497
  @property
444
498
  def jaw_RU(self):
445
- if not self.jaw_R is None:
499
+ if not np.isclose((self._jaw_RU + self._jaw_RD) / 2,
500
+ -OPEN_JAW, atol=1.e-10): # open position
446
501
  return self._jaw_RU
447
502
 
448
503
  @jaw_RU.setter # This assumes jaw_RD remains fixed, hence both jaw_R and the tilt change
@@ -459,7 +514,8 @@ class BaseCollimator(BaseBlock):
459
514
 
460
515
  @property
461
516
  def jaw_RD(self):
462
- if not self.jaw_R is None:
517
+ if not np.isclose((self._jaw_RU + self._jaw_RD) / 2,
518
+ -OPEN_JAW, atol=1.e-10): # open position
463
519
  return self._jaw_RD
464
520
 
465
521
  @jaw_RD.setter # This assumes jaw_RU remains fixed, hence both jaw_R and the tilt change
@@ -498,13 +554,23 @@ class BaseCollimator(BaseBlock):
498
554
 
499
555
  def _update_tilts(self):
500
556
  if self.side != 'right':
501
- self._sin_yL = (self.jaw_LD - self.jaw_LU) / self.length
502
- self._cos_yL = np.sqrt(1 - self._sin_yL**2)
503
- self._tan_yL = self._sin_yL / self._cos_yL
557
+ if self.length > 0:
558
+ self._sin_yL = (self._jaw_LD - self._jaw_LU) / self.length
559
+ self._cos_yL = np.sqrt(1 - self._sin_yL**2)
560
+ self._tan_yL = self._sin_yL / self._cos_yL
561
+ else:
562
+ self._sin_yL = 0.
563
+ self._cos_yL = 1.
564
+ self._tan_yL = 0.
504
565
  if self.side != 'left':
505
- self._sin_yR = (self.jaw_RD - self.jaw_RU) / self.length
506
- self._cos_yR = np.sqrt(1 - self._sin_yR**2)
507
- self._tan_yR = self._sin_yR / self._cos_yR
566
+ if self.length > 0:
567
+ self._sin_yR = (self._jaw_RD - self._jaw_RU) / self.length
568
+ self._cos_yR = np.sqrt(1 - self._sin_yR**2)
569
+ self._tan_yR = self._sin_yR / self._cos_yR
570
+ else:
571
+ self._sin_yR = 0.
572
+ self._cos_yR = 1.
573
+ self._tan_yR = 0.
508
574
 
509
575
  def _update_gaps(self, only_L=False, only_R=False):
510
576
  # If we had set a value for the gap manually, this needs to be updated
@@ -544,7 +610,7 @@ class BaseCollimator(BaseBlock):
544
610
  self.tilt_L = val[0]
545
611
  self.tilt_R = val[1]
546
612
  else:
547
- raise ValueError
613
+ raise ValueError(f"The attribute `tilt` should be of the form LR or [L, R] ")
548
614
 
549
615
  @property
550
616
  def tilt_L(self):
@@ -820,9 +886,7 @@ class BaseCollimator(BaseBlock):
820
886
  if self.side != 'right':
821
887
  if self.optics_ready() and self.jaw_L is not None:
822
888
  return round((self.jaw_L - self.co[0][0])/self.sigma[0][0], 6)
823
- elif not self._gap_L_set_manually():
824
- return None
825
- else:
889
+ elif self._gap_L_set_manually():
826
890
  return self._gap_L
827
891
 
828
892
  @gap_L.setter
@@ -840,9 +904,7 @@ class BaseCollimator(BaseBlock):
840
904
  if self.side != 'left':
841
905
  if self.optics_ready() and self.jaw_R is not None:
842
906
  return round((self.jaw_R - self.co[0][1])/self.sigma[0][1], 6)
843
- elif not self._gap_R_set_manually():
844
- return None
845
- else:
907
+ elif self._gap_R_set_manually():
846
908
  return self._gap_R
847
909
 
848
910
  @gap_R.setter
@@ -995,7 +1057,8 @@ class BaseCollimator(BaseBlock):
995
1057
  assert np.isclose(self._sin_yR/self._cos_yR, self._tan_yR)
996
1058
 
997
1059
  # Verify bools
998
- assert self._side in [-1, 1, 0]
1060
+ if '_side' in self._xofields: # Not the case e.g. for FlukaCollimator
1061
+ assert self._side in [-1, 1, 0]
999
1062
  assert isinstance(self._jaws_parallel, bool) or self._jaws_parallel in [0, 1]
1000
1063
 
1001
1064
  def jaw_func(self, pos):
@@ -1039,20 +1102,25 @@ class BaseCrystal(BaseBlock):
1039
1102
  # Crystal specific
1040
1103
  '_bending_radius': xo.Float64,
1041
1104
  '_bending_angle': xo.Float64,
1042
- 'width': xo.Float64,
1043
- 'height': xo.Float64
1105
+ '_width': xo.Float64,
1106
+ '_height': xo.Float64
1044
1107
  # 'thick': xo.Float64
1045
1108
  }
1046
1109
 
1047
- isthick = BaseBlock.isthick
1048
- allow_track = BaseBlock.allow_track
1049
- behaves_like_drift = BaseBlock.behaves_like_drift
1050
- skip_in_loss_location_refinement = BaseBlock.skip_in_loss_location_refinement
1110
+
1111
+ isthick = True
1112
+ needs_rng = False
1113
+ allow_track = False
1051
1114
  allow_double_sided = False
1115
+ behaves_like_drift = True
1116
+ allow_rot_and_shift = False
1117
+ allow_loss_refinement = True
1118
+ skip_in_loss_location_refinement = True
1052
1119
 
1120
+ _noexpr_fields = {'align', 'side', 'name'}
1053
1121
  _skip_in_to_dict = [*BaseBlock._skip_in_to_dict, *[f for f in _xofields if f.startswith('_')]]
1054
- _store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance',
1055
- 'bending_radius', 'bending_angle']
1122
+ _store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap', 'side', 'align',
1123
+ 'emittance', 'width', 'height', 'bending_radius', 'bending_angle']
1056
1124
 
1057
1125
  _depends_on = [BaseCollimator]
1058
1126
 
@@ -1060,7 +1128,7 @@ class BaseCrystal(BaseBlock):
1060
1128
 
1061
1129
  # This is an abstract class and cannot be instantiated
1062
1130
  def __new__(cls, *args, **kwargs):
1063
- if cls == BaseCrystal:
1131
+ if cls is BaseCrystal:
1064
1132
  raise Exception("Abstract class `BaseCrystal` cannot be instantiated!")
1065
1133
  instance = super().__new__(cls)
1066
1134
  return instance
@@ -1110,13 +1178,15 @@ class BaseCrystal(BaseBlock):
1110
1178
  kwargs.setdefault('_gap', OPEN_GAP)
1111
1179
 
1112
1180
  # Set tilt
1113
- if 'jaw_D' not in kwargs:
1114
- to_assign['tilt'] = kwargs.pop('tilt', 0)
1181
+ if 'tilt' in kwargs:
1182
+ to_assign['tilt'] = kwargs.pop('tilt')
1115
1183
 
1116
1184
  # Set others
1117
1185
  to_assign['align'] = kwargs.pop('align', 'upstream')
1118
1186
  to_assign['emittance'] = kwargs.pop('emittance', None)
1119
1187
  kwargs.setdefault('active', True)
1188
+ kwargs.setdefault('_sin_y', 0)
1189
+ kwargs.setdefault('_cos_y', 1)
1120
1190
 
1121
1191
  # Set crystal specific
1122
1192
  if 'bending_angle' in kwargs:
@@ -1125,10 +1195,10 @@ class BaseCrystal(BaseBlock):
1125
1195
  to_assign['bending_angle'] = kwargs.pop('bending_angle')
1126
1196
  else:
1127
1197
  to_assign['bending_radius'] = kwargs.pop('bending_radius', 1)
1128
- kwargs.setdefault('width', 0)
1129
- kwargs.setdefault('height', 0)
1198
+ to_assign['width'] = kwargs.pop('width', 1)
1199
+ to_assign['height'] = kwargs.pop('height', 1)
1130
1200
 
1131
- xt.BeamElement.__init__(self, **kwargs)
1201
+ super().__init__(**kwargs)
1132
1202
  # Careful: non-xofields are not passed correctly between copy's / to_dict. This messes with flags etc..
1133
1203
  # We also have to manually initialise them for xobject generation
1134
1204
  if not hasattr(self, '_optics'):
@@ -1140,7 +1210,7 @@ class BaseCrystal(BaseBlock):
1140
1210
  self._jaw_U *= -1
1141
1211
  if np.isclose(self._gap, OPEN_GAP):
1142
1212
  self._gap *= -1
1143
- self._verify_consistency()
1213
+ BaseCrystal._verify_consistency(self)
1144
1214
 
1145
1215
 
1146
1216
  # Main crystal angle
@@ -1167,15 +1237,20 @@ class BaseCrystal(BaseBlock):
1167
1237
  @jaw.setter
1168
1238
  def jaw(self, val):
1169
1239
  if val is None:
1170
- val = self._side*OPEN_JAW
1240
+ if self.side == 'left':
1241
+ val = OPEN_JAW
1242
+ elif self.side == 'right':
1243
+ val = -OPEN_JAW
1244
+ else:
1245
+ raise ValueError("Cannot determine side. Something is wrong with the collimator!")
1171
1246
  self.jaw_U = val
1172
1247
 
1173
1248
  @property
1174
1249
  def jaw_U(self):
1175
- if not np.isclose(self._jaw_U, self._side*OPEN_JAW, atol=1.e-10): # open position
1250
+ if not np.isclose(abs(self._jaw_U), OPEN_JAW, atol=1.e-10): # open position
1176
1251
  return self._jaw_U
1177
1252
 
1178
- @jaw_U.setter # This moves both jaw_LU and jaw_LD in parallel
1253
+ @jaw_U.setter
1179
1254
  def jaw_U(self, val):
1180
1255
  if val is None:
1181
1256
  raise ValueError("Cannot set corner to None! Use open_jaws() or set jaw to None.")
@@ -1184,15 +1259,16 @@ class BaseCrystal(BaseBlock):
1184
1259
 
1185
1260
  @property
1186
1261
  def jaw_D(self):
1187
- if not np.isclose(self._jaw_U, self._side*OPEN_JAW, atol=1.e-10): # open position
1262
+ if not np.isclose(abs(self._jaw_U), OPEN_JAW, atol=1.e-10): # open position
1188
1263
  length = self.length
1189
- if self._side*self.bending_radius < 0:
1264
+ if (self.side == 'left' and self.bending_radius < 0) \
1265
+ or (self.side == 'right' and self.bending_radius > 0):
1190
1266
  # Correction for inner corner point
1191
1267
  length -= self.width*np.sin(abs(self._bending_angle))
1192
1268
  shift = np.tan(self._bending_angle/2)*self._cos_y + self._sin_y
1193
1269
  return self._jaw_U + length*shift
1194
1270
 
1195
- @jaw_D.setter # This moves both jaw_LU and jaw_LD in parallel
1271
+ @jaw_D.setter
1196
1272
  def jaw_D(self, val):
1197
1273
  if val is None:
1198
1274
  self.tilt = 0
@@ -1381,6 +1457,26 @@ class BaseCrystal(BaseBlock):
1381
1457
  self._bending_angle = bending_angle
1382
1458
  self._bending_radius = self.length / np.sin(bending_angle)
1383
1459
 
1460
+ @property
1461
+ def width(self):
1462
+ return self._width
1463
+
1464
+ @width.setter
1465
+ def width(self, val):
1466
+ if val <= 0:
1467
+ raise ValueError(f"The field `width` should be positive, but got {val}.")
1468
+ self._width = val
1469
+
1470
+ @property
1471
+ def height(self):
1472
+ return self._height
1473
+
1474
+ @height.setter
1475
+ def height(self, val):
1476
+ if val <= 0:
1477
+ raise ValueError(f"The field `height` should be positive, but got {val}.")
1478
+ self._height = val
1479
+
1384
1480
  @property
1385
1481
  def side(self):
1386
1482
  return BaseCollimator.side.fget(self)
@@ -1412,7 +1508,11 @@ class BaseCrystal(BaseBlock):
1412
1508
  assert np.isclose(ang, abs(np.arcsin(self._sin_y)))
1413
1509
  assert np.isclose(self._sin_y/self._cos_y, self._tan_y)
1414
1510
  # Verify bools
1415
- assert self._side in [-1, 1]
1511
+ if '_side' in self._xofields:
1512
+ assert self._side in [-1, 0, 1]
1416
1513
  # Crystal specific
1417
- assert np.isclose(self._bending_angle, np.arcsin(self.length/self._bending_radius))
1514
+ if '_bending_radius' in self._xofields and '_bending_angle' in self._xofields:
1515
+ assert isinstance(self._bending_radius, float) and not np.isclose(self._bending_radius, 0)
1516
+ assert isinstance(self._bending_angle, float) and abs(self._bending_angle) <= np.pi/2
1517
+ assert np.isclose(self._bending_angle, np.arcsin(self.length/self._bending_radius))
1418
1518
 
@@ -31,6 +31,7 @@ class BlowUp(InvalidXcoll):
31
31
  skip_in_loss_location_refinement = True
32
32
  allow_loss_refinement = False
33
33
 
34
+ _noexpr_fields = {'plane', 'name', 'line'}
34
35
  _skip_in_to_dict = ['_max_kick', '_plane', '_calibration', '_active']
35
36
  _store_in_to_dict = ['amplitude', 'plane', 'calibration']
36
37