Skip to content

Commit

Permalink
Merge pull request #114 from lgiacome/fix/issue-with-zeta-convention
Browse files Browse the repository at this point in the history
Fix issue with zeta convention in multi-bunch beam generation
  • Loading branch information
giadarol authored May 17, 2024
2 parents 9cc3301 + a2ec3cc commit 5a81242
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/test_multi_bunch_gauss_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def test_multi_bunch_gaussian_generation(test_context):
part.zeta[i_bunch*n_part_per_bunch:
(i_bunch+1)*n_part_per_bunch]))

assert np.isclose((zeta_avg-bunch_spacing*filled_slots[bunch_number])/sigma_z, 0.0, atol=1e-2)
assert np.isclose((zeta_avg+bunch_spacing*filled_slots[bunch_number])/sigma_z, 0.0, atol=1e-2)
assert np.isclose(delta_avg/sigma_delta, 0.0, atol=1e-2)
assert np.isclose(zeta_rms, sigma_z, rtol=1e-2, atol=1e-15)
assert np.isclose(delta_rms, sigma_delta, rtol=1e-1, atol=1e-15)

part_on_co.move(_context=xo.ContextCpu())
part_on_co.move(_context=xo.ContextCpu(omp_num_threads=0))

gemitt_x = nemitt_x/part_on_co.beta0/part_on_co.gamma0
gemitt_y = nemitt_y/part_on_co.beta0/part_on_co.gamma0
Expand Down
2 changes: 1 addition & 1 deletion xpart/matched_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def generate_matched_gaussian_multibunch_beam(filling_scheme,
for bunch_number in bunch_numbers:
bucket_n = filled_buckets[bunch_number]
macro_bunch.zeta[count * num_particles:
(count+1) * num_particles] += (bunch_spacing *
(count+1) * num_particles] -= (bunch_spacing *
bucket_n)
count += 1

Expand Down

0 comments on commit 5a81242

Please sign in to comment.