secots - smallest enclosing circles on the sphere
Given a point cloud on a sphere this Python package computes center and radius of the smallest (spherical) circle enclosing the point cloud. The algorithm takes linear time and automatically detects whether the point cloud is contained in a hemisphere. If so, the smalles enclosing circle is returned. Else, an exception is raised.
See A simple linear time algorithm for smallest enclosing circles on the (hemi)sphere for details on the algorithm.
Installation
Run
pip install secots
or copy secots.py from this repo to your working directory.
Usage
Put your point cloud into a list of longitude-latitude pairs or into a corresponding (n, 2)-shaped NumPy array. Then call secots.smallest_circle(points). This will return three floats: longitude and latitude of the circle's center as well as the radius. Example:
import secots
points = [
(-30, 10),
(0, 20),
(20, -40),
(10, 10),
(20, 30)
]
lon, lat, r = secots.smallest_circle(points)
print(f'center: ({lon}, {lat}), radius: {r}')
More examples are in the repo's example directory.
The smallest_circle function raises NotHemisphereError if the point cloud is not contained in a hemisphere. In this case the algorithm is not able to compute a smallest enclosing circle. See above mentioned paper for details.
The smallest_circle function accepts an additional keyword argument hemitest. Use hemitest=False if you are very sure that your point cloud is contained in a hemisphere. This saves (an almost negligible amount of) computation time. Example:
lon, lat, r = secots.smallest_circle(points, hemitest=False)
Contributing
Open a GitiHub issue for bug reports. File pull requests against the dev branch.
The dev branch contains the code for next release, whereas the main branch holds the current release.
Licence
Metadata
Release files for secots 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| secots-0.1.1.tar.gz | 1.4 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| secots-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 1.4 MB
Release files / secots-0.1.1.tar.gz
| Download URL | secots-0.1.1.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24c51127938c7a160e361c0b562bfa0a729f9e23c8671f1127ba7c7058ae253b
|
|
BLAKE2b-256 checksum How to use checksums |
f5b4afcad75e6435f44715cd6d5ad811ddb5726ce3ae47436173e6cf95a9f825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / secots-0.1.1-py2.py3-none-any.whl
| Download URL | secots-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 29.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c5442d6d26912a8054ce82244801ae4a566f293bf18e061810646e3dced4cec8
|
|
BLAKE2b-256 checksum How to use checksums |
290ea962c2af7821316ba9fd396ac602ca07ca9afa0e242e51f9016f8c564ff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for secots 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.