A Monte Carlo test-particle simulator developed for APC 524 — designed to model charged-particle motion and collisions in prescribed electromagnetic fields, bridging between full Particle-in-Cell (PIC) and swarm Monte Carlo (MC) approaches.
Installation (with uv)
uv is a fast Python package/environment manager developed by Astral.
If you don’t already have it:
curl -LsSf https://astral.sh/uv/install.sh | shThen restart your shell (or run source ~/.bashrc / source ~/.zshrc).
Check installation:
uv --versiongit clone https://github.com/your-username/test-particle-sim-1D.git
cd test-particle-sim-1Duv syncThis installs all dependencies defined in pyproject.toml.
To activate the environment:
uv run pythonor for any command:
uv run <command>Example:
uv run pytest -vuv run pre-commit run --all-filesThe pre-commit hooks include:
- ruff for linting and formatting
- nbstripout for cleaning notebooks
- Basic style checks (whitespace, merge conflicts, etc.)
uv run pytest -v