xcoll 0.6.1__tar.gz → 0.6.2__tar.gz

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 (136) hide show
  1. {xcoll-0.6.1 → xcoll-0.6.2}/PKG-INFO +5 -4
  2. {xcoll-0.6.1 → xcoll-0.6.2}/pyproject.toml +3 -3
  3. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/general.py +1 -1
  4. xcoll-0.6.1/xcoll/__init__.py.orig +0 -26
  5. xcoll-0.6.1/xcoll/general.py.orig +0 -20
  6. xcoll-0.6.1/xcoll/initial_distribution.py.orig +0 -256
  7. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/.git +0 -1
  8. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/.gitignore +0 -2
  9. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/CMakeLists.txt +0 -18
  10. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/ComponentMakefile +0 -192
  11. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/Makefile +0 -144
  12. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/README +0 -26
  13. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/Doxyfile +0 -1551
  14. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.asciidoc +0 -1054
  15. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.epub +0 -0
  16. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.html +0 -1607
  17. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.pdf +0 -0
  18. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__1.png +0 -0
  19. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__2.png +0 -0
  20. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__3.png +0 -0
  21. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__4.png +0 -0
  22. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__5.png +0 -0
  23. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__6.png +0 -0
  24. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__7.png +0 -0
  25. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/Makefile +0 -8
  26. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/doc/docbook.xsl +0 -1690
  27. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/Connection.h +0 -79
  28. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FlukaIO.h +0 -58
  29. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FlukaIOServer.h +0 -33
  30. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/FortranFlukaIO.h +0 -277
  31. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/Message.h +0 -89
  32. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/include/ParticleInfo.h +0 -76
  33. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  34. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  35. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/ClientTest.c +0 -156
  36. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/ServerTest.c +0 -123
  37. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/fclient.f +0 -149
  38. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/samples/fserver.f +0 -118
  39. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.c +0 -264
  40. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.d +0 -69
  41. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  42. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.c +0 -211
  43. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +0 -46
  44. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  45. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.c +0 -45
  46. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +0 -29
  47. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.h +0 -17
  48. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  49. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.c +0 -84
  50. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +0 -70
  51. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  52. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer_private.h +0 -22
  53. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FlukaIO_private.h +0 -16
  54. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.c +0 -533
  55. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +0 -40
  56. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  57. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.c +0 -304
  58. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +0 -66
  59. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.h +0 -30
  60. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  61. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/src/tags +0 -167
  62. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/AllTests.cpp +0 -8
  63. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/CommonTest.h +0 -10
  64. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/ConnectionTest.cpp +0 -99
  65. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOServerTest.cpp +0 -104
  66. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOTest.cpp +0 -439
  67. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/FortranFlukaIOTest.cpp +0 -682
  68. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.c +0 -19
  69. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.h +0 -16
  70. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.c +0 -74
  71. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.h +0 -50
  72. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.c +0 -16
  73. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.h +0 -20
  74. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.c +0 -12
  75. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h +0 -18
  76. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h +0 -19
  77. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c +0 -80
  78. xcoll-0.6.1/xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h +0 -35
  79. {xcoll-0.6.1 → xcoll-0.6.2}/LICENSE +0 -0
  80. {xcoll-0.6.1 → xcoll-0.6.2}/NOTICE +0 -0
  81. {xcoll-0.6.1 → xcoll-0.6.2}/README.md +0 -0
  82. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/__init__.py +0 -0
  83. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/__init__.py +0 -0
  84. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/absorber.py +0 -0
  85. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/base.py +0 -0
  86. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/blowup.py +0 -0
  87. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/black_absorber.h +0 -0
  88. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/black_crystal.h +0 -0
  89. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/blowup.h +0 -0
  90. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/emittance_monitor.h +0 -0
  91. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/everest_block.h +0 -0
  92. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/everest_collimator.h +0 -0
  93. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/everest_crystal.h +0 -0
  94. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/transparent_collimator.h +0 -0
  95. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/elements_src/transparent_crystal.h +0 -0
  96. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/everest.py +0 -0
  97. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/monitor.py +0 -0
  98. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/beam_elements/transparent.py +0 -0
  99. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/colldb.py +0 -0
  100. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/headers/checks.h +0 -0
  101. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/headers/particle_states.py +0 -0
  102. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/initial_distribution.py +0 -0
  103. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/interaction_record/__init__.py +0 -0
  104. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/interaction_record/interaction_record.py +0 -0
  105. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/interaction_record/interaction_record_src/interaction_record.h +0 -0
  106. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/interaction_record/interaction_types.py +0 -0
  107. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/line_tools.py +0 -0
  108. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/lossmap.py +0 -0
  109. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/plot.py +0 -0
  110. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/rf_sweep.py +0 -0
  111. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/engine.py +0 -0
  112. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/environment.py +0 -0
  113. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/__init__.py +0 -0
  114. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/amorphous.h +0 -0
  115. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/channelling.h +0 -0
  116. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/constants.h +0 -0
  117. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/crystal_parameters.h +0 -0
  118. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/everest.h +0 -0
  119. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/everest.py +0 -0
  120. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/ionisation_loss.h +0 -0
  121. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/jaw.h +0 -0
  122. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/materials.py +0 -0
  123. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +0 -0
  124. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/nuclear_interaction.h +0 -0
  125. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/everest/properties.h +0 -0
  126. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/__init__.py +0 -0
  127. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/collimator_geometry.h +0 -0
  128. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/crystal_geometry.h +0 -0
  129. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/geometry.py +0 -0
  130. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/get_s.h +0 -0
  131. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/methods.h +0 -0
  132. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/objects.h +0 -0
  133. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/rotation.h +0 -0
  134. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/segments.h +0 -0
  135. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/scattering_routines/geometry/sort.h +0 -0
  136. {xcoll-0.6.1 → xcoll-0.6.2}/xcoll/xaux.py +0 -0
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "xcoll"
3
- version = "0.6.1"
3
+ version = "0.6.2"
4
4
  description = "Xsuite collimation package"
5
5
  homepage = "https://github.com/xsuite/xcoll"
6
6
  repository = "https://github.com/xsuite/xcoll"
@@ -17,7 +17,7 @@ authors = [
17
17
  ]
18
18
  readme = "README.md"
19
19
  license = "Apache 2.0"
20
- include = ["LICENSE", "NOTICE"]
20
+ exclude = ["xcoll/lib", "xcoll/config"]
21
21
 
22
22
 
23
23
  [tool.poetry.dependencies]
@@ -28,7 +28,7 @@ pandas = ">=1.4"
28
28
  xobjects = ">=0.5.0"
29
29
  xdeps = ">=0.10.5"
30
30
  xpart = ">=0.23.0"
31
- xtrack = ">=0.84.6"
31
+ xtrack = ">=0.84.8"
32
32
 
33
33
  [poetry.group.dev.dependencies]
34
34
  pytest = ">=7.3"
@@ -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,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
-
@@ -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
-