joshruby commited on
Commit
4e3dd3c
·
verified ·
1 Parent(s): dde145d

debug: link coverage

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -510,3 +510,16 @@ def passage(seg: int):
510
  @app.get("/")
511
  def root():
512
  return {"ok": True, "see": "/api/status"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  @app.get("/")
511
  def root():
512
  return {"ok": True, "see": "/api/status"}
513
+
514
+
515
+ @app.get("/api/debug/links")
516
+ def debug_links(seg: int):
517
+ need_ready()
518
+ deg = np.diff(X["lptr"])
519
+ a, b = int(X["lptr"][seg]), int(X["lptr"][seg + 1])
520
+ w0, w1 = work_of(seg)
521
+ wd = deg[w0:w1]
522
+ return {"pairs": int(len(X["ldst"])), "segs_with_links": int((deg > 0).sum()), "deg": b - a,
523
+ "work": X["title"][seg], "work_segs": w1 - w0, "work_segs_linked": int((wd > 0).sum()),
524
+ "sample": [refs(int(t))[0] for t in X["ldst"][a:a + 8]],
525
+ "linked_in_work": [refs(w0 + int(i))[0] for i in np.flatnonzero(wd > 0)[:5]]}