Laplace HypoPINN is a Python/PyTorch research package for earthquake and microseismic hypocenter localization with physics-informed neural networks (PINNs). Given a velocity model and receiver travel times, it learns a two-dimensional travel-time field constrained by the Eikonal equation, estimates the source location, and uses Laplace approximations to explore local network-weight uncertainty.
Documentation · Tutorial notebooks · Common questions · Research paper
This repository accompanies Izzatullah et al. (2022), Laplace HypoPINN: physics-informed neural network for hypocenter localization and its predictive uncertainty. The maintained package adds configurable models, functional APIs and explicit research variants while preserving the original notebooks.
flowchart LR
A[Velocity and receiver times] --> B[Train travel-time model]
B --> C[Trained field and source]
B --> D[Fit Laplace approximation]
D --> E[Sample fields and source locations]
C --> F[Save artifacts and plots]
E --> F
Python 3.12+; CPU is sufficient. Clone the repository, then run:
git clone https://github.com/izzatum/laplace-hypopinn.git cd laplace-hypopinn python -m venv .venv source .venv/bin/activate python -m pip install -e '.[plot]' python -m laplace_hypopinn run --smoke --threads 1 --output results/smoke python -m laplace_hypopinn plot results/smoke
The smoke example uses two training updates and three posterior samples. It checks execution, not published accuracy or calibrated uncertainty. Results include configuration, metrics, arrays, a checkpoint and PNG plots. Use a new output path for each run; existing results are protected from overwrites.
Start with the eight tutorial notebooks, one per
method: legacy_diagonal, diagonal, block_diagonal, full, kfac, efb,
inf and valla. Each walks through data preparation, training, fitting and
sampling, with six saved figures and a small CPU teaching budget. The tutorial
index includes installation and Jupyter instructions.
The method reference explains approximation targets, damping and sampling assumptions. The six original research notebooks are preserved separately with their historical code and outputs.
Change model depth and width with --widths, select an approximation with
--method, or load a TOML configuration with --config:
python -m laplace_hypopinn run --smoke --threads 1 \ --widths 2,32,32,1 --method diagonal --output results/custom
The Python API accepts named parameter tensors and a pure forward function, or
an adapted torch.nn.Module. See the extension contracts
and observed-data example. Custom models must be
deterministic, differentiable pointwise scalar maps; KFAC/EFB/INF need compatible
coordinate-derivative adapters.
Presets and reproduction guidance cover full historical
budgets and paper/notebook differences. Read the performance guide
before scaling up. Coordinates are (z,x) in km, velocity km/s and travel time seconds.
Can I use a different PINN architecture? Yes: depth and widths are configurable,
and custom scalar models can supply a functional forward or torch.nn.Module adapter.
Do I need a GPU? No: the tutorials and tests run on CPU.
Are the uncertainty estimates calibrated? Calibration is not established by
the teaching examples; damping, likelihood assumptions and approximation choices
are documented in the methods and FAQ.
For development and the full test suite:
python -m pip install -e '.[dev,plot,fast-marching,notebooks]' python -m ipykernel install --sys-prefix --name laplace-hypopinn python -m pytest -q python -m ruff check .
The maintained code, documentation and tutorials are available under the MIT License. The historical archive and bundled data are excluded from this grant; see third-party notices and scope.
For research use, please cite Izzatullah et al. (2022), Laplace HypoPINN, DOI: 10.1088/2632-2153/ac94b3, and the relevant approximation sources in the method reference. CITATION.cff provides citation metadata.