xcoll 0.6.1__py3-none-any.whl → 0.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (84) hide show
  1. xcoll/general.py +1 -1
  2. {xcoll-0.6.1.dist-info → xcoll-0.6.2.dist-info}/METADATA +5 -4
  3. xcoll-0.6.2.dist-info/RECORD +61 -0
  4. {xcoll-0.6.1.dist-info → xcoll-0.6.2.dist-info}/WHEEL +1 -1
  5. xcoll/__init__.py.orig +0 -26
  6. xcoll/general.py.orig +0 -20
  7. xcoll/initial_distribution.py.orig +0 -256
  8. xcoll/scattering_routines/fluka/flukaio/.git +0 -1
  9. xcoll/scattering_routines/fluka/flukaio/.gitignore +0 -2
  10. xcoll/scattering_routines/fluka/flukaio/CMakeLists.txt +0 -18
  11. xcoll/scattering_routines/fluka/flukaio/ComponentMakefile +0 -192
  12. xcoll/scattering_routines/fluka/flukaio/Makefile +0 -144
  13. xcoll/scattering_routines/fluka/flukaio/README +0 -26
  14. xcoll/scattering_routines/fluka/flukaio/doc/Doxyfile +0 -1551
  15. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.asciidoc +0 -1054
  16. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.epub +0 -0
  17. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.html +0 -1607
  18. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.pdf +0 -0
  19. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__1.png +0 -0
  20. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__2.png +0 -0
  21. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__3.png +0 -0
  22. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__4.png +0 -0
  23. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__5.png +0 -0
  24. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__6.png +0 -0
  25. xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__7.png +0 -0
  26. xcoll/scattering_routines/fluka/flukaio/doc/Makefile +0 -8
  27. xcoll/scattering_routines/fluka/flukaio/doc/docbook.xsl +0 -1690
  28. xcoll/scattering_routines/fluka/flukaio/include/Connection.h +0 -79
  29. xcoll/scattering_routines/fluka/flukaio/include/FlukaIO.h +0 -58
  30. xcoll/scattering_routines/fluka/flukaio/include/FlukaIOServer.h +0 -33
  31. xcoll/scattering_routines/fluka/flukaio/include/FortranFlukaIO.h +0 -277
  32. xcoll/scattering_routines/fluka/flukaio/include/Message.h +0 -89
  33. xcoll/scattering_routines/fluka/flukaio/include/ParticleInfo.h +0 -76
  34. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  35. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  36. xcoll/scattering_routines/fluka/flukaio/samples/ClientTest.c +0 -156
  37. xcoll/scattering_routines/fluka/flukaio/samples/ServerTest.c +0 -123
  38. xcoll/scattering_routines/fluka/flukaio/samples/fclient.f +0 -149
  39. xcoll/scattering_routines/fluka/flukaio/samples/fserver.f +0 -118
  40. xcoll/scattering_routines/fluka/flukaio/src/Connection.c +0 -264
  41. xcoll/scattering_routines/fluka/flukaio/src/Connection.d +0 -69
  42. xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  43. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.c +0 -211
  44. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +0 -46
  45. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  46. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.c +0 -45
  47. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +0 -29
  48. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.h +0 -17
  49. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  50. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.c +0 -84
  51. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +0 -70
  52. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  53. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer_private.h +0 -22
  54. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO_private.h +0 -16
  55. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.c +0 -533
  56. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +0 -40
  57. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  58. xcoll/scattering_routines/fluka/flukaio/src/NetIO.c +0 -304
  59. xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +0 -66
  60. xcoll/scattering_routines/fluka/flukaio/src/NetIO.h +0 -30
  61. xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  62. xcoll/scattering_routines/fluka/flukaio/src/tags +0 -167
  63. xcoll/scattering_routines/fluka/flukaio/tests/AllTests.cpp +0 -8
  64. xcoll/scattering_routines/fluka/flukaio/tests/CommonTest.h +0 -10
  65. xcoll/scattering_routines/fluka/flukaio/tests/ConnectionTest.cpp +0 -99
  66. xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOServerTest.cpp +0 -104
  67. xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOTest.cpp +0 -439
  68. xcoll/scattering_routines/fluka/flukaio/tests/FortranFlukaIOTest.cpp +0 -682
  69. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.c +0 -19
  70. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.h +0 -16
  71. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.c +0 -74
  72. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.h +0 -50
  73. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.c +0 -16
  74. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.h +0 -20
  75. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.c +0 -12
  76. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h +0 -18
  77. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h +0 -19
  78. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c +0 -80
  79. xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h +0 -35
  80. xcoll-0.6.1.dist-info/LICENSE +0 -201
  81. xcoll-0.6.1.dist-info/NOTICE +0 -2
  82. xcoll-0.6.1.dist-info/RECORD +0 -138
  83. /LICENSE → /xcoll-0.6.2.dist-info/LICENSE +0 -0
  84. /NOTICE → /xcoll-0.6.2.dist-info/NOTICE +0 -0
