-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Description
Hello everyone,
Could you help me with a simple question I'm still unclear on?
One of the diagnostics I use looks like this
DiagParticleBinning( # 11
deposited_quantity = "weight",
every = [every_in, every_step],
species = ["electron"],
axes = [ ["ekin", 0.48, 10., 100],
["pz", -12., 12., 2],
["z", z_foc - 30 * l0, z_foc + 30 * l0, 3] ]
)
Let's say I want to count the number of electrons at a given time (it = 13) by integrating over all energies, and only for the region pz > 0, z > z_foc + 10 * l0.
Here's how I do it.
S = happi.Open("results", show=True)
V_r = N_r * L_r**3 # it's 3D simulations
Diag_ekin_integ = S.ParticleBinning(11)
ekin_axis = Diag_ekin_integ.getAxis('ekin')
pz_axis = Diag_ekin_integ.getAxis('pz')
z_axis = Diag_ekin_integ.getAxis('z')
dE = ekin_axis[1] - ekin_axis[0]
dpz = pz_axis[1] - pz_axis[0]
dz = z_axis[1] - z_axis[0]
tot_ekin_spec_13 = Diag_ekin_integ.getData()[13]
ekin_forward_13 = tot_ekin_spec_13[:,1,2] # pz>0 , z > z_foc + 10*l0
ekin_all_everywhere_13 = np.sum(np.sum(tot_ekin_spec_13, axis=1),axis=1)
N_forward = np.sum(ekin_forward_13) * dE * dpz * dz * V_r
N_all = np.sum(ekin_all_everywhere_13) * dE *dpz * dz * V_r
print("N_forward = ", N_forward)
print("N_all = ", N_all)
and I get
N_forward = 54148.884201168294
N_all = 70354.86803573875
Am I right in this approach? (Particle count below expected)
Thank you
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels