xfields 0.20.2__tar.gz → 0.20.3__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.
Files changed (173) hide show
  1. {xfields-0.20.2/xfields.egg-info → xfields-0.20.3}/PKG-INFO +1 -1
  2. {xfields-0.20.2 → xfields-0.20.3}/tests/test_compressed_profile_interp_result.py +1 -1
  3. xfields-0.20.3/tests/test_element_with_slicer_filling_scheme.py +189 -0
  4. {xfields-0.20.2 → xfields-0.20.3}/tests/test_slicer.py +39 -39
  5. {xfields-0.20.2 → xfields-0.20.3}/xfields/__init__.py +0 -3
  6. xfields-0.20.3/xfields/_version.py +1 -0
  7. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam2d.py +2 -2
  8. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam3d.py +2 -2
  9. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/element_with_slicer.py +38 -29
  10. xfields-0.20.3/xfields/beam_elements/waketracker/__init__.py +1 -0
  11. xfields-0.20.3/xfields/beam_elements/waketracker/convolution.py +209 -0
  12. xfields-0.20.3/xfields/beam_elements/waketracker/waketracker.py +196 -0
  13. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/compressed_profile.h +13 -9
  14. {xfields-0.20.2 → xfields-0.20.3}/xfields/slicers/compressed_profile.py +12 -8
  15. {xfields-0.20.2 → xfields-0.20.3}/xfields/slicers/slicers_src/uniform_bin_slicer.h +32 -101
  16. {xfields-0.20.2 → xfields-0.20.3}/xfields/slicers/uniform.py +53 -43
  17. {xfields-0.20.2 → xfields-0.20.3/xfields.egg-info}/PKG-INFO +1 -1
  18. {xfields-0.20.2 → xfields-0.20.3}/xfields.egg-info/SOURCES.txt +4 -65
  19. xfields-0.20.2/.gitignore +0 -13
  20. xfields-0.20.2/contributors_and_credits.txt +0 -14
  21. xfields-0.20.2/examples/000_sphere/.gitignore +0 -1
  22. xfields-0.20.2/examples/000_sphere/000_sphere_xfields3D.py +0 -167
  23. xfields-0.20.2/examples/000_sphere/001_sphere_xfields2p5D.py +0 -170
  24. xfields-0.20.2/examples/001_spacecharge/000_spacecharge_example.py +0 -152
  25. xfields-0.20.2/examples/001_spacecharge/001_shared_fieldmap.py +0 -152
  26. xfields-0.20.2/examples/001_spacecharge/002_spacecharge_with_losses.py +0 -33
  27. xfields-0.20.2/examples/002_beambeam/000_beambeam.py +0 -191
  28. xfields-0.20.2/examples/002_beambeam/001_beambeam3d.py +0 -165
  29. xfields-0.20.2/examples/002_beambeam/002_beambeam3d_old_interface.py +0 -136
  30. xfields-0.20.2/examples/002_beambeam/003_beambeam3d_strongstrong_track.py +0 -188
  31. xfields-0.20.2/examples/002_beambeam/004_beambeam2d_strongstrong_pyheadtail.py +0 -215
  32. xfields-0.20.2/examples/002_beambeam/005_beambeam6d_strongstrong_pipeline.py +0 -206
  33. xfields-0.20.2/examples/002_beambeam/006_beambeam6d_strongstrong_pipeline_MPI2Procs.py +0 -221
  34. xfields-0.20.2/examples/002_beambeam/007_beambeam3d_beamstrahlung.py +0 -381
  35. xfields-0.20.2/examples/002_beambeam/008_beambeam6d_collective_beamstrahlung.py +0 -392
  36. xfields-0.20.2/examples/002_beambeam/009_constant_charge_slicing.py +0 -46
  37. xfields-0.20.2/examples/002_beambeam/010_beambeam2d_strongstrong_pipeline.py +0 -167
  38. xfields-0.20.2/examples/002_beambeam/010_beambeam2d_weakstrong.py +0 -115
  39. xfields-0.20.2/examples/003_electronlens/electronlens_interpolated_ideal.py +0 -88
  40. xfields-0.20.2/examples/004_fadeeva/000_check_fadeeva.py +0 -139
  41. xfields-0.20.2/examples/005_ibs/000_growth_rates_from_parameters_no_vdisp.py +0 -118
  42. xfields-0.20.2/examples/005_ibs/001_growth_rates_from_parameters_with_vdisp.py +0 -75
  43. xfields-0.20.2/examples/005_ibs/002_growth_rates_from_particles.py +0 -118
  44. xfields-0.20.2/examples/005_ibs/003_tracking_with_kicks.py +0 -66
  45. xfields-0.20.2/examples/005_ibs/004_tracking_with_kicks_tbt_emittances.py +0 -94
  46. xfields-0.20.2/examples/005_wakefields/000_basic_wakefield_example.py +0 -132
  47. xfields-0.20.2/examples/005_wakefields/000_convolution_check.py +0 -426
  48. xfields-0.20.2/examples/005_wakefields/000_sum_wakefields.py +0 -134
  49. xfields-0.20.2/examples/005_wakefields/001_with_xfields_track_method.py +0 -351
  50. xfields-0.20.2/examples/005_wakefields/002_with_xsuite_tracking.py +0 -355
  51. xfields-0.20.2/examples/005_wakefields/003_with_xsuite_line.py +0 -232
  52. xfields-0.20.2/examples/005_wakefields/004_multiwake.py +0 -256
  53. xfields-0.20.2/examples/005_wakefields/005_multiwake_multibunch.py +0 -94
  54. xfields-0.20.2/examples/005_wakefields/006_multiwake_multibunch_2Particles.py +0 -169
  55. xfields-0.20.2/examples/005_wakefields/007_wake_multibunch_2Particles.py +0 -148
  56. xfields-0.20.2/examples/005_wakefields/008_hllhc_instability_single_bunch.py +0 -233
  57. xfields-0.20.2/examples/005_wakefields/t000_for_comparison.py +0 -382
  58. xfields-0.20.2/examples/longitudinal_kick_in_spacecharge/000_gaussian_3d.py +0 -140
  59. xfields-0.20.2/examples/longitudinal_kick_in_spacecharge/001_dev_spacecharge.py +0 -96
  60. xfields-0.20.2/examples/longitudinal_kick_in_spacecharge/002_sps_ion.py +0 -124
  61. xfields-0.20.2/examples/longitudinal_kick_in_spacecharge/003_sps_ion_with_builtin_z_kick.py +0 -118
  62. xfields-0.20.2/examples/longitudinal_kick_in_spacecharge/sps_ion_2021.json +0 -1
  63. xfields-0.20.2/examples/slicer/000_dev.py +0 -876
  64. xfields-0.20.2/examples/slicer/001_slicer_operations.py +0 -29
  65. xfields-0.20.2/examples/slicer/002_example_slicer.py +0 -92
  66. xfields-0.20.2/mktest +0 -1
  67. xfields-0.20.2/release.sh +0 -20
  68. xfields-0.20.2/requirements.txt +0 -2
  69. xfields-0.20.2/test_data/HLLHC_wake.dat +0 -2801
  70. xfields-0.20.2/test_data/beamstrahlung/guineapig_ttbar2_beamstrahlung_photon_energies_gev.txt +0 -238218
  71. xfields-0.20.2/tests/ibs_conftest.py +0 -158
  72. xfields-0.20.2/tests/pytest_onebyone.sh +0 -7
  73. xfields-0.20.2/tests/test_multiwake_longitudinal.py +0 -138
  74. xfields-0.20.2/tests/test_multiwake_transverse_constant.py +0 -162
  75. xfields-0.20.2/tests/test_multiwake_transverse_dipole_coupling.py +0 -142
  76. xfields-0.20.2/tests/test_multiwake_transverse_dipole_direct.py +0 -147
  77. xfields-0.20.2/tests/test_multiwake_transverse_quadrupole_coupling.py +0 -163
  78. xfields-0.20.2/tests/test_multiwake_transverse_quadrupole_direct.py +0 -161
  79. xfields-0.20.2/tests/test_transverse_damper.py +0 -142
  80. xfields-0.20.2/tests/test_wake_kick_sigle_bunch.py +0 -651
  81. xfields-0.20.2/update_cprght_statement.py +0 -48
  82. xfields-0.20.2/xfields/_version.py +0 -1
  83. xfields-0.20.2/xfields/beam_elements/transverse_damper.py +0 -101
  84. xfields-0.20.2/xfields/beam_elements/wakefield.py +0 -583
  85. {xfields-0.20.2 → xfields-0.20.3}/LICENSE +0 -0
  86. {xfields-0.20.2 → xfields-0.20.3}/MANIFEST.in +0 -0
  87. {xfields-0.20.2 → xfields-0.20.3}/README.md +0 -0
  88. {xfields-0.20.2 → xfields-0.20.3}/pyproject.toml +0 -0
  89. {xfields-0.20.2 → xfields-0.20.3}/setup.cfg +0 -0
  90. {xfields-0.20.2 → xfields-0.20.3}/setup.py +0 -0
  91. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeam2d.py +0 -0
  92. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeam3d_part1.py +0 -0
  93. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeam3d_part2.py +0 -0
  94. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeamstrongstrong2d.py +0 -0
  95. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeamstrongstrong2d_pi.py +0 -0
  96. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeamstrongstrong3d.py +0 -0
  97. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beambeamstrongstrong3d_pi.py +0 -0
  98. {xfields-0.20.2 → xfields-0.20.3}/tests/test_beamstrahlung.py +0 -0
  99. {xfields-0.20.2 → xfields-0.20.3}/tests/test_bhabha.py +0 -0
  100. {xfields-0.20.2 → xfields-0.20.3}/tests/test_cerrf.py +0 -0
  101. {xfields-0.20.2 → xfields-0.20.3}/tests/test_constant_charge_slicing.py +0 -0
  102. {xfields-0.20.2 → xfields-0.20.3}/tests/test_electroncloud.py +0 -0
  103. {xfields-0.20.2 → xfields-0.20.3}/tests/test_electronlens_interpolated.py +0 -0
  104. {xfields-0.20.2 → xfields-0.20.3}/tests/test_ibs_growth_rates.py +0 -0
  105. {xfields-0.20.2 → xfields-0.20.3}/tests/test_ibs_kicks.py +0 -0
  106. {xfields-0.20.2 → xfields-0.20.3}/tests/test_lumi.py +0 -0
  107. {xfields-0.20.2 → xfields-0.20.3}/tests/test_mean_std.py +0 -0
  108. {xfields-0.20.2 → xfields-0.20.3}/tests/test_profiles.py +0 -0
  109. {xfields-0.20.2 → xfields-0.20.3}/tests/test_spacecharge.py +0 -0
  110. {xfields-0.20.2 → xfields-0.20.3}/tests/test_temp_slicer.py +0 -0
  111. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/__init__.py +0 -0
  112. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam.h +0 -0
  113. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam2d.h +0 -0
  114. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam3d.h +0 -0
  115. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam3d_methods_for_strongstrong.h +0 -0
  116. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam3d_ref_frame_changes.h +0 -0
  117. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/beambeam_src/beambeam3d_transport_sigmas.h +0 -0
  118. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/electroncloud.py +0 -0
  119. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/electroncloud_src/electroncloud.h +0 -0
  120. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/electronlens_interpolated.py +0 -0
  121. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/electronlens_src/electronlens_interpolated.h +0 -0
  122. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/spacecharge.py +0 -0
  123. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/spacecharge_src/spacecharge3d.h +0 -0
  124. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/spacecharge_src/spacechargebigaussian.h +0 -0
  125. {xfields-0.20.2 → xfields-0.20.3}/xfields/beam_elements/temp_slicer.py +0 -0
  126. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/__init__.py +0 -0
  127. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/beambeam_config_tools/__init__.py +0 -0
  128. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/beambeam_config_tools/_madpoint.py +0 -0
  129. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/beambeam_config_tools/config_tools.py +0 -0
  130. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/beambeam_config_tools/orbit_dependent_configuration_tools.py +0 -0
  131. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/electroncloud_config_tools.py +0 -0
  132. {xfields-0.20.2 → xfields-0.20.3}/xfields/config_tools/spacecharge_config_tools.py +0 -0
  133. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/__init__.py +0 -0
  134. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian.py +0 -0
  135. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/bigaussian.h +0 -0
  136. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/bigaussian_fieldmap.h +0 -0
  137. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/compute_gx_gy.h +0 -0
  138. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/faddeeva.h +0 -0
  139. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/faddeeva_cernlib.h +0 -0
  140. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/bigaussian_src/faddeeva_mit.h +0 -0
  141. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated.py +0 -0
  142. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated_src/central_diff.h +0 -0
  143. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated_src/charge_deposition.h +0 -0
  144. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated_src/cubic_interpolators.h +0 -0
  145. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated_src/linear_interpolators.h +0 -0
  146. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/interpolated_src/tricubic_coefficients.h +0 -0
  147. {xfields-0.20.2 → xfields-0.20.3}/xfields/fieldmaps/tricubicinterpolated.py +0 -0
  148. {xfields-0.20.2 → xfields-0.20.3}/xfields/general.py +0 -0
  149. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/beamstrahlung_spectrum.h +0 -0
  150. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/bhabha_spectrum.h +0 -0
  151. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/compute_slice_moments.h +0 -0
  152. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/constants.h +0 -0
  153. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/particle_states.h +0 -0
  154. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/power_n.h +0 -0
  155. {xfields-0.20.2 → xfields-0.20.3}/xfields/headers/sincos.h +0 -0
  156. {xfields-0.20.2 → xfields-0.20.3}/xfields/ibs/__init__.py +0 -0
  157. {xfields-0.20.2 → xfields-0.20.3}/xfields/ibs/_analytical.py +0 -0
  158. {xfields-0.20.2 → xfields-0.20.3}/xfields/ibs/_api.py +0 -0
  159. {xfields-0.20.2 → xfields-0.20.3}/xfields/ibs/_formulary.py +0 -0
  160. {xfields-0.20.2 → xfields-0.20.3}/xfields/ibs/_kicks.py +0 -0
  161. {xfields-0.20.2 → xfields-0.20.3}/xfields/longitudinal_profiles/__init__.py +0 -0
  162. {xfields-0.20.2 → xfields-0.20.3}/xfields/longitudinal_profiles/coasting.py +0 -0
  163. {xfields-0.20.2 → xfields-0.20.3}/xfields/longitudinal_profiles/qgaussian.py +0 -0
  164. {xfields-0.20.2 → xfields-0.20.3}/xfields/longitudinal_profiles/qgaussian_src/qgaussian.h +0 -0
  165. {xfields-0.20.2 → xfields-0.20.3}/xfields/slicers/__init__.py +0 -0
  166. {xfields-0.20.2 → xfields-0.20.3}/xfields/solvers/__init__.py +0 -0
  167. {xfields-0.20.2 → xfields-0.20.3}/xfields/solvers/base.py +0 -0
  168. {xfields-0.20.2 → xfields-0.20.3}/xfields/solvers/fftsolvers.py +0 -0
  169. {xfields-0.20.2 → xfields-0.20.3}/xfields/test_support/__init__.py +0 -0
  170. {xfields-0.20.2 → xfields-0.20.3}/xfields/test_support/temp_makepart.py +0 -0
  171. {xfields-0.20.2 → xfields-0.20.3}/xfields.egg-info/dependency_links.txt +0 -0
  172. {xfields-0.20.2 → xfields-0.20.3}/xfields.egg-info/requires.txt +0 -0
  173. {xfields-0.20.2 → xfields-0.20.3}/xfields.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xfields
