feat: sync ordered oss remaining probes
This commit is contained in:
@@ -179,25 +179,6 @@ def _kp_cusp_snapshot(chart: dict[str, Any]) -> dict[str, Any]:
|
||||
return snapshot
|
||||
|
||||
|
||||
def _prioritize_questions(questions: list[dict[str, Any]], scan: dict[str, Any]) -> tuple[list[dict[str, Any]], str]:
|
||||
"""Prefer questions whose declared layers actually differ in sampled candidates."""
|
||||
samples = scan.get("samples") or []
|
||||
if len(samples) < 2 or not all(isinstance(sample.get("varga_lagna"), dict) for sample in samples):
|
||||
return questions, "generic_fallback_missing_candidate_recast"
|
||||
changed: set[str] = set()
|
||||
for layer in ("D4", "D9", "D10", "D24", "D30"):
|
||||
values = {str((sample["varga_lagna"].get(layer) or {}).get("sign_idx")) for sample in samples}
|
||||
if len(values) > 1:
|
||||
changed.add(layer)
|
||||
for layer in ("A7", "A10", "UL"):
|
||||
values = {str(((sample.get("arudha") or {}).get(layer) or {}).get("sign_idx")) for sample in samples}
|
||||
if len(values) > 1:
|
||||
changed.add(layer)
|
||||
if not changed:
|
||||
return questions, "generic_fallback_no_sampled_difference"
|
||||
return sorted(questions, key=lambda question: (not bool(changed.intersection(question.get("sensitivity") or [])), question.get("round", 99))), "candidate_difference_ranked"
|
||||
|
||||
|
||||
def build_questionnaire(
|
||||
birth_time: str,
|
||||
uncertainty_minutes: int = 30,
|
||||
@@ -225,16 +206,18 @@ def build_questionnaire(
|
||||
"D": {"effect": "neutral", "cluster": "neutral", "points": 0},
|
||||
},
|
||||
})
|
||||
scan = _candidate_scan(
|
||||
_parse_time(birth_time), uncertainty_minutes, step_minutes,
|
||||
lat=lat, lon=lon, tz=tz, ayanamsa=ayanamsa,
|
||||
)
|
||||
questions, question_selection = _prioritize_questions(questions, scan)
|
||||
return {
|
||||
"scope": "active_birth_time_rectification_questionnaire",
|
||||
"schema_version": 1,
|
||||
"candidate_scan": scan,
|
||||
"question_selection": question_selection,
|
||||
"candidate_scan": _candidate_scan(
|
||||
_parse_time(birth_time),
|
||||
uncertainty_minutes,
|
||||
step_minutes,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
tz=tz,
|
||||
ayanamsa=ayanamsa,
|
||||
),
|
||||
"workflow": [
|
||||
"candidate_time_scan",
|
||||
"varga_arudha_kp_sensitivity_diff",
|
||||
@@ -248,7 +231,7 @@ def build_questionnaire(
|
||||
"2": "domain follow-up",
|
||||
"3": "fine confirmation",
|
||||
},
|
||||
"sensitivity_layers": ["D9", "D10", "D24", "D30", "D60", "D4", "UL", "A7", "A10", "Vimshottari", "Narayana", "Chara"],
|
||||
"sensitivity_layers": ["D9", "D10", "D24", "D30", "D60", "D4", "UL", "A7", "A10", "KP_cusp", "Vimshottari", "Narayana", "Chara"],
|
||||
"questions": questions,
|
||||
"boundary": "Question generation only; final rectification requires scoring answers against actual candidate chart differences.",
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Extract jyotishganit Shadbala object surface raw/hash."""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "references/open_source_sources/jyotishganit"
|
||||
|
||||
|
||||
def clean(v: Any) -> Any:
|
||||
if isinstance(v, dict):
|
||||
return {k: clean(val) for k, val in v.items()}
|
||||
if isinstance(v, list):
|
||||
return [clean(x) for x in v]
|
||||
if hasattr(v, "item"):
|
||||
try:
|
||||
return v.item()
|
||||
except Exception:
|
||||
pass
|
||||
return v
|
||||
|
||||
|
||||
def stable(data: Any) -> str:
|
||||
return json.dumps(clean(data), ensure_ascii=False, sort_keys=True, separators=(",", ":"), default=str)
|
||||
|
||||
|
||||
def build(args: argparse.Namespace) -> dict[str, Any]:
|
||||
sys.path.insert(0, str(SRC))
|
||||
from jyotishganit.main import calculate_birth_chart # type: ignore
|
||||
|
||||
chart = calculate_birth_chart(
|
||||
datetime.fromisoformat(args.datetime),
|
||||
args.latitude,
|
||||
args.longitude,
|
||||
args.timezone,
|
||||
args.location,
|
||||
args.name,
|
||||
)
|
||||
rows = {
|
||||
p.celestial_body: clean(p.shadbala)
|
||||
for p in chart.d1_chart.planets
|
||||
if p.shadbala
|
||||
}
|
||||
required = ["Sthanabala", "Digbala", "Kaalabala", "Cheshtabala", "Naisargikabala", "Drikbala", "Shadbala"]
|
||||
coverage = {
|
||||
body: {key: key in values for key in required}
|
||||
for body, values in rows.items()
|
||||
}
|
||||
raw = {"request": vars(args), "shadbala": rows}
|
||||
return {
|
||||
"scope": "jyotishganit_shadbala_surface_probe",
|
||||
"created_at": "2026-07-19",
|
||||
"status": "complete" if rows else "missing",
|
||||
"claim_status": "observation_only",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"source_path": "references/open_source_sources/jyotishganit/jyotishganit/components/strengths.py",
|
||||
"api_surface": {
|
||||
"calculate_all_strengths": True,
|
||||
"compute_shadbala": True,
|
||||
"six_strengths": required[:6],
|
||||
},
|
||||
"coverage": coverage,
|
||||
"raw_hash": hashlib.sha256(stable(raw).encode("utf-8")).hexdigest(),
|
||||
"raw": raw,
|
||||
"boundary": "jyotishganit exposes Shadbala via object surface, not top-level to_dict. Observation-only until component units and external worked examples are compared.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--datetime", default="1955-02-24T19:15:00")
|
||||
ap.add_argument("--latitude", type=float, default=37.3382)
|
||||
ap.add_argument("--longitude", type=float, default=-122.0383)
|
||||
ap.add_argument("--timezone", type=float, default=-8.0)
|
||||
ap.add_argument("--location", default="San Francisco, CA")
|
||||
ap.add_argument("--name", default="Steve Jobs public")
|
||||
ap.add_argument("--output")
|
||||
args = ap.parse_args()
|
||||
payload = build(args)
|
||||
text = json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True)
|
||||
if args.output:
|
||||
Path(args.output).write_text(text + "\n", encoding="utf-8")
|
||||
print(text)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Batch VedicAstro KP cusp raw/hash over public cases."""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "references/open_source_sources/VedicAstro"
|
||||
CASES = ROOT / "references/public_oracle_cases.json"
|
||||
|
||||
|
||||
def stable(data: Any) -> str:
|
||||
return json.dumps(data, ensure_ascii=False, sort_keys=True, separators=(",", ":"), default=str)
|
||||
|
||||
|
||||
def build(args: argparse.Namespace) -> dict[str, Any]:
|
||||
sys.path.insert(0, str(SRC))
|
||||
from vedicastro.VedicAstro import VedicHoroscopeData # type: ignore
|
||||
|
||||
cases = json.loads(Path(args.cases).read_text(encoding="utf-8"))["cases"]
|
||||
rows = []
|
||||
for case in cases[: args.limit]:
|
||||
b = case["birth"]
|
||||
try:
|
||||
v = VedicHoroscopeData(
|
||||
b["year"],
|
||||
b["month"],
|
||||
b["day"],
|
||||
b["hour"],
|
||||
b["minute"],
|
||||
b.get("second", 0),
|
||||
b["lat"],
|
||||
b["lon"],
|
||||
tz=None,
|
||||
ayanamsa=args.ayanamsa,
|
||||
house_system=args.house_system,
|
||||
)
|
||||
houses = [r._asdict() for r in v.get_houses_data_from_chart(v.generate_chart())]
|
||||
raw = {"case_id": case["id"], "name": case["name"], "sources": case.get("sources", []), "houses": houses}
|
||||
rows.append(
|
||||
{
|
||||
"case_id": case["id"],
|
||||
"name": case["name"],
|
||||
"status": "complete",
|
||||
"house_count": len(houses),
|
||||
"raw_hash": hashlib.sha256(stable(raw).encode("utf-8")).hexdigest(),
|
||||
"raw": raw,
|
||||
}
|
||||
)
|
||||
except Exception as exc:
|
||||
rows.append({"case_id": case["id"], "name": case["name"], "status": "blocked", "error": str(exc), "error_type": type(exc).__name__})
|
||||
return {
|
||||
"scope": "vedicastro_kp_cusp_batch_probe",
|
||||
"created_at": "2026-07-19",
|
||||
"status": "complete",
|
||||
"claim_status": "observation_only",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"dependency_identity": {
|
||||
"required_flatlib_source": "git+https://github.com/diliprk/flatlib.git@sidereal",
|
||||
"observed_pinned_flatlib_commit": "2618c348ce1ab2588548f935ff65f031630b4872",
|
||||
},
|
||||
"settings": {"ayanamsa": args.ayanamsa, "house_system": args.house_system, "timezone_policy": "timezonefinder_from_public_lat_lon"},
|
||||
"summary": {
|
||||
"case_count": len(rows),
|
||||
"complete_count": sum(1 for r in rows if r["status"] == "complete"),
|
||||
"blocked_count": sum(1 for r in rows if r["status"] != "complete"),
|
||||
},
|
||||
"cases": rows,
|
||||
"boundary": "Batch public-case KP cusp runtime raw. Observation-only; public worked-example expected values are still required for numeric oracle readiness.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--cases", default=str(CASES))
|
||||
ap.add_argument("--limit", type=int, default=3)
|
||||
ap.add_argument("--ayanamsa", default="Krishnamurti")
|
||||
ap.add_argument("--house-system", default="Placidus")
|
||||
ap.add_argument("--output")
|
||||
args = ap.parse_args()
|
||||
payload = build(args)
|
||||
text = json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True)
|
||||
if args.output:
|
||||
Path(args.output).write_text(text + "\n", encoding="utf-8")
|
||||
print(text)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user