xcoll 0.3.6__py3-none-any.whl → 0.5.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.
- xcoll/__init__.py +13 -4
- xcoll/beam_elements/__init__.py +14 -6
- xcoll/beam_elements/absorber.py +41 -7
- xcoll/beam_elements/base.py +1202 -247
- xcoll/beam_elements/blowup.py +198 -0
- xcoll/beam_elements/elements_src/black_absorber.h +136 -0
- xcoll/beam_elements/elements_src/black_crystal.h +129 -0
- 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 +59 -30
- xcoll/beam_elements/elements_src/everest_collimator.h +237 -0
- xcoll/beam_elements/elements_src/everest_crystal.h +280 -0
- xcoll/beam_elements/everest.py +65 -119
- xcoll/beam_elements/monitor.py +428 -0
- xcoll/colldb.py +276 -747
- xcoll/general.py +5 -5
- xcoll/headers/checks.h +1 -1
- xcoll/headers/particle_states.h +2 -2
- xcoll/initial_distribution.py +207 -0
- xcoll/install.py +179 -0
- xcoll/interaction_record/__init__.py +1 -0
- xcoll/interaction_record/interaction_record.py +298 -0
- xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
- xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
- xcoll/line_tools.py +82 -0
- xcoll/lossmap.py +219 -0
- xcoll/manager.py +2 -937
- xcoll/rf_sweep.py +1 -1
- xcoll/scattering_routines/everest/amorphous.h +232 -0
- xcoll/scattering_routines/everest/channeling.h +240 -0
- xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
- xcoll/scattering_routines/everest/everest.h +11 -30
- xcoll/scattering_routines/everest/everest.py +13 -10
- xcoll/scattering_routines/everest/jaw.h +28 -197
- xcoll/scattering_routines/everest/materials.py +37 -15
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
- xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
- 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/__init__.py +6 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +218 -0
- xcoll/scattering_routines/geometry/crystal_geometry.h +153 -0
- xcoll/scattering_routines/geometry/geometry.py +26 -0
- xcoll/scattering_routines/geometry/get_s.h +92 -0
- xcoll/scattering_routines/geometry/methods.h +111 -0
- xcoll/scattering_routines/geometry/objects.h +154 -0
- xcoll/scattering_routines/geometry/rotation.h +23 -0
- xcoll/scattering_routines/geometry/segments.h +226 -0
- xcoll/scattering_routines/geometry/sort.h +184 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
- xcoll-0.5.0.dist-info/RECORD +413 -0
- xcoll/beam_elements/collimators_src/absorber.h +0 -141
- xcoll/beam_elements/collimators_src/everest_collimator.h +0 -142
- xcoll/beam_elements/collimators_src/everest_crystal.h +0 -115
- xcoll/collimator_settings.py +0 -457
- xcoll/impacts/__init__.py +0 -1
- xcoll/impacts/impacts.py +0 -102
- xcoll/impacts/impacts_src/impacts.h +0 -99
- xcoll/scattering_routines/everest/crystal.h +0 -1302
- xcoll/scattering_routines/everest/scatter.h +0 -169
- xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
- xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
- xcoll-0.3.6.dist-info/RECORD +0 -111
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
import xobjects as xo
|
|
9
|
+
import xtrack as xt
|
|
10
|
+
|
|
11
|
+
from ..general import _pkg_root
|
|
12
|
+
|
|
13
|
+
class EmittanceMonitorRecord(xo.Struct):
|
|
14
|
+
count = xo.Float64[:]
|
|
15
|
+
x_sum1 = xo.Float64[:]
|
|
16
|
+
px_sum1 = xo.Float64[:]
|
|
17
|
+
y_sum1 = xo.Float64[:]
|
|
18
|
+
py_sum1 = xo.Float64[:]
|
|
19
|
+
zeta_sum1 = xo.Float64[:]
|
|
20
|
+
pzeta_sum1 = xo.Float64[:]
|
|
21
|
+
x_x_sum2 = xo.Float64[:]
|
|
22
|
+
x_px_sum2 = xo.Float64[:]
|
|
23
|
+
x_y_sum2 = xo.Float64[:]
|
|
24
|
+
x_py_sum2 = xo.Float64[:]
|
|
25
|
+
x_zeta_sum2 = xo.Float64[:]
|
|
26
|
+
x_pzeta_sum2 = xo.Float64[:]
|
|
27
|
+
px_px_sum2 = xo.Float64[:]
|
|
28
|
+
px_y_sum2 = xo.Float64[:]
|
|
29
|
+
px_py_sum2 = xo.Float64[:]
|
|
30
|
+
px_zeta_sum2 = xo.Float64[:]
|
|
31
|
+
px_pzeta_sum2 = xo.Float64[:]
|
|
32
|
+
y_y_sum2 = xo.Float64[:]
|
|
33
|
+
y_py_sum2 = xo.Float64[:]
|
|
34
|
+
y_zeta_sum2 = xo.Float64[:]
|
|
35
|
+
y_pzeta_sum2 = xo.Float64[:]
|
|
36
|
+
py_py_sum2 = xo.Float64[:]
|
|
37
|
+
py_zeta_sum2 = xo.Float64[:]
|
|
38
|
+
py_pzeta_sum2 = xo.Float64[:]
|
|
39
|
+
zeta_zeta_sum2 = xo.Float64[:]
|
|
40
|
+
zeta_pzeta_sum2 = xo.Float64[:]
|
|
41
|
+
pzeta_pzeta_sum2 = xo.Float64[:]
|
|
42
|
+
|
|
43
|
+
class EmittanceMonitor(xt.BeamElement):
|
|
44
|
+
_xofields={
|
|
45
|
+
'part_id_start': xo.Int64,
|
|
46
|
+
'part_id_end': xo.Int64,
|
|
47
|
+
'start_at_turn': xo.Int64,
|
|
48
|
+
'stop_at_turn': xo.Int64,
|
|
49
|
+
'frev': xo.Float64,
|
|
50
|
+
'sampling_frequency': xo.Float64,
|
|
51
|
+
'_index': xt.RecordIndex,
|
|
52
|
+
'data': EmittanceMonitorRecord,
|
|
53
|
+
'_cached': xo.Int8,
|
|
54
|
+
'_plane_selector': xo.Int8
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
behaves_like_drift = True
|
|
58
|
+
allow_loss_refinement = True
|
|
59
|
+
|
|
60
|
+
_extra_c_sources = [
|
|
61
|
+
xt._pkg_root.joinpath('headers/atomicadd.h'),
|
|
62
|
+
_pkg_root.joinpath('beam_elements/elements_src/emittance_monitor.h')
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
def __init__(self, **kwargs):
|
|
66
|
+
"""
|
|
67
|
+
Monitor to save the normalised beam emittance
|
|
68
|
+
|
|
69
|
+
Similar to the BeamSizeMonitor and BeamPositionMonitor, it allows for
|
|
70
|
+
arbitrary sampling rate and can thus not only be used to monitor bunch
|
|
71
|
+
emittance, but also to record coasting beams. See their documentation
|
|
72
|
+
for more information on how to use `frev` and `sampling_frequency`.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
num_particles (int, optional): Number of particles to monitor,
|
|
76
|
+
starting from 0. Defaults to -1 which means ALL.
|
|
77
|
+
particle_id_range (tuple, optional): Range of particle ids to
|
|
78
|
+
monitor (start, stop). Stop is exclusive. Defaults to
|
|
79
|
+
(particle_id_start, particle_id_start+num_particles).
|
|
80
|
+
start_at_turn (int): First turn of reference particle (inclusive)
|
|
81
|
+
at which to monitor. Defaults to 0.
|
|
82
|
+
stop_at_turn (int): Last turn of reference particle (exclusive) at
|
|
83
|
+
which to monitor. Defaults to start_at_turn + 1.
|
|
84
|
+
frev (float): Revolution frequency in Hz of circulating beam (used
|
|
85
|
+
to relate turn number to sample index). Defaults to 1.
|
|
86
|
+
sampling_frequency (float): Sampling frequency in Hz. Defaults to 1.
|
|
87
|
+
horizontal (bool): Whether or not to monitor the horizontal plane.
|
|
88
|
+
Defaults to True.
|
|
89
|
+
vertical (bool): Whether or not to monitor the vertical plane.
|
|
90
|
+
Defaults to True.
|
|
91
|
+
longitudinal (bool): Whether or not to monitor the longitudinal plane.
|
|
92
|
+
Defaults to True.
|
|
93
|
+
"""
|
|
94
|
+
if '_xobject' not in kwargs:
|
|
95
|
+
if 'particle_id_range' in kwargs:
|
|
96
|
+
assert 'num_particles' not in kwargs
|
|
97
|
+
particle_id_range = kwargs.pop('particle_id_range')
|
|
98
|
+
kwargs['part_id_start'] = int(particle_id_range[0])
|
|
99
|
+
kwargs['part_id_end'] = int(particle_id_range[1])
|
|
100
|
+
else:
|
|
101
|
+
num_particles = int(kwargs.pop('num_particles', -1))
|
|
102
|
+
if num_particles == -1:
|
|
103
|
+
kwargs['part_id_start'] = 0
|
|
104
|
+
kwargs['part_id_end'] = -1
|
|
105
|
+
else:
|
|
106
|
+
kwargs['part_id_start'] = kwargs.pop('particle_id_start', 0)
|
|
107
|
+
kwargs['part_id_end'] = kwargs['part_id_start'] + num_particles
|
|
108
|
+
kwargs['start_at_turn'] = int(kwargs.get('start_at_turn', 0))
|
|
109
|
+
kwargs['stop_at_turn'] = int(kwargs.get('stop_at_turn', kwargs['start_at_turn']+1))
|
|
110
|
+
kwargs.setdefault('frev', 1.)
|
|
111
|
+
kwargs.setdefault('sampling_frequency', 1.)
|
|
112
|
+
horizontal = kwargs.pop('horizontal', True)
|
|
113
|
+
vertical = kwargs.pop('vertical', True)
|
|
114
|
+
longitudinal = kwargs.pop('longitudinal', True)
|
|
115
|
+
kwargs['_plane_selector'] = int(horizontal)
|
|
116
|
+
kwargs['_plane_selector'] += 2*int(vertical)
|
|
117
|
+
kwargs['_plane_selector'] += 4*int(longitudinal)
|
|
118
|
+
if "data" not in kwargs:
|
|
119
|
+
# explicitely init with zeros (instead of size only) to have consistent initial values
|
|
120
|
+
size = int(round((kwargs['stop_at_turn'] - kwargs['start_at_turn']) \
|
|
121
|
+
* kwargs['sampling_frequency'] / kwargs['frev']))
|
|
122
|
+
size_h = np.zeros(size) if horizontal else np.zeros(1)
|
|
123
|
+
size_v = np.zeros(size) if vertical else np.zeros(1)
|
|
124
|
+
size_l = np.zeros(size) if longitudinal else np.zeros(1)
|
|
125
|
+
kwargs['data'] = {field.name: np.zeros(size) for field in EmittanceMonitorRecord._fields
|
|
126
|
+
if 'x' not in field.name and 'y' not in field.name and 'zeta' not in field.name}
|
|
127
|
+
kwargs['data'].update({field.name: size_h for field in EmittanceMonitorRecord._fields if 'x' in field.name})
|
|
128
|
+
kwargs['data'].update({field.name: size_v for field in EmittanceMonitorRecord._fields if 'y' in field.name})
|
|
129
|
+
kwargs['data'].update({field.name: size_l for field in EmittanceMonitorRecord._fields if 'zeta' in field.name})
|
|
130
|
+
super().__init__(**kwargs)
|
|
131
|
+
if not hasattr(self, '_cached'):
|
|
132
|
+
self._cached = False
|
|
133
|
+
if not hasattr(self, '_cached_modes'):
|
|
134
|
+
self._cached_modes = False
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def install(cls, line, name, *, at_s=None, at=None, s_tol=1.e-6, **kwargs):
|
|
139
|
+
self = cls(**kwargs)
|
|
140
|
+
line.insert_element(element=self, name=name, at_s=at_s, at=at, s_tol=s_tol)
|
|
141
|
+
self._name = name
|
|
142
|
+
self._line = line
|
|
143
|
+
return self
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@property
|
|
147
|
+
def gemitt_x(self):
|
|
148
|
+
self._check_horizontal()
|
|
149
|
+
self._calculate()
|
|
150
|
+
return self._gemitt_x
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def gemitt_y(self):
|
|
154
|
+
self._check_vertical()
|
|
155
|
+
self._calculate()
|
|
156
|
+
return self._gemitt_y
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
def gemitt_zeta(self):
|
|
160
|
+
self._check_longitudinal()
|
|
161
|
+
self._calculate()
|
|
162
|
+
return self._gemitt_zeta
|
|
163
|
+
|
|
164
|
+
@property
|
|
165
|
+
def nemitt_x(self):
|
|
166
|
+
self._check_horizontal()
|
|
167
|
+
self._calculate()
|
|
168
|
+
return self._gemitt_x * self.beta0 * self.gamma0
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def nemitt_y(self):
|
|
172
|
+
self._check_vertical()
|
|
173
|
+
self._calculate()
|
|
174
|
+
return self._gemitt_y * self.beta0 * self.gamma0
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
def nemitt_zeta(self):
|
|
178
|
+
self._check_longitudinal()
|
|
179
|
+
self._calculate()
|
|
180
|
+
return self._gemitt_zeta * self.beta0 * self.gamma0
|
|
181
|
+
|
|
182
|
+
@property
|
|
183
|
+
def gemitt_I(self):
|
|
184
|
+
self._check_horizontal()
|
|
185
|
+
self._calculate()
|
|
186
|
+
self._calculate_modes()
|
|
187
|
+
return self._gemitt_I
|
|
188
|
+
|
|
189
|
+
@property
|
|
190
|
+
def gemitt_II(self):
|
|
191
|
+
self._check_vertical()
|
|
192
|
+
self._calculate()
|
|
193
|
+
self._calculate_modes()
|
|
194
|
+
return self._gemitt_II
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def gemitt_III(self):
|
|
198
|
+
self._check_longitudinal()
|
|
199
|
+
self._calculate()
|
|
200
|
+
self._calculate_modes()
|
|
201
|
+
return self._gemitt_III
|
|
202
|
+
|
|
203
|
+
@property
|
|
204
|
+
def nemitt_I(self):
|
|
205
|
+
self._check_horizontal()
|
|
206
|
+
self._calculate()
|
|
207
|
+
self._calculate_modes()
|
|
208
|
+
return self._gemitt_I * self.beta0 * self.gamma0
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def nemitt_II(self):
|
|
212
|
+
self._check_vertical()
|
|
213
|
+
self._calculate()
|
|
214
|
+
self._calculate_modes()
|
|
215
|
+
return self._gemitt_II * self.beta0 * self.gamma0
|
|
216
|
+
|
|
217
|
+
@property
|
|
218
|
+
def nemitt_III(self):
|
|
219
|
+
self._check_longitudinal()
|
|
220
|
+
self._calculate()
|
|
221
|
+
self._calculate_modes()
|
|
222
|
+
return self._gemitt_III * self.beta0 * self.gamma0
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def horizontal(self):
|
|
227
|
+
return bool(self._plane_selector % 2)
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def vertical(self):
|
|
231
|
+
return bool((self._plane_selector >> 1) % 2)
|
|
232
|
+
|
|
233
|
+
@property
|
|
234
|
+
def longitudinal(self):
|
|
235
|
+
return bool((self._plane_selector >> 2) % 2)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@property
|
|
239
|
+
def beta0(self):
|
|
240
|
+
if not hasattr(self, '_beta0'):
|
|
241
|
+
self._beta0 = self.line.particle_ref.beta0[0]
|
|
242
|
+
return self._beta0
|
|
243
|
+
|
|
244
|
+
@property
|
|
245
|
+
def gamma0(self):
|
|
246
|
+
if not hasattr(self, '_gamma0'):
|
|
247
|
+
self._gamma0 = self.line.particle_ref.gamma0[0]
|
|
248
|
+
return self._gamma0
|
|
249
|
+
|
|
250
|
+
@property
|
|
251
|
+
def turns(self):
|
|
252
|
+
self._calculate()
|
|
253
|
+
return self._turns
|
|
254
|
+
|
|
255
|
+
@property
|
|
256
|
+
def name(self):
|
|
257
|
+
if not hasattr(self, '_name'):
|
|
258
|
+
raise ValueError("Name not set! Install the monitor using xc.EmittanceMonitor.install() "
|
|
259
|
+
"or manually set the name after installation.")
|
|
260
|
+
return self._name
|
|
261
|
+
|
|
262
|
+
@name.setter
|
|
263
|
+
def name(self, val):
|
|
264
|
+
self._name = val
|
|
265
|
+
|
|
266
|
+
@property
|
|
267
|
+
def line(self):
|
|
268
|
+
if not hasattr(self, '_line'):
|
|
269
|
+
raise ValueError("Line not set! Install the monitor using xc.EmittanceMonitor.install() "
|
|
270
|
+
"or manually set the line after installation.")
|
|
271
|
+
return self._line
|
|
272
|
+
|
|
273
|
+
@line.setter
|
|
274
|
+
def line(self, val):
|
|
275
|
+
self._line = val
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def _check_horizontal(self):
|
|
279
|
+
if not self.horizontal:
|
|
280
|
+
raise ValueError("Horizontal plane not monitored!")
|
|
281
|
+
|
|
282
|
+
def _check_vertical(self):
|
|
283
|
+
if not self.vertical:
|
|
284
|
+
raise ValueError("Vertical plane not monitored!")
|
|
285
|
+
|
|
286
|
+
def _check_longitudinal(self):
|
|
287
|
+
if not self.longitudinal:
|
|
288
|
+
raise ValueError("Longitudinal plane not monitored!")
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def _calculate(self):
|
|
292
|
+
if self._cached:
|
|
293
|
+
return
|
|
294
|
+
|
|
295
|
+
# Calculate mean, variance, and std
|
|
296
|
+
N = self.count
|
|
297
|
+
mask = N > 0
|
|
298
|
+
N = N[mask]
|
|
299
|
+
self._turns = np.array(range(self.start_at_turn, self.stop_at_turn))[mask]
|
|
300
|
+
with np.errstate(invalid='ignore'): # NaN for zero particles is expected behaviour
|
|
301
|
+
for field in [f.name for f in EmittanceMonitorRecord._fields]:
|
|
302
|
+
if field.endswith('_sum2'):
|
|
303
|
+
x1, x2 = field[:-5].split('_')
|
|
304
|
+
ff1 = getattr(self, f'{x1}_sum1')
|
|
305
|
+
ff1 = ff1[mask] if len(ff1) == len(mask) else ff1
|
|
306
|
+
mean1 = ff1 / N
|
|
307
|
+
ff2 = getattr(self, f'{x2}_sum1')
|
|
308
|
+
ff2 = ff2[mask] if len(ff2) == len(mask) else ff2
|
|
309
|
+
mean2 = ff2 / N
|
|
310
|
+
ff = getattr(self, field)
|
|
311
|
+
ff = ff[mask] if len(ff) == len(mask) else ff
|
|
312
|
+
variance = ff / (N - 1) - mean1 * mean2 * N / (N - 1)
|
|
313
|
+
setattr(self, f'_{x1}_{x2}_var', variance)
|
|
314
|
+
self._cached = True
|
|
315
|
+
self._cached_modes = False
|
|
316
|
+
|
|
317
|
+
# Calculate emittances
|
|
318
|
+
gemitt_x = np.sqrt(self.x_x_var * self.px_px_var - self.x_px_var**2)
|
|
319
|
+
gemitt_y = np.sqrt(self.y_y_var * self.py_py_var - self.y_py_var**2)
|
|
320
|
+
gemitt_zeta = np.sqrt(self.zeta_zeta_var * self.pzeta_pzeta_var - self.zeta_pzeta_var**2)
|
|
321
|
+
setattr(self, '_gemitt_x', gemitt_x)
|
|
322
|
+
setattr(self, '_gemitt_y', gemitt_y)
|
|
323
|
+
setattr(self, '_gemitt_zeta', gemitt_zeta)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def _calculate_modes(self):
|
|
327
|
+
if self._cached_modes:
|
|
328
|
+
return
|
|
329
|
+
|
|
330
|
+
S = np.array([[ 0., 1., 0., 0., 0., 0.],
|
|
331
|
+
[-1., 0., 0., 0., 0., 0.],
|
|
332
|
+
[ 0., 0., 0., 1., 0., 0.],
|
|
333
|
+
[ 0., 0.,-1., 0., 0., 0.],
|
|
334
|
+
[ 0., 0., 0., 0., 0., 1.],
|
|
335
|
+
[ 0., 0., 0., 0.,-1., 0.]])
|
|
336
|
+
gemitt_I = []
|
|
337
|
+
gemitt_II = []
|
|
338
|
+
gemitt_III = []
|
|
339
|
+
N = self.count
|
|
340
|
+
N = N[N > 0]
|
|
341
|
+
for i in range(len(N)):
|
|
342
|
+
if N[i] < 25:
|
|
343
|
+
# Not enough statistics for a reliable calculation of the modes
|
|
344
|
+
gemitt_I.append(0)
|
|
345
|
+
gemitt_II.append(0)
|
|
346
|
+
gemitt_III.append(0)
|
|
347
|
+
continue
|
|
348
|
+
if self.horizontal:
|
|
349
|
+
block_x = np.array([[self.x_x_var[i], self.x_px_var[i]],
|
|
350
|
+
[self.x_px_var[i], self.px_px_var[i]]])
|
|
351
|
+
else:
|
|
352
|
+
block_x = np.zeros((2, 2))
|
|
353
|
+
if self.vertical:
|
|
354
|
+
block_y = np.array([[self.y_y_var[i], self.y_py_var[i]],
|
|
355
|
+
[self.y_py_var[i], self.py_py_var[i]]])
|
|
356
|
+
else:
|
|
357
|
+
block_y = np.zeros((2, 2))
|
|
358
|
+
if self.longitudinal:
|
|
359
|
+
block_z = np.array([[self.zeta_zeta_var[i], self.zeta_pzeta_var[i]],
|
|
360
|
+
[self.zeta_pzeta_var[i], self.pzeta_pzeta_var[i]]])
|
|
361
|
+
else:
|
|
362
|
+
block_z = np.zeros((2, 2))
|
|
363
|
+
if self.horizontal and self.vertical:
|
|
364
|
+
block_xy = np.array([[self.x_y_var[i], self.x_py_var[i]],
|
|
365
|
+
[self.px_y_var[i], self.px_py_var[i]]])
|
|
366
|
+
else:
|
|
367
|
+
block_xy = np.zeros((2, 2))
|
|
368
|
+
if self.horizontal and self.longitudinal:
|
|
369
|
+
block_xz = np.array([[self.x_zeta_var[i], self.x_pzeta_var[i]],
|
|
370
|
+
[self.px_zeta_var[i], self.px_pzeta_var[i]]])
|
|
371
|
+
else:
|
|
372
|
+
block_xz = np.zeros((2, 2))
|
|
373
|
+
if self.vertical and self.longitudinal:
|
|
374
|
+
block_yz = np.array([[self.y_zeta_var[i], self.y_pzeta_var[i]],
|
|
375
|
+
[self.py_zeta_var[i], self.py_pzeta_var[i]]])
|
|
376
|
+
else:
|
|
377
|
+
block_yz = np.zeros((2, 2))
|
|
378
|
+
|
|
379
|
+
covariance_S = np.dot(np.block([[block_x, block_xy, block_xz],
|
|
380
|
+
[block_xy.T, block_y, block_yz],
|
|
381
|
+
[block_xz.T, block_yz.T, block_z]]),
|
|
382
|
+
S)
|
|
383
|
+
cond_number = np.linalg.cond(covariance_S)
|
|
384
|
+
if cond_number > 1e10:
|
|
385
|
+
print(f"Warning: High condition number when calculating "
|
|
386
|
+
+ f"the emittances modes at time step {i}: {cond_number}.\n"
|
|
387
|
+
+ f"One of the coordinates might be close to zero or not "
|
|
388
|
+
+ f"varying enough among the different particles. Only "
|
|
389
|
+
+ f"{N[i]} particles were logged at this step.")
|
|
390
|
+
rank = np.linalg.matrix_rank(covariance_S)
|
|
391
|
+
expected_rank = int(self.horizontal) + int(self.vertical) + int(self.longitudinal)
|
|
392
|
+
if rank < expected_rank:
|
|
393
|
+
print(f"Warning: Matrix is rank deficient when calculating "
|
|
394
|
+
+ f"the emittances modes at time step {i}: rank {rank} "
|
|
395
|
+
+ f"instead of expected {len(covariance_S)}.\n"
|
|
396
|
+
+ f"One of the coordinates might be close to zero or not "
|
|
397
|
+
+ f"varying enough among the different particles. Only "
|
|
398
|
+
+ f"{N[i]} particles were logged at this step.")
|
|
399
|
+
|
|
400
|
+
from xtrack.linear_normal_form import compute_linear_normal_form
|
|
401
|
+
_, _, _, eigenvalues = compute_linear_normal_form(covariance_S)
|
|
402
|
+
gemitt_I.append(eigenvalues[0].imag)
|
|
403
|
+
gemitt_II.append(eigenvalues[1].imag)
|
|
404
|
+
gemitt_III.append(eigenvalues[2].imag)
|
|
405
|
+
|
|
406
|
+
setattr(self, '_gemitt_I', np.array(gemitt_I))
|
|
407
|
+
setattr(self, '_gemitt_II', np.array(gemitt_II))
|
|
408
|
+
setattr(self, '_gemitt_III', np.array(gemitt_III))
|
|
409
|
+
self._cached_modes = True
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def __getattr__(self, attr):
|
|
413
|
+
if attr in [f.name for f in EmittanceMonitorRecord._fields]:
|
|
414
|
+
return getattr(self.data, attr).to_nparray()
|
|
415
|
+
|
|
416
|
+
elif attr in self.__class__._xofields:
|
|
417
|
+
return super().__getattr(attr)
|
|
418
|
+
|
|
419
|
+
else:
|
|
420
|
+
if attr.startswith('_'):
|
|
421
|
+
raise AttributeError(f"Attribute {attr} not set!")
|
|
422
|
+
|
|
423
|
+
if attr.endswith('_var'):
|
|
424
|
+
self._calculate()
|
|
425
|
+
return getattr(self, f'_{attr}')
|
|
426
|
+
|
|
427
|
+
else:
|
|
428
|
+
raise AttributeError(f"EmittanceMonitor has no attribute '{attr}'")
|