Skip to content

Commit 50e0af8

Browse files
committed
Add public is_cached() method to GaiaIndexBuilder
1 parent 894ad16 commit 50e0af8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

index_builder.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ def __post_init__(self) -> None:
8282

8383
# ── Public API ────────────────────────────────────────────────────────────
8484

85+
def is_cached(self, ra: float, dec: float, obs_time=None) -> bool:
86+
"""
87+
Return True if a valid cached index already exists for this position.
88+
89+
This is a read-only pre-flight check; it does not build anything.
90+
Use it to report progress before calling :meth:`ensure_index`.
91+
"""
92+
return self._cache_hit(ra, dec, obs_time) and bool(
93+
self._index_files_for(ra, dec)
94+
)
95+
8596
def ensure_index(self, ra: float, dec: float, obs_time=None) -> bool:
8697
"""
8798
Ensure astrometry.net index files exist for the given sky position.

0 commit comments

Comments
 (0)