Skip to content

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Massimo committed Jan 17, 2025
1 parent 24bf916 commit 33145f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
14 changes: 7 additions & 7 deletions Postprocessing_Scripts/Compute_bunch_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def print_bunch_params(x,y,z,px,py,pz,E,weights,um):
print("average position = "+str(np.average(x,weights=weights)/um)+" um")
print("----------------")
print("")
print("sigma_x = "+str(weighted_std(x,weights)/um)+" um")
print("sigma_y = "+str(weighted_std(y,weights)/um)+" um")
print("sigma_z = "+str(weighted_std(z,weights)/um)+" um")
print("E = "+str(np.average(E,weights=weights)*electron_mass_MeV)+" MeV")
print("DE/E(rms) = "+str(weighted_std(E,weights)/np.average(E,weights=weights)*100)+ "%")
print("eps_ny = "+str(normalized_emittance(y,py,weights)/um)+" mm-mrad")
print("eps_nz = "+str(normalized_emittance(z,pz,weights)/um)+" mm-mrad")
print("sigma_x = "+str(f"{weighted_std(x, weights) / um:.2f}")+" um")
print("sigma_y = "+str(f"{weighted_std(y, weights) / um:.2f}")+" um")
print("sigma_z = "+str(f"{weighted_std(z, weights) / um:.2f}")+" um")
print("E = " + str(f"{np.average(E, weights=weights) * electron_mass_MeV:.2f}") + " MeV")
print("DE/E(rms) = " + str(f"{weighted_std(E, weights) / np.average(E, weights=weights) * 100:.2f}") + "%")
print("eps_ny = " + str(f"{normalized_emittance(y, py, weights) / um:.2f}") + " mm-mrad")
print("eps_nz = " + str(f"{normalized_emittance(z, pz, weights) / um:.2f}") + " mm-mrad")
print("")
print("sigma_i (i=x,y,z): rms size along the coordinate i")
print("E : mean energy")
Expand Down
21 changes: 0 additions & 21 deletions Postprocessing_Scripts/Follow_electron_bunch_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,6 @@ def normalized_emittance(transv_coordinate,transv_momentum,weights):
norm_emittance = (sigma_transv**2)*(sigma_p_transv**2)-sigma_transv_p_transv**2
return math.sqrt(norm_emittance)

def print_bunch_params(x,y,z,px,py,pz,E,weights,conversion_factor):
# conversion factor converts from normalized units to um
print(" ")
print("average position = ",np.average(x,weights=weights)/um," um")
print("----------------")
print("")
print("sigma_x = ",weighted_std(x,weights)/um," um")
print("sigma_y = ",weighted_std(y,weights)/um," um")
print("sigma_z = ",weighted_std(z,weights)/um," um")
print("E = ",np.average(E,weights=weights)*electron_mass_MeV," MeV")
print("DE/E(rms) = ",weighted_std(E,weights)/np.average(E,weights=weights)*100, "%")
print("eps_ny = ",normalized_emittance(y,py,weights)/um," mm-mrad")
print("eps_nz = ",normalized_emittance(z,pz,weights)/um," mm-mrad")
print("")
print("sigma_i (i=x,y,z): rms size along the coordinate i")
print("E : mean energy")
print("DE/E (rms) : relative rms energy spread")
print("eps_ni (i=y,z) : normalized emittance (phase space plane i-p_i)")
print("")
print("----------------")

########## Open the DiagTrackParticles

chunk_size = 60000
Expand Down

0 comments on commit 33145f4

Please sign in to comment.