IMFPY is an end-to-end toolkit for exploring interstellar and heliospheric dust grain dynamics.
It combines a high-performance Fortran integrator with pure-Python and GPU backends and ships a full-featured PyQt6 desktop application for crafting ensembles, running simulations, and visualising the resulting trajectories.
- Features at a glance
- System requirements
- Installation
- Quick start
- Walkthrough tutorials
- Project layout
- Troubleshooting & diagnostics
- Additional documentation
- Contributing
- License
- High-performance Fortran backend compiled through
numpy.f2pywith OpenMP support for multi-core CPUs. - CuPy GPU backend (optional) that mirrors the CPU equations of motion on compatible NVIDIA hardware.
- NumPy/Numba reference backend for validation, testing, and execution on systems without a Fortran compiler.
- Interactive PyQt6 GUI with:
- Particle ensemble editor (positions, velocities, masses, charges, radiation-pressure β coefficients).
- Global integration controls (time step, step count, gravitational parameter, electric & magnetic field vectors).
- Background execution worker to keep the interface responsive.
- Built-in help viewer, quick-start overlays, and direct links to the full documentation.
- 3D Matplotlib trajectory viewer with mouse navigation tools.
- Automation-friendly CLI for batch experiments, CI pipelines, or headless environments.
- Extensive documentation (installation, tutorials, troubleshooting, FAQs) in
docs/user-guideand mirrored inside the application itself.
| Component | Recommendation |
|---|---|
| Operating system | Linux, macOS 12+, or Windows 10/11 |
| Python | 3.10 – 3.12 |
| CPU backend | Any modern x86-64/ARM64 CPU with OpenMP support |
| GPU backend (optional) | NVIDIA GPU with CUDA 11.8+ and a CuPy build that matches your CUDA toolkit |
| Memory | ≥ 8 GB RAM recommended for large ensembles |
| Additional tooling | gfortran (or compatible) for building the native backend |
Tip: If you only need the pure Python backend you can skip the Fortran toolchain and still run the GUI.
If you are on macOS and just want everything configured automatically, run the helper script:
./scripts/setup_mac.shThe script will ensure Homebrew, Python 3.11, gfortran, the virtual environment, Python dependencies, the smoke-test suite, and the Fortran backend are all in place. When it finishes you can activate the environment with source .venv/bin/activate.
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
python -m pip install --upgrade pipInstall the project dependencies and build the Fortran extension on first launch.
python -m pip install -r requirements.txtOn Linux you may need the system packages gfortran, libopenblas-dev, and python3-dev. macOS users can install gcc via Homebrew (brew install gcc). Windows users can install the MSYS2 toolchain.
After installing the requirements you can launch the GUI or CLI directly (see Quick start). The Fortran backend is auto-built the first time you invoke it and the compiled module is cached under imfpy/fortran/_build/.
To enable the GPU backend install a CuPy build that matches your CUDA toolkit. Example for CUDA 11.8:
python -m pip install cupy-cuda11xYou can confirm GPU availability from the GUI status bar (Help → Diagnostics) or via the CLI:
python -m imfpy.simulation.runner --list-backendspython -m imfpy.gui.mainWhat happens on first launch:
- IMFPY compiles the Fortran integrator (if available) and validates the Python/GPU backends.
- The main window opens with a pre-populated four-particle circular orbit ensemble.
- Press Run Simulation to execute with the default parameters. Results appear in the 3D viewer and the status bar will indicate completion.
- Open the Help → Quick Start Guide menu (or press
F1) for a step-by-step tour of every control.
The CLI exposes the same solver stack for scripted runs:
python -m imfpy.simulation.runner \
--backend fortran \
--particles 32 \
--steps 5000 \
--dt 5.0 \
--output trajectories.npzUse --help for the full set of options and see docs/user-guide/tutorials.md for complete automation workflows.
- Guided tour of the GUI – learn how to configure particle ensembles, tweak global fields, and interpret plots.
- Physics validation workflow – cross-check Fortran, Python, and GPU backends using the same initial conditions.
- Batch experiments – create YAML/JSON configs, run them from the CLI, and post-process the results in notebooks.
Each tutorial includes screenshots, step-by-step instructions, and troubleshooting checkpoints. Start with docs/user-guide/tutorials.md.
imfpy/
├── fortran/ # Native integrator sources and build helpers
├── gui/ # PyQt6 application (widgets, windows, help system)
└── simulation/ # Backend orchestration, data classes, CLI runner
Additional directories:
docs/user-guide/– Markdown documentation surfaced on GitHub and referenced by the in-app help viewer.media/– Figures used in talks, documentation, and presentations.notebooks/– Example scientific workflows (exploratory analysis, plotting).tests/– Space for automated unit tests.
-
Launch the app and open Help → Diagnostics for a live system report (Python version, backend availability, CUDA status).
-
Review the troubleshooting matrix in
docs/user-guide/troubleshooting.mdfor fixes to common compiler, GUI, and runtime issues. -
Run the CLI self-test to validate all backends:
python -m imfpy.simulation.runner --self-test
-
Still stuck? File an issue with logs, OS details, and the contents of
imfpy/fortran/_build/build.log.
- Full user guide
- Installation deep dive
- Tutorial library
- Troubleshooting & diagnostics
- Frequently asked questions
These files are packaged with the application and can be opened from inside the GUI via Help → Open Documentation Folder.
-
Fork and clone the repository.
-
Create a new branch for your feature or fix.
-
Install development dependencies:
python -m pip install -r requirements.txt
-
Run the linters/tests (add your own in
tests/). -
Submit a pull request summarising the change and linking relevant issues.
MIT (or specify the actual licence applicable to your project).
This repository is released under the Ayari Public No-Derivatives License (APND) v1.0.
You may download and use the software as-is. You may not modify it or distribute
modified versions without written permission. See LICENSE.
If you use this software in research or a product, please cite it. We archive releases on Zenodo to mint a DOI.
How to cite (example):
Ayari, E. (2025). IMFPY (vX.Y.Z) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.XXXXXXX
After you create your first Zenodo-backed GitHub release, replace the placeholder above and add the badge:
[](https://doi.org/10.5281/zenodo.XXXXXXX)
This is a read-only public release. We do not accept external pull requests or patches. Please open an issue for bugs or feature requests. For derivative-use exceptions, contact the author.
- Clone or download a release tarball.
- Use unmodified sources/binaries as described in the docs.
- Do not redistribute modified versions.