126 ap = argparse.ArgumentParser()
127 ap.add_argument(
"--rows", type=Path, required=
True)
128 ap.add_argument(
"--targets", type=Path, default=HERE /
"targets_T4.json")
129 ap.add_argument(
"--top", type=int, default=10)
130 a = ap.parse_args(argv)
132 tg = json.loads(a.targets.read_text(encoding=
"utf-8"))
134 for fam
in (
"neutron",
"ion"):
135 for p
in tg[fam][
"points"]:
137 conds = json.loads((HERE /
"conditions_T4.json").read_text(encoding=
"utf-8"))
139 rows = [json.loads(l)
for l
in a.rows.read_text(encoding=
"utf-8").splitlines()
147 c = conds.get(r.get(
"condition"), {})
148 t = by_id.get(c.get(
"_target_id"))
153 scored.append((s, r, m, t, notes))
154 scored.sort(key=
lambda x: (math.isnan(x[0]), x[0]))
156 print(f
"scored {len(scored)} rows against targets_T4.json\n")
157 for s, r, m, t, notes
in scored[:a.top]:
158 chan = (f
"chi={r.get('loop_net_chi')} w_c={r.get('loop_net_w_c')} "
159 f
"K_rec={r.get('loop_net_K_rec')}")
160 print(f
"row {r['row_id']:>4} {r.get('condition')} misfit={s:.3f} {chan}")
161 print(f
" dose_reached={r.get('dose_reached')} starved={r.get('starved')} "
162 f
"topbin_100={r.get('topbin_100')} pile_100={r.get('pile_100')}")