LGPL library for small arms ballistic calculations (Python 3)
Project description
BallisticCalculator
LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.
Contents
Installation
pip
pip install py-ballisticcalc
# Using precompiled backend (improves performance)
pip install py-ballisticcalc[exts]
# Using matplotlib and pandas uses additional dependencies
pip install py-ballisticcalc[charts]
# Get everything, including the SciPy engine
pip install py-ballisticcalc[exts,charts,scipy]
QuickStart
Examples
Ballistic Concepts
Units
Work in your preferred terms with easy conversions for the following dimensions and units:
- Angular: radian, degree, MOA, mil, mrad, thousandth, inch/100yd, cm/100m, o'clock
- Distance: inch, foot, yard, mile, nautical mile, mm, cm, m, km, line
- Energy: foot-pound, joule
- Pressure: mmHg, inHg, bar, hPa, PSI
- Temperature: Fahrenheit, Celsius, Kelvin, Rankine
- Time: second, minute, millisecond, microsecond, nanosecond, picosecond
- Velocity: m/s, km/h, ft/s, mph, knots
- Weight: grain, ounce, gram, pound, kilogram, newton
Calculation Engines
Choose between different calculation engines, or build your own. Included engines:
| Engine Name | Speed (Find Zero / Trajectory) | Dependencies | Description |
|---|---|---|---|
[rk4_engine][py_ballisticcalc.engines.RK4IntegrationEngine] |
Baseline (1x) | None; default | Runge-Kutta 4th-order integration |
[euler_engine][py_ballisticcalc.engines.EulerIntegrationEngine] |
:material-arrow-down: 0.5x / 0.5x (slower) | None | Euler 1st-order integration |
[verlet_engine][py_ballisticcalc.engines.VelocityVerletIntegrationEngine] |
:material-arrow-down: 0.8x / 0.8x (slower) | None | Verlet 2nd-order symplectic integration |
[cythonized_rk4_engine][py_ballisticcalc_exts.CythonizedRK4IntegrationEngine] |
:material-arrow-up: 112x / 200x (faster) | [exts] |
Compiled Runge-Kutta 4th-order |
[cythonized_euler_engine][py_ballisticcalc_exts.CythonizedEulerIntegrationEngine] |
:material-arrow-up: 47x / 65x (faster) | [exts] |
Compiled Euler integration |
[scipy_engine][py_ballisticcalc.engines.SciPyIntegrationEngine] |
:material-arrow-up: 6.2x / 5.8x (faster) | [scipy] |
Advanced numerical methods |
About project
The library provides trajectory calculation for ballistic projectiles launched by airguns, bows, firearms, artillery, etc.
The core point-mass (3DoF) ballistic model underlying this project was used on the earliest digital computers. Robert McCoy (author of Modern Exterior Ballistics) implemented one in BASIC. JBM published code in C. Nikolay Gekht ported that to C#, extended it with formulas from Bryan Litz's Applied Ballistics, and ported it to Go, while Alexandre Trofimov implemented a calculator in JavaScript.
This Python3 implementation has been expanded to support multiple ballistic coefficients and custom drag functions, such as those derived from Doppler radar data.
Contributors
This project exists thanks to all the people who contribute.
Special thanks to:
- David Bookstaber - Ballistics Expert
For help understanding and improving the functionality - Serhiy Yevtushenko - Applied Mathematician
For helping in consultations, testing, and improving edge case compatibility - Nikolay Gekht
For the source code in C# and GO-lang from which this project firstly was forked
RISK NOTICE
This library performs approximate simulations of complex physical processes. Therefore, the calculation results MUST NOT be considered as completely and reliably reflecting actual behavior of projectiles. While these results may be used for educational purpose, they must NOT be considered as reliable for the areas where incorrect calculation may cause making a wrong decision, financial harm, or can put a human life at risk.
THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_ballisticcalc-2.2.8.tar.gz.
File metadata
- Download URL: py_ballisticcalc-2.2.8.tar.gz
- Upload date:
- Size: 6.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ba4bd519f1e717e095d124e64794953014ea1cbea24de9a21a6190f35a52bc
|
|
| MD5 |
a86aff240a4d451a78810152a27ca1bd
|
|
| BLAKE2b-256 |
28a05c63527d2c6439fa930643e92a1bf1efa8da64a9804bbf3df558178aaa97
|
Provenance
The following attestation bundles were made for py_ballisticcalc-2.2.8.tar.gz:
Publisher:
pypi-publish.yml on o-murphy/py-ballisticcalc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_ballisticcalc-2.2.8.tar.gz -
Subject digest:
f7ba4bd519f1e717e095d124e64794953014ea1cbea24de9a21a6190f35a52bc - Sigstore transparency entry: 809089130
- Sigstore integration time:
-
Permalink:
o-murphy/py-ballisticcalc@a98116f957a6eff80820e77d6bc7c75a67d50727 -
Branch / Tag:
refs/tags/v2.2.8 - Owner: https://github.com/o-murphy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@a98116f957a6eff80820e77d6bc7c75a67d50727 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_ballisticcalc-2.2.8-py3-none-any.whl.
File metadata
- Download URL: py_ballisticcalc-2.2.8-py3-none-any.whl
- Upload date:
- Size: 141.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3001db8f05040980fcb4d3218e55dd658f0a440ac73bb99c6f16aa6c36281b63
|
|
| MD5 |
7dafa5e9bd0f899ce041bfb07740d4dc
|
|
| BLAKE2b-256 |
66b0da919068e8e282a26bbc2c09f79c3e0ca396b9ce79df2ae77a330ae06e34
|
Provenance
The following attestation bundles were made for py_ballisticcalc-2.2.8-py3-none-any.whl:
Publisher:
pypi-publish.yml on o-murphy/py-ballisticcalc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_ballisticcalc-2.2.8-py3-none-any.whl -
Subject digest:
3001db8f05040980fcb4d3218e55dd658f0a440ac73bb99c6f16aa6c36281b63 - Sigstore transparency entry: 809090670
- Sigstore integration time:
-
Permalink:
o-murphy/py-ballisticcalc@a98116f957a6eff80820e77d6bc7c75a67d50727 -
Branch / Tag:
refs/tags/v2.2.8 - Owner: https://github.com/o-murphy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@a98116f957a6eff80820e77d6bc7c75a67d50727 -
Trigger Event:
release
-
Statement type: