Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the PyPIC3D codebase into clearer subpackages by moving particle-related logic into PyPIC3D/particles and charge/current deposition logic into PyPIC3D/deposition, updating imports across the project accordingly.
Changes:
- Moved particle species + initialization code from
PyPIC3D/particle.pyintoPyPIC3D/particles/species_class.pyandPyPIC3D/particles/particle_initialization.py. - Moved deposition utilities (
rho,J_from_rhov,Esirkepov,shapes) intoPyPIC3D/deposition/*and updated all import sites (solvers, initialization, CLI, tests). - Removed legacy top-level modules (
PyPIC3D/J.py,PyPIC3D/rho.py,PyPIC3D/shapes.py,PyPIC3D/particle.py) and reformatted a few sections for readability.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/particle_test.py | Updates imports to new particles/ and deposition/ modules. |
| tests/electrostatic_yee_test.py | Updates particle_species import to new location. |
| PyPIC3D/solvers/electrostatic_yee.py | Switches compute_rho import to deposition.rho. |
| PyPIC3D/initialization.py | Updates imports for particle init + deposition modules under new subpackages. |
| PyPIC3D/diagnostics/fluid_quantities.py | Updates shapes import to deposition.shapes. |
| PyPIC3D/boris.py | Updates shapes import to deposition.shapes. |
| PyPIC3D/main.py | Updates compute_rho import to deposition.rho. |
| PyPIC3D/init.py | Switches package imports to new subpackages (but needs cleanup/fixes per comments). |
| PyPIC3D/particles/species_class.py | New home for particle_species implementation (moved from particle.py). |
| PyPIC3D/particles/particle_initialization.py | New home for particle initialization + TOML loading (moved from particle.py). |
| PyPIC3D/particles/flat_particles.py | Formatting/readability tweaks. |
| PyPIC3D/deposition/shapes.py | New home for deposition shape functions (moved from shapes.py). |
| PyPIC3D/deposition/rho.py | New home for compute_rho (moved from rho.py). |
| PyPIC3D/deposition/J_from_rhov.py | New home for J_from_rhov (moved from J.py). |
| PyPIC3D/deposition/Esirkepov.py | New home for Esirkepov_current (moved from J.py). |
| PyPIC3D/shapes.py | Deleted (migrated to PyPIC3D/deposition/shapes.py). |
| PyPIC3D/rho.py | Deleted (migrated to PyPIC3D/deposition/rho.py). |
| PyPIC3D/J.py | Deleted (migrated to PyPIC3D/deposition/*). |
| PyPIC3D/particle.py | Deleted (migrated to PyPIC3D/particles/*). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from .deposition import shapes | ||
| from .deposition import Esirkepov | ||
| from .deposition import J_from_rhov | ||
| from .deposition import rho |
| from .deposition import shapes | ||
| from .deposition import Esirkepov | ||
| from .deposition import J_from_rhov | ||
| from .deposition import rho |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the PyPIC3D codebase into clearer subpackages by moving particle-related logic into PyPIC3D/particles/ and deposition algorithms into PyPIC3D/deposition/, then updating internal code and tests to use the new import paths.
Changes:
- Moved particle species class + TOML-based particle initialization into
PyPIC3D/particles/. - Moved charge/current deposition + shape functions into
PyPIC3D/deposition/. - Updated imports across solvers, initialization, CLI entrypoints, diagnostics, and tests to match the new structure.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/particle_test.py | Updated imports to new particles/ + deposition/ module locations. |
| tests/electrostatic_yee_test.py | Updated particle_species import path. |
| PyPIC3D/solvers/electrostatic_yee.py | Updated compute_rho import path to deposition/. |
| PyPIC3D/shapes.py | Removed (migrated to PyPIC3D/deposition/shapes.py). |
| PyPIC3D/rho.py | Removed (migrated to PyPIC3D/deposition/rho.py). |
| PyPIC3D/particles/species_class.py | Added new location for particle_species implementation. |
| PyPIC3D/particles/particle_initialization.py | Added new location for particle initialization/TOML loading utilities. |
| PyPIC3D/particles/flat_particles.py | Formatting-only changes in periodic wrapping logic. |
| PyPIC3D/particle.py | Removed (split into species_class.py + particle_initialization.py). |
| PyPIC3D/initialization.py | Updated imports for particle loading + deposition routines. |
| PyPIC3D/diagnostics/fluid_quantities.py | Updated shape-function import to deposition/shapes.py. |
| PyPIC3D/deposition/shapes.py | Added new location for shape/weighting functions. |
| PyPIC3D/deposition/rho.py | Added new location for charge deposition (compute_rho). |
| PyPIC3D/deposition/J_from_rhov.py | Added new location for J_from_rhov. |
| PyPIC3D/deposition/Esirkepov.py | Added new location for Esirkepov current deposition. |
| PyPIC3D/boris.py | Updated shape-function import to deposition/shapes.py. |
| PyPIC3D/main.py | Updated compute_rho import path to deposition/. |
| PyPIC3D/init.py | Updated top-level imports to include new subpackages/modules. |
| PyPIC3D/J.py | Removed (migrated to PyPIC3D/deposition/). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| inverse_total_debye = 0 | ||
|
|
||
| for toml_key in particle_keys: | ||
| N_particles = config[toml_key]["N_particles"] |
| weight = compute_macroparticle_weight( | ||
| config, particle_keys, simulation_parameters, world, constants | ||
| ) | ||
|
|
||
| for toml_key in particle_keys: | ||
| key1, key2, key3 = jax.random.key(i), jax.random.key(i + 1), jax.random.key(i + 2) | ||
| i += 3 |
| from PyPIC3D.particles.particle_initialization import ( | ||
| initial_particles | ||
| ) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Updating the structure of the main code base for easier readability:
Subfolders
-particles: contains particle species classes and initialization algorithms.