← All packages

Numerics & statistics

star-wrap 0.1.0

Reducing, differencing and averaging angles

Public state: Released & Verified. The registry label is RELEASED. What the states mean →

Apache-2.0 Released & Verified single file

Summary

Reduction of angles to [0, 360) and [-180, 180), shortest signed difference and circular mean; identical to astropy, within 2.4e-10 deg of ERFA and 6e-14 deg of SciPy on 600 angles and 600 samples, every result inside its range, undefined means refused.

Run in your browser

Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).

Runs in the browser: all 17 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.

Use it on your computer

No account and no GitHub needed. Download, then install with one command:

python -m pip install star_wrap-0.1.0-py3-none-any.whl

In Python: import star_wrap

Get started →

Cite it, and its bill of materials

For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.

@software{cavazzini_star_wrap_0_1_0,
  author  = {Cavazzini, Andrea},
  title   = {{star-wrap}: Reducing, differencing and averaging angles},
  version = {0.1.0},
  year    = {2026},
  url     = {https://andrea07072000.github.io/S.T.A.R.-/software/star_wrap/},
  note    = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}

For developers

Install directly from the public repository:

python -m pip install "star-wrap @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_wrap"

README · tests · evidence (GitHub)

Technical sheet

Package
star-wrap
Import name
star_wrap
Version
0.1.0
Licence
Apache-2.0
Python
>=3.9
Dependencies
none (standard library only)
Capability
star.units.angle-wrap
Maturity
Released & Verified (RELEASED)
Published commit
dc09f61d

Requirements

  • R1 wrap360 returns [0, 360) and wrap180 returns [-180, 180), with the exact floating-point remainder: an angle of 1e9 deg loses nothing in the reduction. Reproduces the reductions of Meeus Example 25.a.
  • R2 difference(a, b) is a − b as the shortest signed rotation in [-180, 180); circular_mean(angles) is the direction of the mean unit vector in [0, 360), and is refused when the vectors cancel.
  • R3 Measured on 600 angles up to 1e6 deg (100 within 1e-9 deg of a multiple of 180) and 600 samples: identical to astropy, within 2.4e-10 deg of ERFA (which rounds through radians), circular means within 6e-14 deg of SciPy; every result inside its range.
  • R4 Every function returns a finite float in its range or raises ValueError: non-numeric, boolean, NaN or infinite input, an angle beyond 1e12 deg, an empty or non-list/tuple collection or one longer than 1,000,000, a mean resultant length below 1e-9.

Limits (what is not claimed)

Half a turn is −180, not +180: callers who need (−180, 180] must map it themselves. The circular mean is not a weighted mean and gives no dispersion. An angle is a float: 1e12 deg still reduces exactly, but its own last digit is already 1e-4 deg.

Release gate

Computed by the registry from the result files, with the same function that decides RELEASED.

Mutation score, latest measure of each module (needs at least 0.850)
  • star_wrap.py 0.947 (2026-10-06)
Independent implementations written by others (needs 2)
astropy Angle.wrap_at, ERFA anp / anpm (C), scipy.stats.circmean
Also compared with, not counted
published values: Meeus, Astronomical Algorithms, Example 25.a
Result
Released & Verified

Evidence in the registry

CheckStatusRecordedWhat was observed
Clean install from the release tagVERIFIED2026-10-06pytest outside the tree: 17 passed in 1.61s
Unit testsVERIFIED2026-10-0617 passed in 1.85s
ReviewVERIFIED2026-10-06Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed
ReviewVERIFIED2026-10-06Re-running the cross-check gives a byte-identical evidence file
Reference valueVERIFIED2026-10-06201.80720000000019 and 278.99396999999999: within 2e-13 deg of the printed values (suite: 17 passed in 1.85s)
Cross-check with independent librariesVERIFIED2026-10-06star_wrap reduces, differences and averages angles as three independent libraries do, and always returns values inside the stated ranges
BenchmarkVERIFIED2026-10-06largest differences: astropy 0.0e+00 deg, ERFA 2.4e-10 deg, SciPy mean 5.7e-14 deg

Fingerprints (SHA-256)

star_wrap-0.1.0-py3-none-any.whlfcbc3e630b7ce6d55e22436c1056a2c12e8b54c78b9127f4e66a8690749e1f30
star_wrap.pyb3719bf9bb565f0541ce464de9884f4caa718e1348f1486902b9866d7f003515
star_wrap-0.1.0-source.zipda39eb7eb4db44e6d516d95d503e0d9d70da040a285a65ed3b2f569cd0e78f8d

results