xcoll 0.4.0__py3-none-any.whl → 0.5.1__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.
- xcoll/__init__.py +2 -1
- xcoll/beam_elements/__init__.py +9 -2
- xcoll/beam_elements/absorber.py +2 -2
- xcoll/beam_elements/base.py +105 -67
- xcoll/beam_elements/blowup.py +198 -0
- xcoll/beam_elements/{collimators_src → elements_src}/black_absorber.h +21 -3
- xcoll/beam_elements/{collimators_src → elements_src}/black_crystal.h +20 -2
- xcoll/beam_elements/elements_src/blowup.h +42 -0
- xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
- xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +19 -2
- xcoll/beam_elements/{collimators_src → elements_src}/everest_collimator.h +19 -3
- xcoll/beam_elements/{collimators_src → elements_src}/everest_crystal.h +30 -9
- xcoll/beam_elements/everest.py +5 -6
- xcoll/beam_elements/monitor.py +428 -0
- xcoll/colldb.py +103 -74
- xcoll/general.py +4 -4
- xcoll/initial_distribution.py +18 -6
- xcoll/install.py +3 -1
- xcoll/interaction_record/interaction_record.py +127 -81
- xcoll/interaction_record/interaction_record_src/interaction_record.h +43 -43
- xcoll/line_tools.py +8 -9
- xcoll/lossmap.py +48 -38
- xcoll/scattering_routines/everest/amorphous.h +4 -11
- xcoll/scattering_routines/everest/channeling.h +3 -8
- xcoll/scattering_routines/everest/everest.h +4 -1
- xcoll/scattering_routines/everest/jaw.h +4 -3
- xcoll/scattering_routines/everest/materials.py +35 -15
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
- xcoll/scattering_routines/everest/nuclear_interaction.h +1 -1
- xcoll/scattering_routines/everest/properties.h +6 -1
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
- xcoll/scattering_routines/geant4/collimasim/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
- xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
- xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
- xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
- xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
- xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
- xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
- xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +9 -10
- xcoll/scattering_routines/geometry/crystal_geometry.h +9 -6
- {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/METADATA +1 -1
- xcoll-0.5.1.dist-info/RECORD +413 -0
- xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
- xcoll-0.4.0.dist-info/RECORD +0 -126
- {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/LICENSE +0 -0
- {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/NOTICE +0 -0
- {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/WHEEL +0 -0
|
@@ -18,34 +18,35 @@ class InteractionRecord(xt.BeamElement):
|
|
|
18
18
|
'_index': xt.RecordIndex,
|
|
19
19
|
'at_element': xo.Int64[:],
|
|
20
20
|
'at_turn': xo.Int64[:],
|
|
21
|
-
'ds': xo.Float64[:],
|
|
22
21
|
'_inter': xo.Int64[:],
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
22
|
+
'id_before': xo.Int64[:],
|
|
23
|
+
's_before': xo.Float64[:],
|
|
24
|
+
'x_before': xo.Float64[:],
|
|
25
|
+
'px_before': xo.Float64[:],
|
|
26
|
+
'y_before': xo.Float64[:],
|
|
27
|
+
'py_before': xo.Float64[:],
|
|
28
|
+
'zeta_before': xo.Float64[:],
|
|
29
|
+
'delta_before': xo.Float64[:],
|
|
30
|
+
'energy_before': xo.Float64[:],
|
|
31
|
+
'mass_before': xo.Float64[:],
|
|
32
|
+
'charge_before': xo.Int64[:],
|
|
33
|
+
'z_before': xo.Int64[:],
|
|
34
|
+
'a_before': xo.Int64[:],
|
|
35
|
+
'pdgid_before': xo.Int64[:],
|
|
36
|
+
'id_after': xo.Int64[:],
|
|
37
|
+
's_after': xo.Float64[:],
|
|
38
|
+
'x_after': xo.Float64[:],
|
|
39
|
+
'px_after': xo.Float64[:],
|
|
40
|
+
'y_after': xo.Float64[:],
|
|
41
|
+
'py_after': xo.Float64[:],
|
|
42
|
+
'zeta_after': xo.Float64[:],
|
|
43
|
+
'delta_after': xo.Float64[:],
|
|
44
|
+
'energy_after': xo.Float64[:],
|
|
45
|
+
'mass_after': xo.Float64[:],
|
|
46
|
+
'charge_after': xo.Int64[:],
|
|
47
|
+
'z_after': xo.Int64[:],
|
|
48
|
+
'a_after': xo.Int64[:],
|
|
49
|
+
'pdgid_after': xo.Int64[:],
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
allow_track = False
|
|
@@ -58,45 +59,69 @@ class InteractionRecord(xt.BeamElement):
|
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
@classmethod
|
|
61
|
-
def start(cls, line
|
|
62
|
-
|
|
62
|
+
def start(cls, *, line=None, elements=None, names=None, record_impacts=None, record_exits=None,
|
|
63
|
+
record_scatterings=None, capacity=1e6, io_buffer=None, coll_ids=None):
|
|
64
|
+
elements, names = _get_xcoll_elements(line, elements, names)
|
|
63
65
|
if len(names) == 0:
|
|
64
66
|
return
|
|
65
|
-
elements = [line[name] for name in names]
|
|
66
67
|
capacity = int(capacity)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
|
|
69
|
+
if getattr(line, 'tracker', None) is None \
|
|
70
|
+
or getattr(line.tracker, 'io_buffer', None) is None:
|
|
71
|
+
if io_buffer is None:
|
|
72
|
+
io_buffer = xt.new_io_buffer(capacity=capacity)
|
|
73
|
+
elif io_buffer is not None:
|
|
74
|
+
raise ValueError("Cannot provide io_buffer when tracker already built!")
|
|
75
|
+
else:
|
|
76
|
+
io_buffer = line.tracker.io_buffer
|
|
77
|
+
if capacity > io_buffer.capacity:
|
|
78
|
+
io_buffer.grow(capacity - io_buffer.capacity)
|
|
79
|
+
if record_impacts is None and record_scatterings is None:
|
|
80
|
+
record_impacts = True
|
|
71
81
|
record_scatterings = True
|
|
72
|
-
elif
|
|
73
|
-
|
|
82
|
+
elif record_impacts is None:
|
|
83
|
+
record_impacts = not record_scatterings
|
|
74
84
|
elif record_scatterings is None:
|
|
75
|
-
record_scatterings = not
|
|
76
|
-
|
|
85
|
+
record_scatterings = not record_impacts
|
|
86
|
+
if record_exits is None:
|
|
87
|
+
# record_exits defaults to True only if the other two are True
|
|
88
|
+
record_exits = record_impacts and record_scatterings
|
|
89
|
+
assert record_impacts is True or record_impacts is False
|
|
90
|
+
assert record_exits is True or record_exits is False
|
|
77
91
|
assert record_scatterings is True or record_scatterings is False
|
|
78
92
|
for el in elements:
|
|
79
|
-
if not el.
|
|
80
|
-
el.
|
|
93
|
+
if not el.record_impacts and not el.record_exits and not el.record_scatterings:
|
|
94
|
+
el.record_impacts = record_impacts
|
|
95
|
+
el.record_exits = record_exits
|
|
81
96
|
el.record_scatterings = record_scatterings
|
|
82
97
|
record = xt.start_internal_logging(io_buffer=io_buffer, capacity=capacity, \
|
|
83
98
|
elements=elements)
|
|
84
99
|
record._line = line
|
|
85
100
|
record._io_buffer = io_buffer
|
|
86
|
-
|
|
87
|
-
record.
|
|
88
|
-
|
|
101
|
+
recording_elements = names if len(names) > 0 else elements
|
|
102
|
+
record._recording_elements = recording_elements
|
|
103
|
+
if coll_ids is None:
|
|
104
|
+
if line is None:
|
|
105
|
+
if len(names) > 0:
|
|
106
|
+
record._coll_ids = {name: idx for idx, name in enumerate(names)}
|
|
107
|
+
else:
|
|
108
|
+
record._coll_ids = {name: line.element_names.index(name) for name in names}
|
|
109
|
+
else:
|
|
110
|
+
assert len(coll_ids) == len(names)
|
|
111
|
+
record._coll_ids = {name: idx for name, idx in zip(names, coll_ids)}
|
|
112
|
+
if hasattr(record, '_coll_ids'):
|
|
113
|
+
record._coll_names = {vv: kk for kk, vv in record._coll_ids.items()}
|
|
89
114
|
return record
|
|
90
115
|
|
|
91
|
-
def stop(self, names=
|
|
116
|
+
def stop(self, *, elements=False, names=False):
|
|
92
117
|
self.assert_class_init()
|
|
93
|
-
names = _get_xcoll_elements(self.line, names)
|
|
94
|
-
|
|
95
|
-
if self.line.tracker is not None:
|
|
118
|
+
elements, names = _get_xcoll_elements(self.line, elements, names)
|
|
119
|
+
if self.line is not None and self.line.tracker is not None:
|
|
96
120
|
self.line.tracker._check_invalidated()
|
|
97
121
|
xt.stop_internal_logging(elements=elements)
|
|
98
122
|
# Removed the stopped collimators from list of logged elements
|
|
99
|
-
|
|
123
|
+
stopping_elements = names if len(names) > 0 else elements
|
|
124
|
+
self._recording_elements = list(set(self._recording_elements) - set(stopping_elements))
|
|
100
125
|
|
|
101
126
|
|
|
102
127
|
def assert_class_init(self):
|
|
@@ -145,10 +170,10 @@ class InteractionRecord(xt.BeamElement):
|
|
|
145
170
|
val = []
|
|
146
171
|
record_start = _get_xcoll_elements(self.line, val)
|
|
147
172
|
self.stop(set(self.recording_elements) - set(record_start))
|
|
148
|
-
elements = [line[name] for name in record_start]
|
|
149
|
-
for el in elements:
|
|
150
|
-
if not el.
|
|
151
|
-
el.
|
|
173
|
+
elements = [self.line[name] for name in record_start]
|
|
174
|
+
for el in elements: # TODO: this should be smarter
|
|
175
|
+
if not el.record_impacts and not el.record_scatterings:
|
|
176
|
+
el.record_impacts = True
|
|
152
177
|
el.record_scatterings = True
|
|
153
178
|
xt.start_internal_logging(io_buffer=self.io_buffer, capacity=self.capacity, \
|
|
154
179
|
record=self, elements=elements)
|
|
@@ -172,25 +197,29 @@ class InteractionRecord(xt.BeamElement):
|
|
|
172
197
|
|
|
173
198
|
def _collimator_id(self, element_name):
|
|
174
199
|
if not hasattr(self, '_coll_ids'):
|
|
175
|
-
return
|
|
200
|
+
return element_name
|
|
176
201
|
elif element_name not in self._coll_ids:
|
|
177
202
|
raise ValueError(f"Element {element_name} not found in list of collimators of this record table! "
|
|
178
203
|
+ f"Did the line change without updating the list in the table?")
|
|
179
204
|
else:
|
|
180
205
|
return self._coll_ids[element_name]
|
|
181
206
|
|
|
182
|
-
def to_pandas(self):
|
|
207
|
+
def to_pandas(self, frame=None):
|
|
208
|
+
if frame is None:
|
|
209
|
+
frame = 'jaw'
|
|
210
|
+
frame = frame.lower()
|
|
211
|
+
if frame not in ['jaw', 'collimator', 'lab']:
|
|
212
|
+
raise ValueError(f"Invalid frame {frame}. Must be 'jaw', 'collimator', or 'lab'!")
|
|
183
213
|
n_rows = self._index.num_recorded
|
|
184
214
|
coll_header = 'collimator' if hasattr(self, '_coll_names') else 'collimator_id'
|
|
185
215
|
df = pd.DataFrame({
|
|
186
216
|
'turn': self.at_turn[:n_rows],
|
|
187
217
|
coll_header: [self._collimator_name(element_id) for element_id in self.at_element[:n_rows]],
|
|
188
218
|
'interaction_type': [interactions[inter] for inter in self._inter[:n_rows]],
|
|
189
|
-
'ds': self.ds[:n_rows],
|
|
190
219
|
**{
|
|
191
|
-
f'{
|
|
192
|
-
for p in ['
|
|
193
|
-
for val in ['id', 'x', 'px', 'y', 'py', 'zeta', 'delta', 'energy', 'mass', 'charge', 'z', 'a', 'pdgid']
|
|
220
|
+
f'{val}_{p}': getattr(self, f'{val}_{p}')[:n_rows]
|
|
221
|
+
for p in ['before', 'after']
|
|
222
|
+
for val in ['id', 's', 'x', 'px', 'y', 'py', 'zeta', 'delta', 'energy', 'mass', 'charge', 'z', 'a', 'pdgid']
|
|
194
223
|
}
|
|
195
224
|
})
|
|
196
225
|
return df
|
|
@@ -207,46 +236,63 @@ class InteractionRecord(xt.BeamElement):
|
|
|
207
236
|
mask = mask & (self.at_turn == turn)
|
|
208
237
|
df = pd.DataFrame({
|
|
209
238
|
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
210
|
-
'pid': self.
|
|
239
|
+
'pid': self.id_before[mask]
|
|
211
240
|
})
|
|
212
241
|
return df.groupby('pid', sort=False)['int'].agg(list)
|
|
213
242
|
else:
|
|
214
243
|
df = pd.DataFrame({
|
|
215
244
|
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
216
245
|
'turn': self.at_turn[mask],
|
|
217
|
-
'pid': self.
|
|
246
|
+
'pid': self.id_before[mask]
|
|
218
247
|
})
|
|
219
248
|
return df.groupby(['pid', 'turn'], sort=False)['int'].apply(list)
|
|
220
249
|
|
|
221
|
-
def first_touch_per_turn(self):
|
|
250
|
+
def first_touch_per_turn(self, frame=None):
|
|
222
251
|
n_rows = self._index.num_recorded
|
|
223
|
-
df = pd.DataFrame({'
|
|
252
|
+
df = pd.DataFrame({'id_before': self.id_before[:n_rows],
|
|
224
253
|
'at_turn': self.at_turn[:n_rows],
|
|
225
254
|
'at_element': self.at_element[:n_rows]})
|
|
226
255
|
mask = np.char.startswith(self.interaction_type[:n_rows], 'Enter Jaw')
|
|
227
|
-
idx_first = [group.at_element.idxmin() for _, group in df[mask].groupby(['at_turn', '
|
|
228
|
-
df_first = self.to_pandas().loc[idx_first]
|
|
256
|
+
idx_first = [group.at_element.idxmin() for _, group in df[mask].groupby(['at_turn', 'id_before'], sort=False)]
|
|
257
|
+
df_first = self.to_pandas(frame=frame).loc[idx_first]
|
|
229
258
|
df_first.insert(2, "jaw", df_first.interaction_type.astype(str).str[-1])
|
|
230
|
-
to_drop = ['
|
|
231
|
-
*[col for col in df_first.columns if col.
|
|
232
|
-
to_rename = {col: col.replace('
|
|
259
|
+
to_drop = ['interaction_type',
|
|
260
|
+
*[col for col in df_first.columns if col.endswith('_after')]]
|
|
261
|
+
to_rename = {col: col.replace('_before', '') for col in df_first.columns if col.endswith('before')}
|
|
262
|
+
to_rename['id_before'] = 'pid'
|
|
233
263
|
return df_first.drop(columns=to_drop).rename(columns=to_rename)
|
|
234
264
|
|
|
235
265
|
|
|
236
|
-
def _get_xcoll_elements(line, names):
|
|
237
|
-
from xcoll import
|
|
238
|
-
if names is None
|
|
239
|
-
|
|
240
|
-
if len(names) == 0:
|
|
241
|
-
raise ValueError("No Xcoll elements in line!")
|
|
242
|
-
if names is False:
|
|
243
|
-
names = []
|
|
244
|
-
if not hasattr(names, '__iter__') or isinstance(names, str):
|
|
266
|
+
def _get_xcoll_elements(line=None, elements=None, names=None):
|
|
267
|
+
from xcoll.beam_elements import block_classes
|
|
268
|
+
if names is not None and names is not False and \
|
|
269
|
+
(not hasattr(names, '__iter__') or isinstance(names, str)):
|
|
245
270
|
names = [names]
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
271
|
+
if elements is not None and elements is not False and \
|
|
272
|
+
(not hasattr(elements, '__iter__') or isinstance(elements, str)):
|
|
273
|
+
elements = [elements]
|
|
274
|
+
if line is None:
|
|
275
|
+
if elements is None:
|
|
276
|
+
raise ValueError("No line nor elements provided!")
|
|
277
|
+
else:
|
|
278
|
+
if elements is not None and elements is not False:
|
|
279
|
+
raise ValueError("Cannot provide both line and elements!")
|
|
280
|
+
if names is None or names is True:
|
|
281
|
+
elements, names = line.get_elements_of_type(block_classes)
|
|
282
|
+
if len(names) == 0:
|
|
283
|
+
raise ValueError("No Xcoll elements in line!")
|
|
284
|
+
elif names is False:
|
|
285
|
+
names = []
|
|
286
|
+
elements = []
|
|
287
|
+
else:
|
|
288
|
+
assert elements is not False
|
|
289
|
+
for name in names:
|
|
290
|
+
if name not in line.element_names:
|
|
291
|
+
raise ValueError(f"Element {name} not found in line!")
|
|
292
|
+
elements = [line[name] for name in names]
|
|
293
|
+
for idx, element in enumerate(elements):
|
|
294
|
+
if not isinstance(element, block_classes):
|
|
295
|
+
name = name[idx] if names is not None else element.__class__.__name__
|
|
250
296
|
raise ValueError(f"Element {name} not an Xcoll element!")
|
|
251
|
-
return names
|
|
297
|
+
return elements, names
|
|
252
298
|
|
|
@@ -24,7 +24,6 @@ int64_t InteractionRecordData_log(InteractionRecordData record, RecordIndex reco
|
|
|
24
24
|
if (i_slot>=0){
|
|
25
25
|
InteractionRecordData_set_at_element(record, i_slot, LocalParticle_get_at_element(parent));
|
|
26
26
|
InteractionRecordData_set_at_turn(record, i_slot, LocalParticle_get_at_turn(parent));
|
|
27
|
-
InteractionRecordData_set_ds(record, i_slot, 0);
|
|
28
27
|
InteractionRecordData_set__inter(record, i_slot, interaction);
|
|
29
28
|
|
|
30
29
|
double charge_ratio = LocalParticle_get_charge_ratio(parent);
|
|
@@ -33,35 +32,37 @@ int64_t InteractionRecordData_log(InteractionRecordData record, RecordIndex reco
|
|
|
33
32
|
) * mass_ratio * LocalParticle_get_p0c(parent);
|
|
34
33
|
// All fields have to be written, or the arrays will not have the same length
|
|
35
34
|
// TODO: maybe this is not true, as we are setting by slot index? Don't the arrays come pre-initialised?
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
InteractionRecordData_set_id_before(record, i_slot, LocalParticle_get_particle_id(parent));
|
|
36
|
+
InteractionRecordData_set_s_before(record, i_slot, LocalParticle_get_s(parent));
|
|
37
|
+
InteractionRecordData_set_x_before(record, i_slot, LocalParticle_get_x(parent));
|
|
38
|
+
InteractionRecordData_set_px_before(record, i_slot, LocalParticle_get_px(parent));
|
|
39
|
+
InteractionRecordData_set_y_before(record, i_slot, LocalParticle_get_y(parent));
|
|
40
|
+
InteractionRecordData_set_py_before(record, i_slot, LocalParticle_get_py(parent));
|
|
41
|
+
InteractionRecordData_set_zeta_before(record, i_slot, LocalParticle_get_zeta(parent));
|
|
42
|
+
InteractionRecordData_set_delta_before(record, i_slot, LocalParticle_get_delta(parent));
|
|
43
|
+
InteractionRecordData_set_energy_before(record, i_slot, energy);
|
|
44
|
+
InteractionRecordData_set_mass_before(record, i_slot, mass_ratio*LocalParticle_get_mass0(parent));
|
|
45
|
+
InteractionRecordData_set_charge_before(record, i_slot, charge_ratio*LocalParticle_get_q0(parent));
|
|
46
46
|
// TODO: particle info
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
InteractionRecordData_set_z_before(record, i_slot, -1);
|
|
48
|
+
InteractionRecordData_set_a_before(record, i_slot, -1);
|
|
49
|
+
InteractionRecordData_set_pdgid_before(record, i_slot, -1);
|
|
50
50
|
|
|
51
51
|
// TODO: maybe this is not needed
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
InteractionRecordData_set_id_after(record, i_slot, -1);
|
|
53
|
+
InteractionRecordData_set_s_after(record, i_slot, -1);
|
|
54
|
+
InteractionRecordData_set_x_after(record, i_slot, -1);
|
|
55
|
+
InteractionRecordData_set_px_after(record, i_slot, -1);
|
|
56
|
+
InteractionRecordData_set_y_after(record, i_slot, -1);
|
|
57
|
+
InteractionRecordData_set_py_after(record, i_slot, -1);
|
|
58
|
+
InteractionRecordData_set_zeta_after(record, i_slot, -1);
|
|
59
|
+
InteractionRecordData_set_delta_after(record, i_slot, -1);
|
|
60
|
+
InteractionRecordData_set_energy_after(record, i_slot, -1);
|
|
61
|
+
InteractionRecordData_set_mass_after(record, i_slot, -1);
|
|
62
|
+
InteractionRecordData_set_charge_after(record, i_slot, -1);
|
|
63
|
+
InteractionRecordData_set_z_after(record, i_slot, -1);
|
|
64
|
+
InteractionRecordData_set_a_after(record, i_slot, -1);
|
|
65
|
+
InteractionRecordData_set_pdgid_after(record, i_slot, -1);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
// printf("Logging %i in slot %i\n", interaction, i_slot);
|
|
@@ -69,28 +70,27 @@ int64_t InteractionRecordData_log(InteractionRecordData record, RecordIndex reco
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/*gpufun*/
|
|
72
|
-
void InteractionRecordData_log_child(InteractionRecordData record, int64_t i_slot, LocalParticle* child
|
|
73
|
+
void InteractionRecordData_log_child(InteractionRecordData record, int64_t i_slot, LocalParticle* child){
|
|
73
74
|
if (record && i_slot>=0){
|
|
74
|
-
InteractionRecordData_set_ds(record, i_slot, ds);
|
|
75
|
-
|
|
76
75
|
double charge_ratio = LocalParticle_get_charge_ratio(child);
|
|
77
76
|
double mass_ratio = charge_ratio / LocalParticle_get_chi(child);
|
|
78
77
|
double energy = ( LocalParticle_get_ptau(child) + 1 / LocalParticle_get_beta0(child)
|
|
79
78
|
) * mass_ratio * LocalParticle_get_p0c(child);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
InteractionRecordData_set_id_after(record, i_slot, LocalParticle_get_particle_id(child));
|
|
80
|
+
InteractionRecordData_set_s_after(record, i_slot, LocalParticle_get_s(child));
|
|
81
|
+
InteractionRecordData_set_x_after(record, i_slot, LocalParticle_get_x(child));
|
|
82
|
+
InteractionRecordData_set_px_after(record, i_slot, LocalParticle_get_px(child));
|
|
83
|
+
InteractionRecordData_set_y_after(record, i_slot, LocalParticle_get_y(child));
|
|
84
|
+
InteractionRecordData_set_py_after(record, i_slot, LocalParticle_get_py(child));
|
|
85
|
+
InteractionRecordData_set_zeta_after(record, i_slot, LocalParticle_get_zeta(child));
|
|
86
|
+
InteractionRecordData_set_delta_after(record, i_slot, LocalParticle_get_delta(child));
|
|
87
|
+
InteractionRecordData_set_energy_after(record, i_slot, energy);
|
|
88
|
+
InteractionRecordData_set_mass_after(record, i_slot, mass_ratio*LocalParticle_get_mass0(child));
|
|
89
|
+
InteractionRecordData_set_charge_after(record, i_slot, charge_ratio*LocalParticle_get_q0(child));
|
|
90
90
|
// TODO: particle info
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
InteractionRecordData_set_z_after(record, i_slot, -1);
|
|
92
|
+
InteractionRecordData_set_a_after(record, i_slot, -1);
|
|
93
|
+
InteractionRecordData_set_pdgid_after(record, i_slot, -1);
|
|
94
94
|
// printf("Slot %i: length %f\n", i_slot, ds);
|
|
95
95
|
}
|
|
96
96
|
}
|
xcoll/line_tools.py
CHANGED
|
@@ -6,17 +6,16 @@
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import xtrack as xt
|
|
8
8
|
|
|
9
|
-
from .beam_elements import element_classes,
|
|
9
|
+
from .beam_elements import element_classes, _all_collimator_classes
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def assign_optics_to_collimators(line, nemitt_x=None, nemitt_y=None, twiss=None):
|
|
13
13
|
if not line._has_valid_tracker():
|
|
14
14
|
raise Exception("Please build tracker before setting the openings!")
|
|
15
|
-
names = line.get_elements_of_type(
|
|
15
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
16
16
|
tw_upstream, tw_downstream = get_optics_at(names, twiss=twiss, line=line)
|
|
17
17
|
beta_gamma_rel = line.particle_ref._xobject.gamma0[0]*line.particle_ref._xobject.beta0[0]
|
|
18
18
|
for coll in names:
|
|
19
|
-
print(coll)
|
|
20
19
|
line[coll].assign_optics(name=coll, nemitt_x=nemitt_x, nemitt_y=nemitt_x, twiss_upstream=tw_upstream,
|
|
21
20
|
twiss_downstream=tw_downstream, beta_gamma_rel=beta_gamma_rel)
|
|
22
21
|
|
|
@@ -36,7 +35,7 @@ def get_optics_at(names, *, twiss=None, line=None):
|
|
|
36
35
|
|
|
37
36
|
def open_collimators(line, names=None):
|
|
38
37
|
if names is None:
|
|
39
|
-
names = line.get_elements_of_type(
|
|
38
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
40
39
|
if len(names) == 0:
|
|
41
40
|
print("No collimators found in line.")
|
|
42
41
|
else:
|
|
@@ -46,7 +45,7 @@ def open_collimators(line, names=None):
|
|
|
46
45
|
|
|
47
46
|
def send_to_parking(line, names=None):
|
|
48
47
|
if names is None:
|
|
49
|
-
names = line.get_elements_of_type(
|
|
48
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
50
49
|
if len(names) == 0:
|
|
51
50
|
print("No collimators found in line.")
|
|
52
51
|
else:
|
|
@@ -70,9 +69,8 @@ def enable_scattering(line):
|
|
|
70
69
|
or not np.isclose(el.nemitt_x, nemitt_x):
|
|
71
70
|
raise ValueError("Not all collimators have the same "
|
|
72
71
|
+ "emittance. This is not supported.")
|
|
73
|
-
el
|
|
74
|
-
|
|
75
|
-
# self._set_record_interaction_record()
|
|
72
|
+
if hasattr(el, 'enable_scattering'):
|
|
73
|
+
el.enable_scattering()
|
|
76
74
|
|
|
77
75
|
def disable_scattering(line):
|
|
78
76
|
elements = line.get_elements_of_type(element_classes)[0]
|
|
@@ -80,4 +78,5 @@ def disable_scattering(line):
|
|
|
80
78
|
print("No xcoll elements found in line.")
|
|
81
79
|
else:
|
|
82
80
|
for el in elements:
|
|
83
|
-
el
|
|
81
|
+
if hasattr(el, 'disable_scattering'):
|
|
82
|
+
el.disable_scattering()
|
xcoll/lossmap.py
CHANGED
|
@@ -12,13 +12,13 @@ import xtrack as xt
|
|
|
12
12
|
import xpart as xp
|
|
13
13
|
import xobjects as xo
|
|
14
14
|
|
|
15
|
-
from .beam_elements import
|
|
15
|
+
from .beam_elements import _all_collimator_classes, _all_crystal_classes
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class LossMap:
|
|
19
19
|
|
|
20
20
|
def __init__(self, line, part, *, line_is_reversed, interpolation=0.1,
|
|
21
|
-
weights=None, weight_function=None):
|
|
21
|
+
weights=None, weight_function=None, verbose=True):
|
|
22
22
|
self._line = line
|
|
23
23
|
self._line_is_reversed = line_is_reversed
|
|
24
24
|
self._machine_length = line.get_length()
|
|
@@ -34,26 +34,31 @@ class LossMap:
|
|
|
34
34
|
raise ValueError("Use either 'weights' or 'weight_function', not both!")
|
|
35
35
|
self._weights = part.sort(interleave_lost_particles=True)
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# Correct particles that are lost in aperture directly after collimator -> should be absorbed
|
|
38
|
+
self._correct_absorbed(verbose=verbose)
|
|
39
|
+
|
|
40
|
+
# Loss location refinement
|
|
38
41
|
if interpolation is not None:
|
|
39
42
|
self._interpolate()
|
|
40
43
|
|
|
41
44
|
self._make_coll_summary()
|
|
42
45
|
coll_summary = self._summary[self._summary.nabs > 0].to_dict('list')
|
|
43
|
-
aper_s, aper_names, aper_nabs = self._get_aperture_losses()
|
|
46
|
+
aper_s, aper_names, aper_nabs, aper_energy = self._get_aperture_losses()
|
|
44
47
|
|
|
45
48
|
self._lossmap = {
|
|
46
49
|
'collimator': {
|
|
47
50
|
's': coll_summary['s'],
|
|
48
51
|
'name': coll_summary['collname'],
|
|
49
52
|
'length': coll_summary['length'],
|
|
50
|
-
'n': coll_summary['nabs']
|
|
53
|
+
'n': coll_summary['nabs'],
|
|
54
|
+
# 'e': coll_summary['energy']
|
|
51
55
|
}
|
|
52
56
|
,
|
|
53
57
|
'aperture': {
|
|
54
58
|
's': aper_s,
|
|
55
59
|
'name': aper_names,
|
|
56
|
-
'n': aper_nabs
|
|
60
|
+
'n': aper_nabs,
|
|
61
|
+
# 'e': aper_energy
|
|
57
62
|
}
|
|
58
63
|
,
|
|
59
64
|
'machine_length': self._machine_length
|
|
@@ -106,35 +111,37 @@ class LossMap:
|
|
|
106
111
|
return self._weights
|
|
107
112
|
|
|
108
113
|
|
|
109
|
-
def
|
|
110
|
-
new_state = self._part.state.copy()
|
|
111
|
-
new_elem = self._part.at_element.copy()
|
|
112
|
-
|
|
114
|
+
def _correct_absorbed(self, verbose=True):
|
|
113
115
|
# Correct particles that are at an aperture directly after a collimator
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
what_type = self._line[elem-1].__class__.__name__
|
|
122
|
-
if what_type == 'EverestCollimator':
|
|
123
|
-
new_state[idx] = -331
|
|
124
|
-
elif what_type == 'EverestCrystal':
|
|
125
|
-
new_state[idx] = -332
|
|
126
|
-
elif what_type == 'FlukaCollimator':
|
|
127
|
-
new_state[idx] = -334 # TODO: what if crystal?
|
|
128
|
-
elif what_type == 'Geant4Collimator':
|
|
129
|
-
new_state[idx] = -337 # TODO: what if crystal?
|
|
130
|
-
elif what_type == 'BlackAbsorber':
|
|
131
|
-
new_state[idx] = -340
|
|
116
|
+
part = self._part
|
|
117
|
+
coll_classes = list(set(_all_collimator_classes) - set(_all_crystal_classes))
|
|
118
|
+
coll_elements = self._line.get_elements_of_type(coll_classes)[1]
|
|
119
|
+
for idx, elem in enumerate(part.at_element):
|
|
120
|
+
if part.state[idx] == 0:
|
|
121
|
+
if elem == 0:
|
|
122
|
+
prev_elem = len(self._line.element_names) - 1
|
|
132
123
|
else:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
124
|
+
prev_elem = elem - 1
|
|
125
|
+
if self._line.element_names[prev_elem] in coll_elements:
|
|
126
|
+
if verbose:
|
|
127
|
+
print(f"Found at {self._line.element_names[elem]}, "
|
|
128
|
+
+ f"moved to {self._line.element_names[elem-1]}")
|
|
129
|
+
part.at_element[idx] = elem - 1
|
|
130
|
+
what_type = self._line[elem-1].__class__.__name__
|
|
131
|
+
if what_type == 'EverestCollimator':
|
|
132
|
+
part.state[idx] = -331
|
|
133
|
+
elif what_type == 'EverestCrystal':
|
|
134
|
+
part.state[idx] = -332
|
|
135
|
+
elif what_type == 'FlukaCollimator':
|
|
136
|
+
part.state[idx] = -334 # TODO: what if crystal?
|
|
137
|
+
elif what_type == 'Geant4Collimator':
|
|
138
|
+
part.state[idx] = -337 # TODO: what if crystal?
|
|
139
|
+
elif what_type == 'BlackAbsorber':
|
|
140
|
+
part.state[idx] = -340
|
|
141
|
+
else:
|
|
142
|
+
raise ValueError(f"Unknown collimator type {what_type}")
|
|
136
143
|
|
|
137
|
-
|
|
144
|
+
def _interpolate(self):
|
|
138
145
|
aper_s = list(self._part.s[self._part.state==0])
|
|
139
146
|
if len(aper_s) > 0:
|
|
140
147
|
print("Performing the aperture losses refinement.")
|
|
@@ -149,7 +156,7 @@ class LossMap:
|
|
|
149
156
|
|
|
150
157
|
|
|
151
158
|
def _make_coll_summary(self):
|
|
152
|
-
collimator_names = self._line.get_elements_of_type(
|
|
159
|
+
collimator_names = self._line.get_elements_of_type(_all_collimator_classes)[1]
|
|
153
160
|
coll_mask = (self._part.state <= -330) & (self._part.state >= -340)
|
|
154
161
|
coll_losses = np.array([self._line.element_names[i]
|
|
155
162
|
for i in self._part.at_element[coll_mask]])
|
|
@@ -157,7 +164,7 @@ class LossMap:
|
|
|
157
164
|
coll_pos = [(self._line.get_s_position(i) + self._line[i].length/2)
|
|
158
165
|
for i in collimator_names]
|
|
159
166
|
|
|
160
|
-
if self.
|
|
167
|
+
if self._line_is_reversed:
|
|
161
168
|
coll_pos = [self._machine_length - s for s in coll_pos]
|
|
162
169
|
|
|
163
170
|
coll_types = [self._line[i].__class__.__name__ for i in collimator_names]
|
|
@@ -165,10 +172,11 @@ class LossMap:
|
|
|
165
172
|
nabs = [coll_weights[coll_losses == j].sum() for j in collimator_names]
|
|
166
173
|
|
|
167
174
|
self._summary = pd.DataFrame({
|
|
168
|
-
'collname': collimator_names,
|
|
175
|
+
'collname': collimator_names,
|
|
169
176
|
'nabs': nabs, # of particles lost on collimators
|
|
177
|
+
# 'energy': energy,
|
|
170
178
|
'length': coll_lengths,
|
|
171
|
-
's': coll_pos,
|
|
179
|
+
's': coll_pos,
|
|
172
180
|
'type': coll_types
|
|
173
181
|
})
|
|
174
182
|
|
|
@@ -179,7 +187,7 @@ class LossMap:
|
|
|
179
187
|
aper_s = list(self._part.s[aper_mask])
|
|
180
188
|
|
|
181
189
|
if len(aper_s) == 0:
|
|
182
|
-
return [], [], []
|
|
190
|
+
return [], [], [], []
|
|
183
191
|
if self._line_is_reversed:
|
|
184
192
|
aper_s = [ self._machine_length - s for s in aper_s ]
|
|
185
193
|
|
|
@@ -193,7 +201,9 @@ class LossMap:
|
|
|
193
201
|
aper_nabs = [aper_weights[aper_s == j].sum() for j in aper_pos]
|
|
194
202
|
aper_names = [name_dict[ss] for ss in aper_pos]
|
|
195
203
|
|
|
196
|
-
|
|
204
|
+
aper_energy = 0
|
|
205
|
+
|
|
206
|
+
return aper_pos, aper_names, aper_nabs, aper_energy
|
|
197
207
|
|
|
198
208
|
|
|
199
209
|
def _create_weights_from_initial_state(part, function):
|