xcoll/general.py CHANGED
@@ -12,5 +12,5 @@ citation = "F.F. Van der Veken, et al.: Recent Developments with the New Tools f
12
12
  # ======================
13
13
  # Do not change
14
14
  # ======================
15
- __version__ = '0.6.1'
15
+ __version__ = '0.6.2'
16
16
  # ======================
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: xcoll
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: Xsuite collimation package
5
- Home-page: https://github.com/xsuite/xcoll
6
5
  License: Apache 2.0
7
6
  Author: Frederik F. Van der Veken
8
7
  Author-email: frederik@cern.ch
@@ -14,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
17
  Provides-Extra: tests
18
18
  Requires-Dist: numpy (>=1.0)
19
19
  Requires-Dist: pandas (>=1.4)
@@ -21,7 +21,8 @@ Requires-Dist: ruamel-yaml (>=0.17.31,<0.18.0) ; extra == "tests"
21
21
  Requires-Dist: xdeps (>=0.10.5)
22
22
  Requires-Dist: xobjects (>=0.5.0)
23
23
  Requires-Dist: xpart (>=0.23.0)
24
- Requires-Dist: xtrack (>=0.84.6)
24
+ Requires-Dist: xtrack (>=0.84.8)
25
+ Project-URL: Homepage, https://github.com/xsuite/xcoll
25
26
  Project-URL: Repository, https://github.com/xsuite/xcoll
26
27
  Description-Content-Type: text/markdown
27
28
 
