Skip to content

Commit

Permalink
Merge branch 'development' into RecordingDataAtStation
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Jan 28, 2024
2 parents 15e810a + 94ae119 commit 6e832a8
Show file tree
Hide file tree
Showing 53 changed files with 661 additions and 709 deletions.
3 changes: 2 additions & 1 deletion Docs/source/usage/workflows/python_extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ Particles can be added to the simulation at specific positions and with specific
.. autoclass:: pywarpx.particle_containers.ParticleContainerWrapper
:members:

The ``get_particle_structs()`` and ``get_particle_arrays()`` functions are called
The ``get_particle_real_arrays()``, ``get_particle_int_arrays()`` and
``get_particle_idcpu_arrays()`` functions are called
by several utility functions of the form ``get_particle_{comp_name}`` where
``comp_name`` is one of ``x``, ``y``, ``z``, ``r``, ``theta``, ``id``, ``cpu``,
``weight``, ``ux``, ``uy`` or ``uz``.
Expand Down
6 changes: 3 additions & 3 deletions Examples/Tests/particle_data_python/PICMI_inputs_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def add_particles():
##########################

assert (elec_wrapper.nps == 270 / (2 - args.unique))
assert (elec_wrapper.particle_container.get_comp_index('w') == 0)
assert (elec_wrapper.particle_container.get_comp_index('newPid') == 4)
assert (elec_wrapper.particle_container.get_comp_index('w') == 2)
assert (elec_wrapper.particle_container.get_comp_index('newPid') == 6)

new_pid_vals = elec_wrapper.get_particle_arrays('newPid', 0)
new_pid_vals = elec_wrapper.get_particle_real_arrays('newPid', 0)
for vals in new_pid_vals:
assert np.allclose(vals, 5)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
elec_count = elec_wrapper.nps

# check that the runtime attributes have the right indices
assert (elec_wrapper.particle_container.get_comp_index('prev_x') == 4)
assert (elec_wrapper.particle_container.get_comp_index('prev_z') == 5)
assert (elec_wrapper.particle_container.get_comp_index('prev_x') == 6)
assert (elec_wrapper.particle_container.get_comp_index('prev_z') == 7)

# sanity check that the prev_z values are reasonable and
# that the correct number of values are returned
prev_z_vals = elec_wrapper.get_particle_arrays('prev_z', 0)
prev_z_vals = elec_wrapper.get_particle_real_arrays('prev_z', 0)
running_count = 0

for z_vals in prev_z_vals:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ def add_particles():
##########################

assert electron_wrapper.nps == 90
assert electron_wrapper.particle_container.get_comp_index("w") == 0
assert electron_wrapper.particle_container.get_comp_index("newPid") == 4
assert electron_wrapper.particle_container.get_comp_index("w") == 2
assert electron_wrapper.particle_container.get_comp_index("newPid") == 6

new_pid_vals = electron_wrapper.get_particle_arrays("newPid", 0)
new_pid_vals = electron_wrapper.get_particle_real_arrays("newPid", 0)
for vals in new_pid_vals:
assert np.allclose(vals, 5)

Expand Down
Loading

0 comments on commit 6e832a8

Please sign in to comment.