distlink-python
An unofficial, source-level Python port of the DISTLINK C++ library for computing the minimum orbit intersection distance (MOID) and orbital linking coefficients. The public API retains the C++ names to make examples and results straightforward to compare.
This port is maintained independently and is not represented as an official release by the original DISTLINK authors.
Installation
After the first PyPI release:
python -m pip install distlink-python
The distribution is named distlink-python; the import name is distlink.
To install the current development version directly from GitHub:
python -m pip install git+https://github.com/troyrock/distlink-python.git
The implementation uses only the Python standard library and supports Python 3.10 and later.
Quick start
from distlink import COrbitData, MOID_fast, detect_suitable_options
earth = COrbitData(1.00000011, 0.01671022, 0.0, 1.796767, -0.196535)
asteroid = COrbitData(1.4583, 0.2226, 0.05814, 2.20611, 3.56154)
max_root_error, min_root_error, _ = detect_suitable_options()
result = MOID_fast(earth, asteroid, max_root_error, min_root_error)
print(result.distance, result.good)
Angles are in radians. Distance results use the same unit as the supplied
semimajor axes. Python float corresponds to the C++ double
instantiation.
Input and numerical behavior
Orbital elements and numerical options must be finite. Eccentricity must be
nonnegative, and exactly parabolic orbits (e == 1) are rejected. A nonzero
semimajor axis is canonicalized to positive for an ellipse and negative for a
hyperbola. Invalid inputs raise ValueError.
MOID_fast is deterministic and supports circular first orbits directly. It
automatically exchanges the pair when only the first orbit is circular and
uses the exact two-circle solution when both are circular. For other results
marked unreliable, retrying in the opposite order remains reasonable before
using MOID_direct_search as the fallback.
The direct scanner uses a full anomaly range for coplanar elliptic orbits. It
rejects a coplanar hyperbolic pair because no finite scan interval can in
general bound both unbounded branches; use MOID_fast for that case.
Verification against C++
The standard-library test suite compiles a fresh C++20 command-line oracle and compares Python results with it:
python -m unittest discover -s tests -v
The release CI pins the oracle to
troyrock/distlink-cpp@58c1c29.
For a local checkout, place distlink-python and distlink-cpp beside one
another, as they are in the development workspace.
Provenance and references
This code is a direct Python translation of DISTLINK by Roman V. Baluev and
Denis V. Mikryukov. The original project is distributed at
SourceForge; the maintained
C++20 oracle used for this port is available at
troyrock/distlink-cpp.
The underlying algorithms are described in:
- R. V. Baluev and D. V. Mikryukov, “Fast error-controlling MOID computation for confocal elliptic orbits,” Astronomy and Computing 27 (2019), 11–22, doi:10.1016/j.ascom.2019.02.005.
- R. V. Baluev, “Fast error-safe MOID computation involving hyperbolic orbits,” Astronomy and Computing 34 (2021), 100440, doi:10.1016/j.ascom.2020.100440.
License
The original C++ work and this Python translation are distributed under the
MIT License. The original authors' copyright and permission notice are
preserved in LICENSE and in the translated source.
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 distlink_python-0.2.0.tar.gz.
File metadata
- Download URL: distlink_python-0.2.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e3d406ab3e3b9e5452aeb516dac5bb829246573ab38aae02b992bfa50b0d9c2
|
|
| MD5 |
8796e01061fbd12ac47dc59710197452
|
|
| BLAKE2b-256 |
a4a74f7759ec0ab58fba0197ec7641a581265a6ea020499ad3a068d4c9d27a70
|
Provenance
The following attestation bundles were made for distlink_python-0.2.0.tar.gz:
Publisher:
release.yml on troyrock/distlink-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
distlink_python-0.2.0.tar.gz -
Subject digest:
3e3d406ab3e3b9e5452aeb516dac5bb829246573ab38aae02b992bfa50b0d9c2 - Sigstore transparency entry: 2753018520
- Sigstore integration time:
-
Permalink:
troyrock/distlink-python@cc23412e09013f8a38dac8d72e205a67e9b9d1ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/troyrock
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc23412e09013f8a38dac8d72e205a67e9b9d1ef -
Trigger Event:
release
-
Statement type:
File details
Details for the file distlink_python-0.2.0-py3-none-any.whl.
File metadata
- Download URL: distlink_python-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b98443cede2a0a1bbed0e7c5eb08abcf44b860e51cfeab0d2b440fc1553bb92b
|
|
| MD5 |
f848b82ec4790fe3d37e7a498c2c264a
|
|
| BLAKE2b-256 |
2bb441032e304c639ba429fd9142a422cae3200d86e26df0ad6a6dbc61bbd776
|
Provenance
The following attestation bundles were made for distlink_python-0.2.0-py3-none-any.whl:
Publisher:
release.yml on troyrock/distlink-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
distlink_python-0.2.0-py3-none-any.whl -
Subject digest:
b98443cede2a0a1bbed0e7c5eb08abcf44b860e51cfeab0d2b440fc1553bb92b - Sigstore transparency entry: 2753018522
- Sigstore integration time:
-
Permalink:
troyrock/distlink-python@cc23412e09013f8a38dac8d72e205a67e9b9d1ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/troyrock
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc23412e09013f8a38dac8d72e205a67e9b9d1ef -
Trigger Event:
release
-
Statement type: