Skip to content

Commit

Permalink
Merge pull request #117 from leon-vv/fix-examples
Browse files Browse the repository at this point in the history
Fix examples
  • Loading branch information
leon-vv authored Nov 17, 2024
2 parents 56bd356 + 0e4908c commit 95a5718
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/deflector-3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def rectangle_electrode(x, z, name):
mesh = electrode_mesh + defl_mesh

# Show the generated triangle mesh.
P.plot_mesh(mesh, ground='green', deflector_positive='red', deflector_negative='blue', show_normals=True)
P.plot_mesh(mesh, ground='green', deflector_positive='red', deflector_negative='blue')

excitation = E.Excitation(mesh, E.Symmetry.THREE_D)

Expand Down
8 changes: 4 additions & 4 deletions examples/einzel-lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
# potential is very close to the potential found by an integration over the
# surface charge.
z = np.linspace(-1.5, 1.5, 150)
pot = [field.potential_at_point(np.array([0.0, z_])) for z_ in z]
pot_axial = [field_axial.potential_at_point(np.array([0.0, z_])) for z_ in z]
pot = [field.potential_at_point(np.array([0.0, 0.0, z_])) for z_ in z]
pot_axial = [field_axial.potential_at_point(np.array([0.0, 0.0, z_])) for z_ in z]

plt.title('Potential along axis')
plt.plot(z, pot, label='Surface charge integration')
Expand All @@ -79,14 +79,14 @@

# Initial velocity vector points downwards, with a
# initial speed corresponding to 1000eV.
velocity = T.velocity_vec(1000, [0, -1])
velocity = T.velocity_vec(1000, [0, 0, -1])

plt.figure()
plt.title('Electron traces')

for i, r0 in enumerate(r_start):
print(f'Tracing electron {i+1}/{len(r_start)}...')
_, positions = tracer(np.array([r0, 5]), velocity)
_, positions = tracer(np.array([r0, 0, 5]), velocity)
# Plot the z position of the electrons vs the r position.
# C0 produces the default matplotlib color (a shade of blue).
plt.plot(positions[:, 0], positions[:, 2], color='C0')
Expand Down

0 comments on commit 95a5718

Please sign in to comment.