3
- Version: 0.20.2
3
+ Version: 0.20.3
4
4
  Summary: Field Maps and Particle In Cell
5
5
  Home-page: https://xsuite.readthedocs.io/
6
6
  Download-URL: https://pypi.python.org/pypi/xfields
@@ -67,7 +67,7 @@ def test_compressed_profile_interp_result():
67
67
  data_shape_1=comp_prof.data.shape[1],
68
68
  data_shape_2=comp_prof.data.shape[2],
69
69
  data=comp_prof.data,
70
- i_bunch_particles=np.zeros(num_parts, dtype=int),
70
+ i_slot_particles=np.zeros(num_parts, dtype=int),
71
71
  i_slice_particles=i_slice_particles,
72
72
  out=interpolated_result
73
73
  )
@@ -0,0 +1,189 @@
1
+ import xfields as xf
2
+ import xtrack as xt
3
+ import numpy as np
4
+ import xobjects as xo
5
+ import pytest
6
+
7
+
8
+ from xfields.beam_elements.element_with_slicer import ElementWithSlicer
9
+
10
+ @pytest.mark.parametrize('buffer_round_trip', [True, False])
11
+ @pytest.mark.parametrize('num_turns', [1, 2, 3])
12
+ def test_element_with_slicer_filling_scheme(buffer_round_trip, num_turns):
13
+ ele = ElementWithSlicer(
14
+ zeta_range=(-1, 1),
15
+ num_slices=10,
16
+ filling_scheme=[1, 0, 1, 1],
17
+ bunch_spacing_zeta=5,
18
+ num_turns=num_turns,
19
+ circumference=100,
20
+ with_compressed_profile=True)
21
+ slicer = ele.slicer
22
+
23
+ ele1 = ElementWithSlicer(
24
+ zeta_range=(-1, 1),
25
+ num_slices=10,
26
+ filling_scheme=[1, 0, 1, 1],
27
+ bunch_spacing_zeta=5,
28
+ num_turns=num_turns,
29
+ circumference=100,
30
+ bunch_selection=[1, 2],
31
+ with_compressed_profile=True)
32
+ slicer1 = ele1.slicer
33
+
34
+ ele2 = ElementWithSlicer(
35
+ zeta_range=(-1, 1),
36
+ num_slices=10,
37
+ filling_scheme=[1, 0, 1, 1],
38
+ bunch_spacing_zeta=5,
39
+ num_turns=num_turns,
40
+ circumference=100,
41
+ bunch_selection=[0],
42
+ with_compressed_profile=True)
43
+ slicer2 = ele2.slicer
44
+
45
+ zeta = np.linspace(-20, 20, 1000000)
46
+ particles = xt.Particles(p0c=7000e9,
47
+ zeta=zeta)
48
+
49
+ # different weight for the different bunches
50
+ zeta = particles.zeta
51
+ mask_bunch0 = (zeta > -1) & (zeta < 1)
52
+ particles.weight[mask_bunch0] = 1
53
+ mask_bunch1 = (zeta > -6) & (zeta < -4)
54
+ particles.weight[mask_bunch1] = 2
55
+ mask_bunch2 = (zeta > -11) & (zeta < -9)
56
+ particles.weight[mask_bunch2] = 3
57
+ mask_bunch3 = (zeta > -16) & (zeta < -14)
58
+ particles.weight[mask_bunch3] = 4
59
+
60
+ # line density
61
+ num_particles_bunch0 = np.sum(particles.weight[mask_bunch0])
62
+ xo.assert_allclose(num_particles_bunch0, 50000.0, rtol=1e-5, atol=0)
63
+
64
+ ele.track(particles)
65
+ ele1.track(particles)
66
+ ele2.track(particles)
67
+
68
+ if buffer_round_trip:
69
+ slicer = xf.UniformBinSlicer._from_npbuffer(slicer._to_npbuffer())
70
+ slicer1 = xf.UniformBinSlicer._from_npbuffer(slicer1._to_npbuffer())
71
+ slicer2 = xf.UniformBinSlicer._from_npbuffer(slicer2._to_npbuffer())
72
+
73
+ assert (slicer.filled_slots == np.array([0, 2, 3])).all()
74
+ assert (slicer1.filled_slots == np.array([0, 2, 3])).all()
75
+ assert (slicer2.filled_slots == np.array([0, 2, 3])).all()
76
+ assert (slicer.bunch_selection == np.array([0, 1, 2])).all()
77
+ assert (slicer1.bunch_selection == np.array([1, 2])).all()
78
+ assert (slicer2.bunch_selection == np.array([0])).all()
79
+ assert slicer.num_bunches == 3
80
+ assert slicer1.num_bunches == 2
81
+ assert slicer2.num_bunches == 1
82
+
83
+ xo.assert_allclose(slicer.zeta_centers,
84
+ np.array([[ -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9],
85
+ [-10.9, -10.7, -10.5, -10.3, -10.1, -9.9, -9.7, -9.5, -9.3, -9.1],
86
+ [-15.9, -15.7, -15.5, -15.3, -15.1, -14.9, -14.7, -14.5, -14.3, -14.1]]),
87
+ rtol=0, atol=1e-12)
88
+
89
+ xo.assert_allclose(slicer1.zeta_centers,
90
+ np.array([[-10.9, -10.7, -10.5, -10.3, -10.1, -9.9, -9.7, -9.5, -9.3, -9.1],
91
+ [-15.9, -15.7, -15.5, -15.3, -15.1, -14.9, -14.7, -14.5, -14.3, -14.1]]),
92
+ rtol=0, atol=1e-12)
93
+
94
+ xo.assert_allclose(slicer2.zeta_centers,
95
+ np.array([[-0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9]]),
96
+ rtol=0, atol=1e-12)
97
+
98
+ xo.assert_allclose(slicer.zeta_range[0], -1, rtol=0, atol=1e-12)
99
+ xo.assert_allclose(slicer1.zeta_range[0], -1, rtol=0, atol=1e-12)
100
+ xo.assert_allclose(slicer2.zeta_range[0], -1, rtol=0, atol=1e-12)
101
+ xo.assert_allclose(slicer.zeta_range[1], 1, rtol=0, atol=1e-12)
102
+ xo.assert_allclose(slicer1.zeta_range[1], 1, rtol=0, atol=1e-12)
103
+ xo.assert_allclose(slicer2.zeta_range[1], 1, rtol=0, atol=1e-12)
104
+
105
+ xo.assert_allclose(slicer.num_particles,
106
+ np.array([
107
+ [ 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000.],
108
+ [15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000.],
109
+ [20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000.]]),
110
+ rtol=0, atol=1e-12)
111
+
112
+ xo.assert_allclose(slicer1.num_particles,
113
+ np.array([
114
+ [15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000., 15000.],
115
+ [20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000.]]),
116
+ rtol=0, atol=1e-12)
117
+
118
+ xo.assert_allclose(slicer2.num_particles,
119
+ np.array([
120
+ [ 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000.],
121
+ ]),
122
+ rtol=0, atol=1e-12)
123
+
124
+ z_prof, prof = ele.moments_data.get_moment_profile('num_particles', i_turn=0)
125
+ xo.assert_allclose(z_prof,
126
+ np.array([-15.9, -15.7, -15.5, -15.3, -15.1, -14.9, -14.7, -14.5, -14.3,
127
+ -14.1, -10.9, -10.7, -10.5, -10.3, -10.1, -9.9, -9.7, -9.5,
128
+ -9.3, -9.1, -5.9, -5.7, -5.5, -5.3, -5.1, -4.9, -4.7,
129
+ -4.5, -4.3, -4.1, -0.9, -0.7, -0.5, -0.3, -0.1, 0.1,
130
+ 0.3, 0.5, 0.7, 0.9]), rtol=0, atol=1e-12)
131
+ z_prof1, prof1 = ele1.moments_data.get_moment_profile('num_particles', i_turn=0)
132
+ z_prof2, prof2 = ele2.moments_data.get_moment_profile('num_particles', i_turn=0)
133
+
134
+ xo.assert_allclose(z_prof, z_prof1, rtol=0, atol=1e-12)
135
+ xo.assert_allclose(z_prof, z_prof2, rtol=0, atol=1e-12)
136
+
137
+ xo.assert_allclose(prof,
138
+ np.array([20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000.,
139
+ 20000., 20000., 15000., 15000., 15000., 15000., 15000., 15000.,
140
+ 15000., 15000., 15000., 15000., 0., 0., 0., 0.,
141
+ 0., 0., 0., 0., 0., 0., 5000., 5000.,
142
+ 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000.]),
143
+ rtol=0, atol=1e-12)
144
+
145
+ xo.assert_allclose(prof1,
146
+ np.array([20000., 20000., 20000., 20000., 20000., 20000., 20000., 20000.,
147
+ 20000., 20000., 15000., 15000., 15000., 15000., 15000., 15000.,
148
+ 15000., 15000., 15000., 15000., 0., 0., 0., 0.,
149
+ 0., 0., 0., 0., 0., 0., 0., 0.,
150
+ 0., 0., 0., 0., 0., 0., 0., 0.]),
151
+ rtol=0, atol=1e-12)
152
+
153
+ xo.assert_allclose(prof2,
154
+ np.array([ 0., 0., 0., 0., 0., 0., 0., 0., 0.,
155
+ 0., 0., 0., 0., 0., 0., 0., 0., 0.,
156
+ 0., 0., 0., 0., 0., 0., 0., 0., 0.,
157
+ 0., 0., 0., 5000., 5000., 5000., 5000., 5000., 5000.,
158
+ 5000., 5000., 5000., 5000.]),
159
+ rtol=0, atol=1e-12)
160
+
161
+ ele1._add_slicer_moments_to_moments_data(ele2.slicer)
162
+ ele2._add_slicer_moments_to_moments_data(ele1.slicer)
163
+
164
+ z_prof1_sum, prof1_sum = ele1.moments_data.get_moment_profile('num_particles', i_turn=0)
165
+ z_prof2_sum, prof2_sum = ele2.moments_data.get_moment_profile('num_particles', i_turn=0)
166
+
167
+ xo.assert_allclose(z_prof1_sum, z_prof, rtol=0, atol=1e-12)
168
+ xo.assert_allclose(z_prof2_sum, z_prof, rtol=0, atol=1e-12)
169
+ xo.assert_allclose(prof1_sum, prof, rtol=0, atol=1e-12)
170
+ xo.assert_allclose(prof2_sum, prof, rtol=0, atol=1e-12)
171
+
172
+ for i_turn in range(1, num_turns):
173
+ particles.weight *= 2
174
+ ele.track(particles)
175
+ ele1.track(particles)
176
+ ele2.track(particles)
177
+ ele1._add_slicer_moments_to_moments_data(ele2.slicer)
178
+ ele2._add_slicer_moments_to_moments_data(ele1.slicer)
179
+
180
+ for i_check in range(1, num_turns):
181
+ z_prof_turn, prof_turn = ele.moments_data.get_moment_profile('num_particles', i_turn=i_check)
182
+ z_prof1_turn, prof1_turn = ele1.moments_data.get_moment_profile('num_particles', i_turn=i_check)
183
+ z_prof2_turn, prof2_turn = ele2.moments_data.get_moment_profile('num_particles', i_turn=i_check)
184
+ xo.assert_allclose(z_prof_turn, z_prof, rtol=0, atol=1e-12)
185
+ xo.assert_allclose(z_prof1_turn, z_prof, rtol=0, atol=1e-12)
186
+ xo.assert_allclose(z_prof2_turn, z_prof, rtol=0, atol=1e-12)
187
+
188
+ xo.assert_allclose(prof_turn, (2**(num_turns-1-i_check)) * prof, rtol=0, atol=1e-12)
189
+
@@ -33,7 +33,7 @@ def test_slicer_zeta(test_context):
33
33
  def test_slice_attribution_single_bunch(test_context):