@@ -0,0 +1,61 @@
1
+ xcoll/__init__.py,sha256=wEk3szUGeeN2Bg7_nx2D2pCgzRR0zcbEcWCP33p-e3I,854
2
+ xcoll/beam_elements/__init__.py,sha256=qu2-LefWfEKZHfALGqZo97DTrwdZVh7Sp97V-3XokJU,1189
3
+ xcoll/beam_elements/absorber.py,sha256=Gw1l1ng1MqF0dRTk7YhkiPAoinS5xsTASMxMDWGsmTw,2842
4
+ xcoll/beam_elements/base.py,sha256=mjnzLbZ-GC56N56Eq5r5oQB8cLmeaqR5oEH1-FnS_H4,57816
5
+ xcoll/beam_elements/blowup.py,sha256=0jfuxaIwXsEY4e6DlzGmv29OY7DGRKhbb2L-qKJwImQ,8079
6
+ xcoll/beam_elements/elements_src/black_absorber.h,sha256=AXs_bNLaK8xBl8IeLJvGz7AfFaasruPMtYz8lbRtqG4,4705
7
+ xcoll/beam_elements/elements_src/black_crystal.h,sha256=ZlLkJec4_naeoS3jEx-vQVAKBI0dInzMZq06pzKQOn0,4355
8
+ xcoll/beam_elements/elements_src/blowup.h,sha256=YlTt7YxswLM0ZjPuEjuE7xzjQ3hMt6FX9V3MbqVYmN4,1564
9
+ xcoll/beam_elements/elements_src/emittance_monitor.h,sha256=vlHzQFoUjKQHWBmzpaSzRbILtxSWqEasMtxHC-FFoAc,7078
10
+ xcoll/beam_elements/elements_src/everest_block.h,sha256=ITSzfiqwm8ZNIkAj_odQkAjKhPcdT8b0AUlq_uxtsqI,6562
11
+ xcoll/beam_elements/elements_src/everest_collimator.h,sha256=fkD5GazVv2zlmqyb6s9zVNMq6baXeFb_pf7gg9TKjNc,9787
12
+ xcoll/beam_elements/elements_src/everest_crystal.h,sha256=LISp_9NEWMIi5GvZ3LwPfeSbmsbXvHWcTqxW6eCCsiE,11951
13
+ xcoll/beam_elements/elements_src/transparent_collimator.h,sha256=pA_Fxx85N87iSbpHSjR2OSOx6JN9e38T1pOUKrC7zxs,4610
14
+ xcoll/beam_elements/elements_src/transparent_crystal.h,sha256=DGX4uL0hpm4njOypoPuEWtMzYxnL9jQkf2ZrGaS0alI,4128
15
+ xcoll/beam_elements/everest.py,sha256=iJva_S0OQnmG-qj7rIAiUCssu5WL_Qs5P_n6Qx-IWzo,9080
16
+ xcoll/beam_elements/monitor.py,sha256=baMYT_PNya8KX35ReeMwk5Cm04ePUqiDF_s69L5GTX0,16968
17
+ xcoll/beam_elements/transparent.py,sha256=AZOWfH3dvsetL6DjQGejUgX7T18e_3omIIffG_1gwc0,2894
18
+ xcoll/colldb.py,sha256=WaJC6gkDNVvxo65OhucTM6Fwo6pgRFHNnBnHSkiX7AQ,31054
19
+ xcoll/general.py,sha256=tayWZwdCHAmngxUu5-_6CV_PDpnIdLJlzXrtbGZfkOA,534
20
+ xcoll/headers/checks.h,sha256=qdXsOTBOK1MwW6bdFF93j4yE648mcDtEv5rGN1w9sfk,1582
21
+ xcoll/headers/particle_states.py,sha256=N8ehLtg99358I4RGCJ3sjuKCk2LVdGqgVx2xGoHrRdM,1959
22
+ xcoll/initial_distribution.py,sha256=CHhqeCVjVOyaBWhfy2sDgLwIgtXZoqcTW-su-M2YByE,10989
23
+ xcoll/interaction_record/__init__.py,sha256=UFoLiKa-z2oX7YoszP-7Vgdt1nM6kT382v1CaIu8_u0,50
24
+ xcoll/interaction_record/interaction_record.py,sha256=cCjfVCYUJaV0Y-pCljA2_u8GLyhHt7zNjbSXkE7cRO4,13299
25
+ xcoll/interaction_record/interaction_record_src/interaction_record.h,sha256=0rNagnfSGc2i1jauOMIcDbj9QFic9dV_MOyqVx1kw5Q,6067
26
+ xcoll/interaction_record/interaction_types.py,sha256=XTeg2dcImMpqhTqzkJKh6JYam2v9gUMhED-dDKLsilk,2894
27
+ xcoll/line_tools.py,sha256=JBySkKKZ-RGumqAZF_8PSQ3OV0M87P78NeQgbXAdFc4,16699
28
+ xcoll/lossmap.py,sha256=HLdhej9tUjk36T5BulVWurJtfiNa61L_1X7-8kT6JoQ,28407
29
+ xcoll/plot.py,sha256=27fYdXstPg3o8XyeBlPuD2yz0GR3dKkNWy4kO2BD9WA,4071
30
+ xcoll/rf_sweep.py,sha256=hMgW15uTp7qPprdlHCZBjOOe8Emdm-R0TfxPDoRXnJU,9021
31
+ xcoll/scattering_routines/engine.py,sha256=1VCBEZLMd5orFo3sZqK51NrqbqELBVrbsz6bB2SXsFQ,22962
32
+ xcoll/scattering_routines/environment.py,sha256=xZ8A7XfvSfpe8vYbM5oD5qbcp8Tuag5qWAI6VqgGUlA,12033
33
+ xcoll/scattering_routines/everest/__init__.py,sha256=7lkkeZ1liBjXVHCuRpgzZI6ohzHVMj5uJBO792147XY,286
34
+ xcoll/scattering_routines/everest/amorphous.h,sha256=8v_5P94LDxeLp1xI2nvwdbEPJNDY6LTB1CwXv4AwjZs,11806
35
+ xcoll/scattering_routines/everest/channelling.h,sha256=WrYBcvGWP2Da47__AGbbKsT8yvZmHhVZd5F1gku--GU,10941
36
+ xcoll/scattering_routines/everest/constants.h,sha256=_y9QqKAUSwPOkk8A4BF8ILNdDDJf66eINJwda8skwZM,1380
37
+ xcoll/scattering_routines/everest/crystal_parameters.h,sha256=QtmSQM4qzVXfjdkxs0ns8utqtqZ_u-Ej_y6m7UOKITo,6001
38
+ xcoll/scattering_routines/everest/everest.h,sha256=T9mESIy_oC86WJSsU7LY_A0iqHT2PKl5MmhnKQaGVSg,3200
39
+ xcoll/scattering_routines/everest/everest.py,sha256=aKy5d7HGiqEphFZDZE4RnYbxh0j10Boc04EZ0By9WdM,1542
40
+ xcoll/scattering_routines/everest/ionisation_loss.h,sha256=QIujj_qrKOY7L7CVFNSyexjlDJ94sfilvakhfWVfe44,6108
41
+ xcoll/scattering_routines/everest/jaw.h,sha256=4Ml9FofWPkGlvw6oWNdbZQIYV4K1xhfbEkNwwfDcITc,2069
42
+ xcoll/scattering_routines/everest/materials.py,sha256=pKQfrMNrqU3sitICTRjqfvwsvHrBDSUf3jfmOEE5Kls,10292
43
+ xcoll/scattering_routines/everest/multiple_coulomb_scattering.h,sha256=oX_ZN32eLcZX3VdYn4kAnT5wMKVTe4fLudPgbX9w37Y,5434
44
+ xcoll/scattering_routines/everest/nuclear_interaction.h,sha256=07yg9AD3jAfPetFVSY6cXT0iN5tBCrXXmYWvGMTaUDI,3892
45
+ xcoll/scattering_routines/everest/properties.h,sha256=AJf7Q_iPsiXTavnguzsNozdoH4NYGdDvyqP3iXychKU,3845
46
+ xcoll/scattering_routines/geometry/__init__.py,sha256=a2DFji3U6Msj-aJE2Dt5Il8FgesfICJHeK9yQj4zHa4,221
47
+ xcoll/scattering_routines/geometry/collimator_geometry.h,sha256=0gHiSEALJtQdW0mUav7GmES4JCAvq-xmch_ZRPkCfUI,7819
48
+ xcoll/scattering_routines/geometry/crystal_geometry.h,sha256=DHuQPMKq_Q0uK0WW2YRd7oxxhMwRPWtNUUn5fBW4Cxc,4968
49
+ xcoll/scattering_routines/geometry/geometry.py,sha256=bF8v7aEP09E4_EMkN0KEJFU-PQrBSOB0Xv699VBUzRY,1102
50
+ xcoll/scattering_routines/geometry/get_s.h,sha256=TWxZ-GjCcLrOV1wota7ltE53Nit0LQASoXmsqn-N0LQ,2947
51
+ xcoll/scattering_routines/geometry/methods.h,sha256=I8ik46SgkCHHtZ99anbdb3ZC7A_5Q809fgpeWMajdkY,3747
52
+ xcoll/scattering_routines/geometry/objects.h,sha256=A5ktGvVlSkC4hUsI_PQFsE80CuDwYbcioxKGRmEf2I0,5499
53
+ xcoll/scattering_routines/geometry/rotation.h,sha256=lO3RaQBys9r0ROMjR8T8Rr7UsIEm-H9_C_70Nwz4MXY,701
54
+ xcoll/scattering_routines/geometry/segments.h,sha256=7nKnnin2ByxkKyaYwGvFaqgLQg5uBba4CdLHL7L3iQs,7667
55
+ xcoll/scattering_routines/geometry/sort.h,sha256=b1MkFO2ddzv1fWGeQzsLuz46qo2pKyRSXHjoAEVU7Ts,5763
56
+ xcoll/xaux.py,sha256=mh4E_jhaUFm2LOKawJ0b6X4zuz8JiJhx6w7GcnRgIXQ,2291
57
+ xcoll-0.6.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
58
+ xcoll-0.6.2.dist-info/METADATA,sha256=3ggN0J33OYQp2Yjn7kWMTLeXmuTjI06lbAAJVWYkt7U,2739
59
+ xcoll-0.6.2.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
60
+ xcoll-0.6.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
61
+ xcoll-0.6.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
xcoll/__init__.py.orig DELETED
@@ -1,26 +0,0 @@
1
- # copyright ############################### #
2
- # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2025. #
4
- # ######################################### #
5
-
6
- from .general import _pkg_root, __version__, citation
7
-
8
- <<<<<<< HEAD
9
- from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal, \
10
- Geant4Collimator, BlowUp, EmittanceMonitor, collimator_classes, crystal_classes, element_classes
11
- =======
12
- from .beam_elements import BlackAbsorber, BlackCrystal, TransparentCollimator, TransparentCrystal, \
13
- EverestBlock, EverestCollimator, EverestCrystal, BlowUp, EmittanceMonitor, \
14
- collimator_classes, crystal_classes, element_classes
15
- >>>>>>> main
16
- from .scattering_routines.everest import materials, Material, CrystalMaterial
17
- from .scattering_routines.geant4 import Geant4Engine
18
- from .colldb import CollimatorDatabase
19
- from .interaction_record import InteractionRecord
20
- from .rf_sweep import RFSweep
21
- from .lossmap import LossMap, MultiLossMap
22
-
23
-
24
- # print("If you use Xcoll in your simulations, please cite us :-)")
25
- # print(citation)
26
-
xcoll/general.py.orig DELETED
@@ -1,20 +0,0 @@
1
- # copyright ############################### #
2
- # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2024. #
4
- # ######################################### #
5
-
6
- from pathlib import Path
7
-
8
- _pkg_root = Path(__file__).parent.absolute()
9
-
10
- citation = "F.F. Van der Veken, et al.: Recent Developments with the New Tools for Collimation Simulations in Xsuite, Proceedings of HB2023, Geneva, Switzerland."
11
-
12
- # ======================
13
- # Do not change
14
- # ======================
15
- <<<<<<< HEAD
16
- __version__ = '0.5.11.dev0+geant4'
17
- =======
18
- __version__ = '0.6.0'
19
- >>>>>>> main
20
- # ======================
@@ -1,256 +0,0 @@
1
- # copyright ############################### #
2
- # This file is part of the Xcoll package. #
3
- # Copyright (c) CERN, 2025. #
4
- # ######################################### #
5
-
6
- import numpy as np
7
- from warnings import warn
8
-
9
- import xtrack as xt
10
- import xobjects as xo
11
- import xpart as xp
12
-
13
- <<<<<<< HEAD
14
- from .beam_elements import collimator_classes, EverestCrystal, Geant4Collimator
15
- =======
16
- from .beam_elements import collimator_classes, BaseCrystal
17
- >>>>>>> main
18
-
19
-
20
- def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', pencil_spread=1e-6,
21
- impact_parameter=0, sigma_z=7.61e-2, twiss=None, longitudinal=None,
22
- longitudinal_betatron_cut=None, _capacity=None, tw=None,
23
- _longitudinal_coords=None, **kwargs):
24
- """Generate a pencil beam on a collimator."""
25
-
26
- # Do some general checks
27
- if not line._has_valid_tracker():
28
- raise ValueError("Please build tracker before generating pencil distribution!")
29
- coll = line[name]
30
- if not isinstance(coll, tuple(collimator_classes)):
31
- raise ValueError("Need to provide a valid collimator!")
32
- if coll.optics is None:
33
- raise ValueError("Need to assign optics to collimators before generating pencil distribution!")
34
- num_particles = int(num_particles)
35
- if len(line.get_elements_of_type(Geant4Collimator)[0]) > 0:
36
- kwargs.setdefault('_capacity', 2*num_particles)
37
-
38
- # Define the plane
39
- angle = coll.angle
40
- if abs(np.mod(angle-90,180)-90) < 1e-6:
41
- plane = 'x'
42
- transv_plane = 'y'
43
- elif abs(np.mod(angle,180)-90) < 1e-6:
44
- plane = 'y'
45
- transv_plane = 'x'
46
- else:
47
- raise NotImplementedError("Pencil beam on a skew collimator not yet supported!")
48
-
49
- if coll.side == 'left':
50
- if side == '-':
51
- raise ValueError("Cannot generate a pencil on the right jaw of a left-"
52
- "sided collimator!")
53
- side = '+'
54
- if coll.side == 'right':
55
- if side == '+':
56
- raise ValueError("Cannot generate a pencil on the left jaw of a right-"
57
- "sided collimator!")
58
- side = '-'
59
-
60
- if tw is not None:
61
- warn("The argument tw is deprecated. Please use twiss instead.", FutureWarning)
62
- if twiss is None:
63
- twiss = tw
64
-
65
- if twiss is None:
66
- twiss = line.twiss()
67
-
68
- # Longitudinal plane
69
- if _longitudinal_coords:
70
- zeta = _longitudinal_coords[0]
71
- delta = _longitudinal_coords[1]
72
-
73
- else:
74
- zeta, delta = _generate_longitudinal_dist(line, num_particles, sigma_z, longitudinal)
75
-
76
- # Generate 4D coordinates
77
- # TODO: there is some looping in the calculation here and in xpart. Can it be improved?
78
- if side == '+-':
79
- num_plus = int(num_particles/2)
80
- num_min = int(num_particles - num_plus)
81
- zeta_plus = zeta[:num_plus] if hasattr(zeta, '__iter__') else zeta
82
- zeta_min = zeta[num_plus:] if hasattr(zeta, '__iter__') else zeta
83
- delta_plus = delta[:num_plus] if hasattr(delta, '__iter__') else delta
84
- delta_min = delta[num_plus:] if hasattr(delta, '__iter__') else delta
85
- if _capacity:
86
- _capacity_plus = int(_capacity/2)
87
- _capacity_min = int(_capacity - _capacity_plus)
88
- else:
89
- _capacity_plus = None
90
- _capacity_min = None
91
- part_plus = generate_pencil_on_collimator(line=line, name=name, num_particles=num_plus,
92
- impact_parameter=impact_parameter, _capacity=_capacity_plus,
93
- side='+', pencil_spread=pencil_spread, twiss=twiss,
94
- _longitudinal_coords=[zeta_plus, delta_plus],
95
- **kwargs)
96
- part_min = generate_pencil_on_collimator(line=line, name=name, num_particles=num_min,
97
- impact_parameter=impact_parameter, _capacity=_capacity_min,
98
- side='-', pencil_spread=pencil_spread, twiss=twiss,
99
- _longitudinal_coords=[zeta_min, delta_min],
100
- **kwargs)
101
-
102
- part = xt.Particles.merge([part_plus, part_min])
103
- part.start_tracking_at_element = part_plus.start_tracking_at_element
104
- assert part.start_tracking_at_element == part_min.start_tracking_at_element
105
- return part
106
-
107
- pencil, p_pencil, transverse_norm, p_transverse_norm, is_converging, at_element = \
108
- _generate_4D_pencil_one_jaw(line, name, num_particles, plane, side,
109
- impact_parameter, pencil_spread, twiss, **kwargs)
110
-
111
- # Build the particles
112
- if plane == 'x':
113
- part = xp.build_particles(
114
- x=pencil, px=p_pencil, y_norm=transverse_norm, py_norm=p_transverse_norm,
115
- zeta=zeta, delta=delta, nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y,
116
- line=line, at_element=at_element, _context=coll._buffer.context, **kwargs
117
- )
118
- else:
119
- part = xp.build_particles(
120
- x_norm=transverse_norm, px_norm=p_transverse_norm, y=pencil, py=p_pencil,
121
- zeta=zeta, delta=delta, nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y,
122
- line=line, at_element=at_element, _context=coll._buffer.context, **kwargs
123
- )
124
-
125
- part._init_random_number_generator()
126
-
127
- if not is_converging:
128
- dri = xt.Drift(length=-coll.length)
129
- dri.track(part)
130
- part.start_tracking_at_element -= 1
131
- part.at_element -= 1
132
-
133
- return part
134
-
135
-
136
- def generate_delta_from_dispersion(line, at_element, *, plane, position_mm, nemitt_x, nemitt_y,
137
- twiss=None, betatron_cut=0, match_at_front=True):
138
- if line.tracker is None:
139
- raise ValueError("Need to build tracker first!")
140
- if not hasattr(betatron_cut, '__iter__'):
141
- if hasattr(position_mm, '__iter__'):
142
- betatron_cut = np.full_like(position_mm, betatron_cut)
143
- elif not hasattr(position_mm, '__iter__'):
144
- position_mm = np.full_like(betatron_cut, position_mm)
145
- elif len(position_mm) != len(betatron_cut):
146
- raise ValueError
147
- if plane not in ['x', 'y']:
148
- raise ValueError("The variable 'plane' needs to be either 'x' or 'y'!")
149
-
150
- if twiss is None:
151
- twiss = line.twiss()
152
-
153
- beam_sizes = twiss.get_beam_covariance(nemitt_x=nemitt_x, nemitt_y=nemitt_y)
154
- beam_sizes = beam_sizes.rows[at_element:f'{at_element}>>1'][f'sigma_{plane}']
155
- sigma = beam_sizes[0] if match_at_front else beam_sizes[1]
156
- delta = (position_mm - betatron_cut*sigma - twiss.rows[at_element][plane])
157
- delta /= twiss.rows[at_element][f'd{plane}']
158
-
159
- return delta
160
-
161
-
162
- def _generate_4D_pencil_one_jaw(line, name, num_particles, plane, side, impact_parameter,
163
- pencil_spread, twiss=None, _capacity=None, **kwargs):
164
- coll = line[name]
165
- beam_sizes = twiss.get_beam_covariance(nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y)
166
-
167
- # Is it converging or diverging?
168
- # TODO: dispersion might change this
169
- # TODO: skew collimators
170
- tolerance_tilt = 1e-12 # 0.1 urad tolerance on jaw tilt => we prioritise converging
171
- divergence = coll.divergence
172
- if side == '+':
173
- if isinstance(coll, BaseCrystal):
174
- # A pencil on the crystal should always be upstream
175
- is_converging = True
176
- pencil_pos = coll.jaw_U + impact_parameter
177
- else:
178
- betatron_angle = coll.gap_L * divergence
179
- is_converging = coll.tilt_L + tolerance_tilt >= betatron_angle
180
- print(f"Left jaw of collimator {name} is {'con' if is_converging else 'di'}verging.")
181
- if is_converging:
182
- pencil_pos = coll.jaw_LU + impact_parameter
183
- else:
184
- pencil_pos = coll.jaw_LD + impact_parameter
185
- elif side == '-':
186
- if isinstance(coll, BaseCrystal):
187
- # A pencil on the crystal should always be upstream
188
- is_converging = True
189
- pencil_pos = coll.jaw_U - impact_parameter
190
- else:
191
- betatron_angle = coll.gap_R * divergence
192
- is_converging = coll.tilt_R - tolerance_tilt <= betatron_angle
193
- print(f"Right jaw of collimator {name} is {'con' if is_converging else 'di'}verging.")
194
- if is_converging:
195
- pencil_pos = coll.jaw_RU - impact_parameter
196
- else:
197
- pencil_pos = coll.jaw_RD - impact_parameter
198
- else:
199
- raise ValueError(f"Sinde {side} not supported in _generate_4D_pencil_one_jaw!")
200
-
201
- if is_converging:
202
- # pencil at front of jaw
203
- sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][0]
204
- tw_at_s = twiss.rows[name]
205
- at_element = name
206
- else:
207
- # pencil at back of jaw
208
- sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][1]
209
- tw_at_s = twiss.rows[f'{name}>>1']
210
- at_element = line.element_names[line.element_names.index(name)+1]
211
-
212
- dr_sigmas = pencil_spread/sigma
213
-
214
- # Collimator plane: generate pencil distribution
215
- pencil, p_pencil = xp.generate_2D_pencil_with_absolute_cut(
216
- num_particles, plane=plane, absolute_cut=pencil_pos, line=line,
217
- dr_sigmas=dr_sigmas, nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y,
218
- at_element=at_element, side=side, twiss=tw_at_s, **kwargs
219
- )
220
-
221
- # Other plane: generate gaussian distribution in normalized coordinates
222
- transverse_norm = np.random.normal(size=num_particles)
223
- p_transverse_norm = np.random.normal(size=num_particles)
224
-
225
- return pencil, p_pencil, transverse_norm, p_transverse_norm, is_converging, at_element
226
-
227
-
228
- def _generate_longitudinal_dist(line, num_particles, sigma_z, longitudinal):
229
- # TODO: make this more general, make this better
230
- if longitudinal is None:
231
- return 0, 0
232
- elif longitudinal == 'matched_dispersion':
233
- raise NotImplementedError
234
- # if longitudinal_betatron_cut is None:
235
- # cut = 0
236
- # else:
237
- # cut = np.random.uniform(-longitudinal_betatron_cut, longitudinal_betatron_cut,
238
- # num_particles)
239
- # delta = generate_delta_from_dispersion(line, name, plane=plane, position_mm=pencil,
240
- # nemitt_x=nemitt_x, nemitt_y=nemitt_y, twiss=tw,
241
- # betatron_cut=cut, match_at_front=is_converging)
242
- # zeta = 0
243
- elif longitudinal == 'bucket':
244
- return xp.generate_longitudinal_coordinates(
245
- num_particles=num_particles, distribution='gaussian', sigma_z=sigma_z, line=line
246
- )
247
- elif not hasattr(longitudinal, '__iter__'):
248
- raise ValueError
249
- elif len(longitudinal) != 2:
250
- raise ValueError
251
- elif isinstance(longitudinal, str):
252
- raise ValueError
253
- elif isinstance(longitudinal, dict):
254
- return longitudinal['zeta'], longitudinal['delta']
255
- else:
256
- return longitudinal[0], longitudinal[1]
@@ -1 +0,0 @@
1
- gitdir: ../../../../.git/modules/xcoll/scattering_routines/fluka/flukaio
@@ -1,2 +0,0 @@
1
- lib
2
- src/*.d
@@ -1,18 +0,0 @@
1
- PROJECT(FLUKA_IO)
2
- cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
3
-
4
- SET(LIBFLUKAIO_SOURCES src/Connection.c src/FlukaIO.c src/FlukaIOHandshake.c src/FlukaIOServer.c src/FortranFlukaIO.c src/NetIO.c)
5
-
6
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
7
-
8
- add_library(flukaIO STATIC ${LIBFLUKAIO_SOURCES})
9
-
10
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES AMD64 OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES i686)
11
- if(32BIT)
12
- target_compile_options(flukaIO PRIVATE -m32)
13
- endif(32BIT)
14
-
15
- if(64BIT)
16
- target_compile_options(flukaIO PRIVATE -m64)
17
- endif(64BIT)
18
- endif()
@@ -1,192 +0,0 @@
1
- #---------
2
- #
3
- # ComponentMakefile
4
- #
5
- # Include this file in your makefile
6
- # It makes
7
- # A static library
8
- # A test executable
9
- #
10
- # The necessary parameters are shown in
11
- # ComponentMakefileExampleParameters
12
- #
13
- # Inputs
14
- # SRC_FILES - Specific source files to build into library
15
- # SRC_DIRS - Directories od source file to built into the library
16
- # TEST_SRC - unit test code build into the unit test runner
17
- # MOCKS_SRC - mock objects build into the test runner
18
- # INCLUDES - List of -I files
19
- # CPPUTEST_CXXFLAGS - flags for the C++ compiler
20
- # CPPUTEST_CPPFLAGS - flags for the C++ AND C compiler
21
- # CPPUTEST_CFLAGS - C complier
22
- # CPPUTEST_LDFLAGS - Linker flags
23
- # TARGET_LIB - the created library
24
- # TEST_TARGET - the created test executable
25
- # OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make
26
- # other targets. Like CSlim, which is part of fitnesse
27
- #----------
28
-
29
- #Helper Functions
30
- get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c)
31
- get_dirs_from_dirspec = $(wildcard $1)
32
- get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir)))
33
- src_to_o = $(subst .c,.o, $(subst .cpp,.o,$1))
34
- src_to_d = $(subst .c,.d, $(subst .cpp,.d,$1))
35
- #move_file_location = $(patsubst %.d,build/%.d, $1)
36
- src_to = $(subst .c,$1, $(subst .cpp,$1,$2))
37
-
38
- #Derived
39
- STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB)
40
-
41
- SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES)
42
- OBJ = $(call src_to_o,$(SRC))
43
- STUFF_TO_CLEAN += $(OBJ)
44
-
45
- TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS))
46
- TEST_OBJS = $(call src_to_o,$(TEST_SRC))
47
- STUFF_TO_CLEAN += $(TEST_OBJS)
48
-
49
- MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS))
50
- MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC))
51
- STUFF_TO_CLEAN += $(MOCKS_OBJS)
52
-
53
- ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC)
54
-
55
- #Test coverage with gcov
56
- GCOV_OUTPUT = gcov_output.txt
57
- GCOV_REPORT = gcov_report.txt
58
- GCOV_ERROR = gcov_error.txt
59
- GCOV_GCDA_FILES = $(call src_to,.gcda, $(ALL_SRC))
60
- GCOV_GCNO_FILES = $(call src_to,.gcno, $(ALL_SRC))
61
- TEST_OUTPUT = $(TEST_TARGET).txt
62
- STUFF_TO_CLEAN += \
63
- $(GCOV_OUTPUT)\
64
- $(GCOV_REPORT)\
65
- $(GCOV_ERROR)\
66
- $(GCOV_GCDA_FILES)\
67
- $(GCOV_GCNO_FILES)\
68
- $(TEST_OUTPUT)
69
-
70
-
71
- #Other stuff needed
72
- CPPUTEST_LIB = $(CPPUTEST_HOME)/lib/libCppUTest.a
73
-
74
- CPPUTEST_CPPFLAGS += $(INCLUDES) $(GCOVFLAGS)
75
-
76
- #The gcda files for gcov need to be deleted before each run
77
- #To avoid annoying messages.
78
- GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR)
79
- RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET)
80
-
81
- ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" ""
82
- -include $(OTHER_MAKEFILE_TO_INCLUDE)
83
- endif
84
-
85
- ifneq "$(MAP_FILE)" ""
86
- CPPUTEST_LDFLAGS += -Wl,-map,$(MAP_FILE)
87
- endif
88
-
89
- INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS))
90
- INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir))
91
- MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS))
92
- INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir))
93
-
94
-
95
- DEP_FILES = $(call src_to_d, $(ALL_SRC))
96
- STUFF_TO_CLEAN += $(DEP_FILES) + $(PRODUCTION_CODE_START) + $(PRODUCTION_CODE_END)
97
- STUFF_TO_CLEAN += $(STDLIB_CODE_START) + $(MAP_FILE) + cpputest_*.xml junit_run_output
98
-
99
- # We'll use the CPPUTEST_CFLAGS etc so that you can override AND add to the CppUTest flags
100
- CFLAGS = $(CPPUTEST_CFLAGS) $(CPPUTEST_ADDITIONAL_CFLAGS)
101
- CPPFLAGS = $(CPPUTEST_CPPFLAGS) $(CPPUTEST_ADDITIONAL_CPPFLAGS)
102
- CXXFLAGS = $(CPPUTEST_CXXFLAGS) $(CPPUTEST_ADDITIONAL_CXXFLAGS)
103
- LDFLAGS = $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS)
104
-
105
- # Targets
106
- .PHONY: all
107
- all: $(TEST_TARGET)
108
- $(RUN_TEST_TARGET)
109
-
110
- .PHONY: all_no_tests
111
- all_no_tests: $(TEST_TARGET)
112
-
113
- .PHONY: flags
114
- flags:
115
- $(SILENCE)echo Compile with these flags:
116
- $(SILENCE)for f in $(CPPFLAGS) ; do \
117
- echo " C++ $$f" ; \
118
- done
119
- $(SILENCE)for f in $(CFLAGS) ; do \
120
- echo " C $$f" ; \
121
- done
122
- $(SILENCE)for f in $(LDFLAGS) ; do \
123
- echo " LD $$f" ; \
124
- done
125
- $(SILENCE)for f in $(ARFLAGS) ; do \
126
- echo " AR $$f" ; \
127
- done
128
-
129
-
130
- $(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(CPPUTEST_LIB) $(STDLIB_CODE_START)
131
- $(SILENCE)echo Linking $@
132
- $(SILENCE)echo command $(LINK.o) -o $@ $^ $(LD_LIBRARIES)
133
- $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES)
134
-
135
- $(TARGET_LIB): $(OBJ)
136
- $(SILENCE)echo Building archive $@
137
- $(SILENCE)mkdir -p lib
138
- $(SILENCE)echo command $(AR) $(ARFLAGS) $@ $^
139
- $(SILENCE)$(AR) $(ARFLAGS) $@ $^
140
- $(SILENCE)ranlib $@
141
-
142
- test: $(TEST_TARGET)
143
- $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT)
144
-
145
- vtest: $(TEST_TARGET)
146
- $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT)
147
-
148
- %.o: %.cpp
149
- @echo compiling $(notdir $<)
150
- $(SILENCE)echo command $(COMPILE.cpp) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
151
- $(SILENCE)$(COMPILE.cpp) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
152
- $(SILENCE)echo command $(COMPILE.cpp) $(OUTPUT_OPTION) $<
153
- $(SILENCE)$(COMPILE.cpp) $(OUTPUT_OPTION) $<
154
-
155
- %.o: %.c
156
- @echo compiling $(notdir $<)
157
- $(SILENCE)echo command $(COMPILE.c) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
158
- $(SILENCE)$(COMPILE.c) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
159
- $(SILENCE)echo command $(COMPILE.c) $(OUTPUT_OPTION) $<
160
- $(SILENCE)$(COMPILE.c) $(OUTPUT_OPTION) $<
161
-
162
- ifneq "$(MAKECMDGOALS)" "clean"
163
- -include $(DEP_FILES)
164
- endif
165
-
166
- .PHONY: clean
167
- clean:
168
- $(SILENCE)echo Making clean
169
- $(SILENCE)$(RM) -rf $(STUFF_TO_CLEAN)
170
- $(SILENCE)find . -name \*.gcov | xargs rm -f
171
-
172
- gcov: test
173
- $(SILENCE)for d in $(SRC_DIRS) ; do \
174
- gcov -o $$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
175
- done
176
- $(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
177
- cat $(GCOV_REPORT)
178
-
179
- .PHONEY: format
180
- format:
181
- $(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR)
182
-
183
- debug:
184
- echo Stuff to clean
185
- $(SILENCE)for f in $(STUFF_TO_CLEAN) ; do \
186
- echo "$$f" ; \
187
- done
188
- echo Includes
189
- $(SILENCE)for i in $(INCLUDES) ; do \
190
- echo "$$i" ; \
191
- done
192
-