Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

favicon Ballistic Solver Library

LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.

license pypi pypi-pre downloads downloads/month coverage py-versions Made in Ukraine

Pre-commit Pytest RK4 Python Euler Pytest Euler (Cython) Pytest RK4 (Cython) Pytest Verlet (Cython) Pytest Scipy

Contents

Installation

uv

uv add py-ballisticcalc

# Using precompiled backend (improves performance)
uv add py-ballisticcalc[exts]

# Using matplotlib and pandas uses additional dependencies
uv add py-ballisticcalc[charts]

# Get everything, including the SciPy engine
uv add py-ballisticcalc[exts,charts,scipy]

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]

Quick Start - click here to open Quick Start guide

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
[cythonized_verlet_engine][py_ballisticcalc_exts.CythonizedVelocityVerletIntegrationEngine] :material-arrow-up: 157x / 100x (faster) [exts] Compiled Verlet 2nd-order symplectic
[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

Sister projects

  • bclibc - High performance C++/C99 Ballistic solver engine
  • micropython-bclibc - Pure C99 Ballistic Solver Engine for MicroPython (bclibc subset)
  • ebalistyka - Ballistic Calculator built with Flutter and high performance C++ engine
  • js-ballistics - ISC library for small arms ballistic calculations (JavaScript ES6+)

License

Copyright (C) 2023 Yaroshenko Dmytro (o-murphy)

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License v3.0 as published by the Free Software Foundation.

See LICENSE for the full text. See CHANGELOG for release history.

[!NOTE] bclibc (the ballistic solver engine, located in py_ballisticcalc_exts/external/bclibc) is licensed separately under the GNU Lesser General Public License v3.0. See py_ballisticcalc_exts/external/bclibc/LICENSE.

[!WARNING]

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_ballisticcalc-2.3.1b2.tar.gz (6.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_ballisticcalc-2.3.1b2-py3-none-any.whl (142.3 kB view details)

Uploaded Python 3

File details

Details for the file py_ballisticcalc-2.3.1b2.tar.gz.

File metadata

  • Download URL: py_ballisticcalc-2.3.1b2.tar.gz
  • Upload date:
  • Size: 6.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for py_ballisticcalc-2.3.1b2.tar.gz
Algorithm Hash digest
SHA256 f4712298d2c4ee4a6d94b5ff72f2d5505291fc8260979234c78adf7c2a586352
MD5 1d7e862fe2787bc4a36a1693ad8485d1
BLAKE2b-256 ed766e432fa201fe92473dde47377cdf9f8ced58c6dedf7951a744227e14ca08

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_ballisticcalc-2.3.1b2.tar.gz:

Publisher: pypi-publish.yml on o-murphy/py-ballisticcalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_ballisticcalc-2.3.1b2-py3-none-any.whl.

File metadata

File hashes

Hashes for py_ballisticcalc-2.3.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 fffb9d516e25461b93a734e7e6e9109dc0a6eb08c93925d023598107bcf069ec
MD5 23b29f2bbf81d9c2560cd15e0826bdca
BLAKE2b-256 7127e6902d3beccbe59777ebab9dd22ba43bceb753482fefc761a42342945828

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_ballisticcalc-2.3.1b2-py3-none-any.whl:

Publisher: pypi-publish.yml on o-murphy/py-ballisticcalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.3.1

2 files

This release

2.3.1b2 This release

2 files

2.3.0

2 files

2.2.10

2 files

2.2.9

2 files

2.2.8

2 files

2.2.7

2 files

2.2.6.post1

2 files

2.2.6

2 files

2.2.5

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.8b1

2 files

2.0.7.post1

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.5a1

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

2.0.0b2

2 files

1.2

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.1.0b8.post1

2 files

1.0.12

2 files

1.0.11

1 file

1.0.10

1 file

1.0.9

4 files

1.0.4

3 files

1.0.0

3 files

0.2.3

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page