34
34
  slicer = xf.UniformBinSlicer(zeta_range=(-1, 1), num_slices=3,
35
35
  _context=test_context)
36
- assert slicer.num_bunches == 1 # Single-bunch mode
36
+ assert slicer.num_bunches == 1
37
37
 
38
38
  p0 = xt.Particles(
39
39
  zeta=[-2, -1.51, -1.49, -1, -0.51, -0.49, 0, 0.49, 0.51, 1, 1.49, 1.51,
@@ -54,15 +54,15 @@ def test_slice_attribution_single_bunch(test_context):
54
54
  i_slice_expected = [-1, -1, -1, 0, 0, 0, 1, 2, 2, -1, -1, -1, -1, -999]
55
55
  i_bunch_expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9999]
56
56
  i_slice_particles = p.particle_id * 0 - 999
57
- i_bunch_particles = p.particle_id * 0 - 9999
58
- slicer.slice(particles=p, i_bunch_particles=i_bunch_particles,
57
+ i_slot_particles = p.particle_id * 0 - 9999
58
+ slicer.slice(particles=p, i_slot_particles=i_slot_particles,
59
59
  i_slice_particles=i_slice_particles)
60
60
 
61
61
  xo.assert_allclose(np.array(i_slice_expected), i_slice_particles, atol=0, rtol=0)
62
- xo.assert_allclose(i_bunch_particles, i_bunch_expected, atol=0, rtol=0)
62
+ xo.assert_allclose(i_slot_particles, i_bunch_expected, atol=0, rtol=0)
63
63
 
64
64
  expected_num_particles = np.array([40, 20, 50])
65
- xo.assert_allclose(slicer.num_particles[0, :], expected_num_particles,
65
+ xo.assert_allclose(slicer.num_particles, expected_num_particles,
66
66
  atol=1e-12, rtol=0)
67
67
 
68
68
 
@@ -97,7 +97,7 @@ def test_slice_attribution_multi_bunch(test_context):
97
97
 
98
98
  p = xt.Particles.merge([p1, p2, p3, p4])
99
99
 
100
- i_bunch_particles = p.particle_id * 0 - 999
100
+ i_slot_particles = p.particle_id * 0 - 999
101
101
  i_slice_particles = p.particle_id * 0 - 999
102
102
 
103
103
  slicer = xf.UniformBinSlicer(zeta_range=(-1, 1), num_slices=3,
@@ -106,7 +106,7 @@ def test_slice_attribution_multi_bunch(test_context):
106
106
  _context=test_context)
107
107
  slicer.slice(particles=p,
108
108
  i_slice_particles=i_slice_particles,
109
- i_bunch_particles=i_bunch_particles)
109
+ i_slot_particles=i_slot_particles)
110
110
 
111
111
  # when we merge the particles the ones with state zero end up at the end so
112
112
  # the -999 are now at the end of the array
@@ -128,8 +128,8 @@ def test_slice_attribution_multi_bunch(test_context):
128
128
  [40000, 20000, 50000],
129
129
  ])
