hilal-visibility
Crescent moon (hilal) visibility kernel. It computes the circumstances of the young crescent for any location and evening from the JPL DE440s ephemeris (via Skyfield), and classifies them under the published visibility criteria. Each criterion is fed quantities in the convention its constants were fitted on:
| Key | Source |
|---|---|
yallop |
Yallop (1997), NAO Technical Note 69, q-test (geocentric ARCV + TN 69 width W′) |
odeh |
Odeh (2004), Experimental Astronomy 18, V-test (topocentric airless ARCV + W) |
saao |
Caldwell & Laney (2001), SAAO lower-limb DALT criterion |
shaukat |
reconstruction of the moonsighting.com criterion (not a published rule) |
raw |
quantities plus q and V, no zone |
It also builds vectorized global zone grids, turns them into GeoJSON contours, labels astronomical Hijri months, and includes a validation harness against two historical sighting datasets. It is the compute kernel behind https://hilal.analyticadss.com.
Install
pip install hilal-visibility
pip install "hilal-visibility[plot]" # adds matplotlib for diagnostic PNG maps
Requires Python 3.12 or newer.
Example: one location, one evening
from datetime import date
from hilal_visibility.criteria import CRITERIA
from hilal_visibility.ephem import compute_evening, find_new_moon
# The new moon nearest 9 December 2026, and the evening of that day.
conjunction = find_new_moon(date(2026, 12, 9))
evening = conjunction.date()
# Mecca (lat, lon east-positive, elevation in metres).
r = compute_evening(21.4225, 39.8262, evening, conjunction=conjunction, elevation_m=277)
print(f"conjunction {conjunction:%Y-%m-%d %H:%M} UT")
print(f"evening of {evening}")
print(f"sunset {r.sunset_utc:%H:%M} UT, moonset {r.moonset_utc:%H:%M} UT, lag {r.lag_minutes:.0f} min")
p = r.params
print(f"moon age {p.moon_age_hours:.1f} h at sunset")
print(f"ARCV {p.arcv:.2f}° ARCL {p.arcl:.2f}° DAZ {p.daz:.2f}° W {p.w:.2f}′")
for name in ("yallop", "odeh", "saao"):
res = CRITERIA[name](p)
score = f"q = {res.q:+.3f}" if res.q is not None else f"V = {res.v:+.2f}" if res.v is not None else ""
print(f"{name:7s} zone {res.zone.value} {score}")
Output:
conjunction 2026-12-09 00:51 UT
evening of 2026-12-09
sunset 14:41 UT, moonset 14:54 UT, lag 13 min
moon age 13.8 h at sunset
ARCV 2.72° ARCL 7.28° DAZ -6.75° W 0.12′
yallop zone F q = -0.740
odeh zone D V = -3.70
saao zone D
Each criterion has its own zone letters, and the letters do not mean the same
thing across criteria. Here Yallop's F is "below the Danjon limit", Odeh's D
is "not visible", and SAAO's D is "not visible even with optical aid". The
docstring of hilal_visibility.criteria defines every zone.
hilal_visibility.grid.compute_evening_grids runs the same calculation over
the whole globe.
The ephemeris file
The first call that needs the ephemeris downloads JPL's de440s.bsp (about
32 MB) through Skyfield and caches it. The cache directory is, in order:
$HILAL_EPHEMERIS_DIR, if set;data/ephemeris/when running from a source checkout of the repository;- otherwise a per-user cache directory:
~/.cache/hilal-visibilityon Linux (or$XDG_CACHE_HOME/hilal-visibility),~/Library/Caches/hilal-visibilityon macOS,%LOCALAPPDATA%\hilal-visibilityon Windows.
hilal_visibility.ephem.ephemeris_dir() returns the directory in use. To work
offline, put a copy of de440s.bsp there.
Validation data
hilal_visibility.validate scores the criteria against Yallop (1997) Table 4
(295 records) and Alrefay et al. (2018) (476 records). Both CSVs (about 50 KB)
ship inside the package. Their provenance is in
hilal_visibility/validate/data/SOURCES.md, next to the MIT notice of the
transcription they were taken from.
Licence
MIT. Copyright (c) 2026 Analytica Data Science Solutions.
Metadata
Release files for hilal-visibility 0.1.0
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 | Actions |
|---|---|---|---|---|
| hilal_visibility-0.1.0.tar.gz | 92.1 kB | With provenance | Details for hilal_visibility-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hilal_visibility-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hilal_visibility-0.1.0-py3-none-any.whl |
Total release size: 196.3 kB
Release files / hilal_visibility-0.1.0.tar.gz
| Download URL | hilal_visibility-0.1.0.tar.gz |
|---|---|
| Size | 92.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba38908e120f6bd6b5294afa89633859e8c26584ea2c5d351a3785dad33410ef
|
|
BLAKE2b-256 checksum How to use checksums |
02e12e2205f46a00f8b996b59f93ea971bf7ff2356c5454f7c428fd60289911f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / hilal_visibility-0.1.0-py3-none-any.whl
| Download URL | hilal_visibility-0.1.0-py3-none-any.whl |
|---|---|
| Size | 104.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9ebbcf97f4f283b51d9ab0eced256981768de1460c48b04fd0feaae6c01a74e
|
|
BLAKE2b-256 checksum How to use checksums |
7926a3a33fd110072d87473fddce44f3dceb17f52abaf2dcbcb37e4ce3175bd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for hilal-visibility 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for hilal_visibility-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA 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.