Koyomi (暦注)¶
A koyomi day-quality engine. Given a civil date, it reports the day's 六曜 (rokuyō), its sexagenary 干支, the sectional solar month, and the supported 選日 day flags: 一粒万倍日, 三隣亡, and 天赦日. It reuses the lunisolar converter, solar-term astronomy, and the sexagenary day count.
The annotations that lacked a single authoritative public definition (不成就日, whose day pattern differs between sources, and the calendrical 二十八宿 cycle, which had no verifiable epoch anchor) are intentionally omitted rather than guessed.
from fortune_telling_core import Querent, ReadingRequest
from fortune_telling_core.traditions.koyomi import KOYOMI_DECK, KOYOMI_SPREAD, build_engine
request = ReadingRequest(
deck_id=KOYOMI_DECK.id,
spread_id=KOYOMI_SPREAD.id,
querent=Querent(
id="sample",
display_name="Sample",
attributes={"target_datetime": "2024-01-01T12:00:00+09:00"},
),
)
reading = build_engine().cast(request)
The day to evaluate may also be supplied as the request-level
as_of moment instead of the target_datetime attribute;
an explicit target_datetime takes precedence when both are given.
koyomi ¶
KOYOMI_DECK
module-attribute
¶
KOYOMI_DECK = Deck(
id="koyomi.deck.rokuyo.v1",
symbols=tuple(
(
Symbol(
id=f"koyomi.rokuyo.{slug}",
name=f"{cjk} {romaji}",
attributes={"cjk": cjk},
)
)
for slug, cjk, romaji in ROKUYO
),
)
KOYOMI_SPREAD
module-attribute
¶
KOYOMI_SPREAD = Spread(
id="koyomi.spread.day.v1",
name="Koyomi Day Quality",
positions=(
Position(
"rokuyo",
"Rokuyō",
"The day's 六曜, with 干支 and 選日 annotations.",
),
),
)
KoyomiEngine ¶
Bases: AbstractEngine
Koyomi day-quality engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ephemeris
|
Ephemeris | None
|
Optional backend implementing the shared ephemeris protocol.
Defaults to |
None
|
Source code in src/fortune_telling_core/traditions/koyomi/engine.py
deck ¶
Return the koyomi rokuyō deck.
spread ¶
Return the koyomi day-quality spread.
Source code in src/fortune_telling_core/traditions/koyomi/engine.py
draw ¶
Compute the day's koyomi annotations as a deterministic draw.
Source code in src/fortune_telling_core/traditions/koyomi/engine.py
cast ¶
Compute a koyomi reading without a caller RNG.