130
130
 
131
+ xo.assert_allclose(i_slot_particles, i_bunch_expected_mb, rtol=0, atol=0)
131
132
  xo.assert_allclose(i_slice_particles, i_slice_expected_mb, rtol=0, atol=0)
132
- xo.assert_allclose(i_bunch_particles, i_bunch_expected_mb, rtol=0, atol=0)
133
133
  xo.assert_allclose(slicer.num_particles, expected_num_particles_mb,
134
134
  atol=1e-12, rtol=0)
135
135
 
@@ -175,51 +175,51 @@ def test_slicer_moments_single_bunch(test_context):
175
175
  xo.assert_allclose(sl.zeta_centers, np.array([-2 / 3, 0, 2 / 3]),
176
176
  rtol=0,
177
177
  atol=1e-12)
178
- xo.assert_allclose(sl.num_particles[0, :], [0, 0, p.weight.sum()], rtol=0,
178
+ xo.assert_allclose(sl.num_particles, [0, 0, p.weight.sum()], rtol=0,
179
179
  atol=1e-12)
180
- xo.assert_allclose(sl.sum('x')[0, :], [0, 0, (p.x * p.weight).sum()], rtol=0,
180
+ xo.assert_allclose(sl.sum('x'), [0, 0, (p.x * p.weight).sum()], rtol=0,
181
181
  atol=1e-12)
182
- xo.assert_allclose(sl.sum('y')[0, :], [0, 0, (p.y * p.weight).sum()], rtol=0,
182
+ xo.assert_allclose(sl.sum('y'), [0, 0, (p.y * p.weight).sum()], rtol=0,
183
183
  atol=1e-12)
184
- xo.assert_allclose(sl.sum('zeta')[0, :], [0, 0, (p.zeta * p.weight).sum()],
184
+ xo.assert_allclose(sl.sum('zeta'), [0, 0, (p.zeta * p.weight).sum()],
185
185
  rtol=0, atol=1e-12)
186
- xo.assert_allclose(sl.sum('xx')[0, :], [0, 0, (p.x ** 2 * p.weight).sum()],
186
+ xo.assert_allclose(sl.sum('xx'), [0, 0, (p.x ** 2 * p.weight).sum()],
187
187
  rtol=0,
188
188
  atol=1e-12)
189
- xo.assert_allclose(sl.sum('yy')[0, :], [0, 0, (p.y ** 2 * p.weight).sum()],
189
+ xo.assert_allclose(sl.sum('yy'), [0, 0, (p.y ** 2 * p.weight).sum()],
190
190
  rtol=0,
191
191
  atol=1e-12)
192
- xo.assert_allclose(sl.sum('zetazeta')[0, :],
192
+ xo.assert_allclose(sl.sum('zetazeta'),
193
193
  [0, 0, (p.zeta ** 2 * p.weight).sum()],
194
194
  rtol=0, atol=1e-12)
195
- xo.assert_allclose(sl.sum('xy')[0, :], [0, 0, (p.x * p.y * p.weight).sum()],
195
+ xo.assert_allclose(sl.sum('xy'), [0, 0, (p.x * p.y * p.weight).sum()],
196
196
  rtol=0, atol=1e-12)
197
- xo.assert_allclose(sl.sum('xzeta')[0, :],
197
+ xo.assert_allclose(sl.sum('xzeta'),
198
198
  [0, 0, (p.x * p.zeta * p.weight).sum()],
199
199
  rtol=0, atol=1e-12)
200
- xo.assert_allclose(sl.mean('x')[0, :],
200
+ xo.assert_allclose(sl.mean('x'),
201
201
  [0, 0, (p.x * p.weight).sum() / p.weight.sum()],
202
202
  rtol=0,
203
203
  atol=1e-12)
204
- xo.assert_allclose(sl.mean('y')[0, :],
204
+ xo.assert_allclose(sl.mean('y'),
205
205
  [0, 0, (p.y * p.weight).sum() / p.weight.sum()],
206
206
  rtol=0,
207
207
  atol=1e-12)
208
- xo.assert_allclose(sl.mean('xx')[0, :],
208
+ xo.assert_allclose(sl.mean('xx'),
209
209
  [0, 0, (p.x ** 2 * p.weight).sum() / p.weight.sum()],
210
210
  rtol=0, atol=1e-12)
211
- xo.assert_allclose(sl.mean('yy')[0, :],
211
+ xo.assert_allclose(sl.mean('yy'),
212
212
  [0, 0, (p.y ** 2 * p.weight).sum() / p.weight.sum()],
213
213
  rtol=0, atol=1e-12)
214
- xo.assert_allclose(sl.mean('zetazeta')[0, :],
214
+ xo.assert_allclose(sl.mean('zetazeta'),
215
215
  [0, 0,
216
216
  (p.zeta ** 2 * p.weight).sum() / p.weight.sum()],
217
217
  rtol=0, atol=1e-12)
218
- xo.assert_allclose(sl.mean('xy')[0, :],
218
+ xo.assert_allclose(sl.mean('xy'),
219
219
  [0, 0,
220
220
  (p.x * p.y * p.weight).sum() / p.weight.sum()],
221
221
  rtol=0, atol=1e-12)
222
- xo.assert_allclose(sl.mean('xzeta')[0, :],
222
+ xo.assert_allclose(sl.mean('xzeta'),
223
223
  [0, 0,
224
224
  (p.x * p.zeta * p.weight).sum() / p.weight.sum()],
225
225
  rtol=0, atol=1e-12)
@@ -296,50 +296,50 @@ def test_slicer_moments_single_bunch(test_context):
296
296
  xo.assert_allclose(sl.zeta_centers, np.array([-2 / 3, 0, 2 / 3]),
297
297
  rtol=0,
298
298
  atol=1e-12)
299
- xo.assert_allclose(sl.num_particles[0, :], [0, 0, p.weight.sum()], rtol=0,
299
+ xo.assert_allclose(sl.num_particles, [0, 0, p.weight.sum()], rtol=0,
300
300
  atol=1e-12)
301
- xo.assert_allclose(sl.sum(c1_name)[0], [0, 0, (c1 * p.weight).sum()],
301
+ xo.assert_allclose(sl.sum(c1_name), [0, 0, (c1 * p.weight).sum()],
302
302
  rtol=0, atol=1e-12)
303
- xo.assert_allclose(sl.sum(c2_name)[0], [0, 0, (c2 * p.weight).sum()],
303
+ xo.assert_allclose(sl.sum(c2_name), [0, 0, (c2 * p.weight).sum()],
304
304
  rtol=0, atol=1e-12)
305
- xo.assert_allclose(sl.sum('zeta')[0],
305
+ xo.assert_allclose(sl.sum('zeta'),
306
306
  [0, 0, (p.zeta * p.weight).sum()],
307
307
  rtol=0, atol=1e-12)
308
- xo.assert_allclose(sl.sum(c1_name + c1_name)[0],
308
+ xo.assert_allclose(sl.sum(c1_name + c1_name),
309
309
  [0, 0, (c1 ** 2 * p.weight).sum()],
310
310
  rtol=0, atol=1e-12)
311
- xo.assert_allclose(sl.sum(c2_name + c2_name)[0],
311
+ xo.assert_allclose(sl.sum(c2_name + c2_name),
312
312
  [0, 0, (c2 ** 2 * p.weight).sum()],
313
313
  rtol=0, atol=1e-12)
314
- xo.assert_allclose(sl.sum(c1_name + c2_name)[0],
314
+ xo.assert_allclose(sl.sum(c1_name + c2_name),
315
315
  [0, 0, (c1 * c2 * p.weight).sum()],
316
316
  rtol=0, atol=1e-12)
317
- xo.assert_allclose(sl.sum('zetazeta')[0],
317
+ xo.assert_allclose(sl.sum('zetazeta'),
318
318
  [0, 0, (p.zeta ** 2 * p.weight).sum()],
319
319
  rtol=0, atol=1e-12)
320
- xo.assert_allclose(sl.sum(c1_name + 'zeta')[0],
320
+ xo.assert_allclose(sl.sum(c1_name + 'zeta'),
321
321
  [0, 0, (c1 * p.zeta * p.weight).sum()],
322
322
  rtol=0, atol=1e-12)
323
- xo.assert_allclose(sl.mean(c1_name)[0],
323
+ xo.assert_allclose(sl.mean(c1_name),
324
324
  [0, 0, (c1 * p.weight).sum() / p.weight.sum()],
325
325
  rtol=0, atol=1e-12)
326
- xo.assert_allclose(sl.mean(c2_name)[0],
326
+ xo.assert_allclose(sl.mean(c2_name),
327
327
  [0, 0, (c2 * p.weight).sum() / p.weight.sum()],
328
328
  rtol=0, atol=1e-12)
329
- xo.assert_allclose(sl.mean(c1_name + c1_name)[0],
329
+ xo.assert_allclose(sl.mean(c1_name + c1_name),
330
330
  [0, 0,
331
331
  (c1 ** 2 * p.weight).sum() / p.weight.sum()],
332
332
  rtol=0, atol=1e-12)
333
- xo.assert_allclose(sl.mean(c2_name + c2_name)[0],
333
+ xo.assert_allclose(sl.mean(c2_name + c2_name),
334
334
  [0, 0,
335
335
  (c2 ** 2 * p.weight).sum() / p.weight.sum()],
336
336
  rtol=0, atol=1e-12)
337
- xo.assert_allclose(sl.mean(c1_name + c2_name)[0],
337
+ xo.assert_allclose(sl.mean(c1_name + c2_name),
338
338
  [0, 0,
339
339
  (c1 * c2 * p.weight).sum() / p.weight.sum()],
340
340
  rtol=0, atol=1e-12)
341
341
  xo.assert_allclose(
342
- sl.mean(c1_name + 'zeta')[0],
342
+ sl.mean(c1_name + 'zeta'),
343
343
  [0, 0, (c1 * p.zeta * p.weight).sum() / p.weight.sum()],
344
344
  rtol=0, atol=1e-12)
345
345
  xo.assert_allclose(
@@ -24,9 +24,6 @@ from .beam_elements.beambeam3d import ConfigForUpdateBeamBeamBiGaussian3D
24
24
  from .beam_elements.temp_slicer import TempSlicer
25
25
  from .beam_elements.electroncloud import ElectronCloud
26
26
  from .beam_elements.electronlens_interpolated import ElectronLensInterpolated
27
- from .beam_elements.wakefield import WakeComponent, ResonatorWake
28
- from .beam_elements.wakefield import Wakefield
29
- from .beam_elements.transverse_damper import TransverseDamper
30
27
 
31
28
  from .general import _pkg_root
32
29
  from .config_tools import replace_spacecharge_with_quasi_frozen
@@ -0,0 +1 @@
1
+ __version__ = "0.20.3"
@@ -240,11 +240,11 @@ class BeamBeamBiGaussian2D(xt.BeamElement):
240
240
  particles.at_turn[0],
241
241
  internal_tag=0)
242
242
 
243
- if self.config_for_update.pipeline_manager.is_ready_to_recieve(self.config_for_update.element_name,
243
+ if self.config_for_update.pipeline_manager.is_ready_to_receive(self.config_for_update.element_name,
244
244
  self.config_for_update.partner_particles_name,
245
245
  particles.name,
246
246
  internal_tag=0):
247
- self.config_for_update.pipeline_manager.recieve_message(self.partner_moments,
247
+ self.config_for_update.pipeline_manager.receive_message(self.partner_moments,
248
248
  self.config_for_update.element_name,
249
249
  self.config_for_update.partner_particles_name,
250
250
  particles.name,
@@ -782,11 +782,11 @@ class BeamBeamBiGaussian3D(xt.BeamElement):
782
782
  self.config_for_update.partner_particles_name,
783
783
  at_turn,
784
784
  internal_tag=self.config_for_update._i_step)
785
- if self.config_for_update.pipeline_manager.is_ready_to_recieve(self.config_for_update.element_name,
785
+ if self.config_for_update.pipeline_manager.is_ready_to_receive(self.config_for_update.element_name,
786
786
  self.config_for_update.partner_particles_name,
787
787
  particles.name,
788
788
  internal_tag=self.config_for_update._i_step):
789
- self.config_for_update.pipeline_manager.recieve_message(self.partner_moments,
789
+ self.config_for_update.pipeline_manager.receive_message(self.partner_moments,
790
790
  self.config_for_update.element_name,
791
791
  self.config_for_update.partner_particles_name,
792
792
  particles.name,
@@ -24,7 +24,7 @@ class ElementWithSlicer:
24
24
  of the array is equal to the number of slots in the machine and each
25
25
  element of the array holds a one if the slot is filled or a zero
26
26
  otherwise.
27
- bunch_numbers: np.ndarray
27
+ bunch_selection: np.ndarray
28
28
  List of the bunches indicating which slots from the filling scheme are
29
29
  used (not all the bunches are used when using multi-processing)
30
30
  num_turns : int
@@ -44,13 +44,16 @@ class ElementWithSlicer:
44
44
  num_slices=None, # Per bunch, this is N_1 in the paper
45
45
  bunch_spacing_zeta=None, # This is P in the paper
46
46
  filling_scheme=None,
47
- bunch_numbers=None,
47
+ bunch_selection=None,
48
48
  num_turns=1,
49
49
  circumference=None,
50
- _flatten=False,
51
50
  with_compressed_profile=False):
52
51
 
53
52
  self.with_compressed_profile = with_compressed_profile
53
+ self.pipeline_manager = None
54
+
55
+ if slicer_moments is None:
56
+ slicer_moments = ['num_particles']
54
57
 
55
58
  self.source_moments = slicer_moments.copy()
56
59
 
@@ -61,7 +64,7 @@ class ElementWithSlicer:
61
64
  self.init_slicer(zeta_range=zeta_range,
62
65
  num_slices=num_slices,
63
66
  filling_scheme=filling_scheme,
64
- bunch_numbers=bunch_numbers,
67
+ bunch_selection=bunch_selection,
65
68
  bunch_spacing_zeta=bunch_spacing_zeta,
66
69
  slicer_moments=slicer_moments)
67
70
 
@@ -75,7 +78,7 @@ class ElementWithSlicer:
75
78
  circumference=circumference)
76
79
 
77
80
  def init_slicer(self, zeta_range, num_slices, filling_scheme,
78
- bunch_numbers, bunch_spacing_zeta, slicer_moments):
81
+ bunch_selection, bunch_spacing_zeta, slicer_moments):
79
82
  if zeta_range is not None:
80
83
  if 'num_particles' in slicer_moments:
81
84
  slicer_moments.remove('num_particles')
@@ -83,7 +86,7 @@ class ElementWithSlicer:
83
86
  zeta_range=zeta_range,
84
87
  num_slices=num_slices,
85
88
  filling_scheme=filling_scheme,
86
- bunch_numbers=bunch_numbers,
89
+ bunch_selection=bunch_selection,
87
90
  bunch_spacing_zeta=bunch_spacing_zeta,
88
91
  moments=slicer_moments
89
92
  )
@@ -100,19 +103,23 @@ class ElementWithSlicer:
100
103
  num_turns=1,
101
104
  circumference=None):
102
105
 
106
+ if filling_scheme is not None:
107
+ i_last_bunch = np.where(filling_scheme)[0][-1]
108
+ num_periods = i_last_bunch + 1
109
+ else:
110
+ num_periods = 1
103
111
  self.moments_data = CompressedProfile(
104
112
  moments=self.source_moments + ['result'],
105
113
  zeta_range=zeta_range,
106
114
  num_slices=num_slices,
107
115
  bunch_spacing_zeta=bunch_spacing_zeta,
108
- num_periods=(len(filling_scheme) if filling_scheme is not None
109
- else 1),
116
+ num_periods=num_periods,
110
117
  num_turns=num_turns,
111
118
  circumference=circumference)
112
119
 
113
- def init_pipeline(self, pipeline_manager, element_name, partners_names):
120
+ def init_pipeline(self, pipeline_manager, element_name, partner_names):
114
121
  self.pipeline_manager = pipeline_manager
115
- self.partners_names = partners_names
122
+ self.partner_names = partner_names
116
123
  self.name = element_name
117
124
 
118
125
  self._send_buffer = self.slicer._to_npbuffer()
@@ -137,15 +144,15 @@ class ElementWithSlicer:
137
144
  def _slice_and_store(self, particles, _slice_result=None):
138
145
  if _slice_result is not None:
139
146
  self.i_slice_particles = _slice_result['i_slice_particles']
140
- self.i_bunch_particles = _slice_result['i_bunch_particles']
147
+ self.i_slot_particles = _slice_result['i_slot_particles']
141
148
  self.slicer = _slice_result['slicer']
142
149
  else:
143
150
  # Measure slice moments and get slice indeces
144
151
  self.i_slice_particles = particles.particle_id * 0 + -999
145
- self.i_bunch_particles = particles.particle_id * 0 + -9999
152
+ self.i_slot_particles = particles.particle_id * 0 + -9999
146
153
  self.slicer.slice(particles,
147
154
  i_slice_particles=self.i_slice_particles,
148
- i_bunch_particles=self.i_bunch_particles)
155
+ i_slot_particles=self.i_slot_particles)
149
156
 
150
157
  def _add_slicer_moments_to_moments_data(self, slicer):
151
158
  if not self.with_compressed_profile:
@@ -158,12 +165,13 @@ class ElementWithSlicer:
158
165
  continue
159
166
  means[mm] = slicer.mean(mm)
160
167
 
161
- for i_bunch_in_slicer, bunch_number in enumerate(slicer.bunch_numbers):
168
+ for i_bunch_in_slicer, bunch_number in enumerate(slicer.bunch_selection):
162
169
  moments_bunch = {}
163
170
  for nn in means.keys():
164
- moments_bunch[nn] = means[nn][i_bunch_in_slicer, :]
165
- moments_bunch['num_particles'] = (
166
- slicer.num_particles[i_bunch_in_slicer, :])
171
+ moments_bunch[nn] = np.atleast_2d(means[nn])[i_bunch_in_slicer, :]
172
+
173
+ moments_bunch['num_particles'] = np.atleast_2d(slicer.num_particles)[i_bunch_in_slicer, :]
174
+
167
175
  self.moments_data.set_moments(
168
176
  moments=moments_bunch,
169
177
  i_turn=0,
@@ -192,7 +200,7 @@ class ElementWithSlicer:
192
200
  self.other_bunch_slicers = []
193
201
  is_ready_to_send = True
194
202
 
195
- for i_partner, partner_name in enumerate(self.partners_names):
203
+ for partner_name in self.partner_names:
196
204
  if not self.pipeline_manager.is_ready_to_send(
197
205
  self.name,
198
206
  particles.name,
@@ -207,12 +215,12 @@ class ElementWithSlicer:
207
215
  self._update_moments_for_new_turn(particles,
208
216
  _slice_result=_slice_result)
209
217
  self._slicer_to_buffer(self.slicer)
210
- for i_partner, partner_name in enumerate(self.partners_names):
218
+ for partner_name in self.partner_names:
211
219
  self.pipeline_manager.send_message(
212
220
  self._send_buffer_length,
213
221
  element_name=self.name,
214
222
  sender_name=particles.name,
215
- reciever_name=partner_name,
223
+ receiver_name=partner_name,
216
224
  turn=particles.at_turn[0],
217
225
  internal_tag=0
218
226
  )
@@ -220,26 +228,27 @@ class ElementWithSlicer:
220
228
  self._send_buffer,
221
229
  element_name=self.name,
222
230
  sender_name=particles.name,
223
- reciever_name=partner_name,
231
+ receiver_name=partner_name,
224
232
  turn=particles.at_turn[0],
225
233
  internal_tag=1)
226
234
 
227
- for i_partner, partner_name in enumerate(self.partners_names):
228
- if not self.pipeline_manager.is_ready_to_recieve(
229
- self.name, partner_name,
230
- particles.name, internal_tag=0):
235
+ for partner_name in self.partner_names:
236
+ if not self.pipeline_manager.is_ready_to_receive(
237
+ self.name, partner_name,
238
+ particles.name, internal_tag=0):
231
239
  return xt.PipelineStatus(on_hold=True)
232
240
 
233
241
  if self.pipeline_manager is not None:
234
- for i_partner, partner_name in enumerate(self.partners_names):
235
- self.pipeline_manager.recieve_message(
242
+ for partner_name in self.partner_names:
243
+ self.pipeline_manager.receive_message(
236
244
  self._recv_buffer_length_buffer,
237
245
  self.name,
238
246
  partner_name,
239
247
  particles.name,
240
248
  internal_tag=0)
249
+
241
250
  self._ensure_recv_buffer_size()
242
- self.pipeline_manager.recieve_message(self._recv_buffer,
251
+ self.pipeline_manager.receive_message(self._recv_buffer,
243
252
  self.name,
244
253
  partner_name,
245
254
  particles.name,
@@ -257,5 +266,5 @@ class ElementWithSlicer:
257
266
 
258
267
  if not self.with_compressed_profile:
259
268
  self._slice_result = {'i_slice_particles': self.i_slice_particles,
260
- 'i_bunch_particles': self.i_bunch_particles,
269
+ 'i_slot_particles': self.i_slot_particles,
261
270
  'slicer': self.slicer}
@@ -0,0 +1 @@
1
+ from .waketracker import WakeTracker