diff --git a/tools/battery/battery.py b/tools/battery/battery.py index 72ed37663..84c75a0d7 100644 --- a/tools/battery/battery.py +++ b/tools/battery/battery.py @@ -26,7 +26,7 @@ The site config (data roots, runs root, lock, gpulock, private manifest, baselin $JFJOCH_BATTERY_SITE, else site.json beside this script (not committed; site.example.json is). Every set runs once, with one command per arm (COMMAND_DOC): the open arm with the deposited model -(--model), the XDS arms with -A where XDS was anomalous and XDS's range as a report-only second +(--model), the XDS arms with XDS's range as a report-only second table (--report-resolution). Neither option changes the processing, so the one run is both what a user gets and the like-for-like comparison. @@ -68,8 +68,9 @@ PDB_ID = re.compile(r"^[0-9][A-Za-z0-9]{3}$") COMMAND_DOC = { "deposition": "`rugnux --model ` (without --model where there is no " "deposited model: small molecules, unpublished sets)", - "xds": "`rugnux [-A] --report-resolution , `: -A where XDS kept " - "Friedel mates apart; the second statistics table at XDS's range is report-only", + "xds": "`rugnux --report-resolution , `: the second statistics " + "table at XDS's range is report-only; where XDS kept Friedel mates apart the scorer " + "reads the run's own per-hand table, which needs no flag", } LOCAL_SITE = os.path.join(HERE, "site.json") @@ -174,10 +175,10 @@ def command(binary, e, opts, model=None): cmd += ["-N", str(opts["threads"])] ref = e.get("ref") or {} if e["reference"] == "xds": - # XDS merged with FRIEDEL'S_LAW=FALSE: merge Friedel mates separately too, or the merging - # statistics are not comparable - if ref.get("anomalous"): - cmd.append("-A") + # No -A, whatever the reference did. A rotation run decides with Friedel's mates merged + # either way, and reports the merge counted BOTH ways from that one run; -A only says which + # of the two tables was asked for. Where XDS merged with FRIEDEL'S_LAW=FALSE the scorer + # reads rugnux's per-hand block (ANOM_REFRES_*) instead, which is the like-for-like table. # a second statistics table over XDS's own range, from the same merge (report only). XDS's # own limit, not the derived reference d_min: the manifest's XDS totals are over XDS's range, # so only that makes the table like for like. Shells past rugnux's own cut print as not diff --git a/tools/battery/score.py b/tools/battery/score.py index 6d213c039..8742d1bab 100644 --- a/tools/battery/score.py +++ b/tools/battery/score.py @@ -38,7 +38,10 @@ def read_report(path): if f[:2] == ["d_min", "N_obs"]: header = f elif header and f and re.match(r"^\d+\.\d+$", f[0]): - prefix = "REFRES_" if "REFRES_RANGE" in out else "" + # Three tables in report order: the run's own, the --report-resolution one, and the + # per-hand (FRIEDEL'S_LAW=FALSE) one, whose keys are written just above it. + prefix = ("ANOM_" if "ANOM_UNIQUE_REFLECTIONS" in out + else "REFRES_" if "REFRES_RANGE" in out else "") out[prefix + "LOWRES_D"] = f[0] r_meas = f[header.index("R_meas")].rstrip("%") # "3.7%", or "-" for none out[prefix + "LOWRES_R_MEAS"] = "" if r_meas == "-" else str(round(float(r_meas) / 100, 4)) @@ -199,6 +202,20 @@ def judge(entry, rep, run_note): # the same merge binned over the reference's range (--report-resolution, XDS arms) r.update({k: fnum(rep.get(k.upper())) for k in REFRES_KEYS}) r["refres_range"] = rep.get("REFRES_RANGE") + # An XDS reference measured with FRIEDEL'S_LAW=FALSE counts its uniques, completeness, + # multiplicity, R_meas and CC1/2 per Bijvoet hand, so what is like for like is the per-hand + # table of the same rugnux merge - the Friedel-merged one has about twice the multiplicity. + # Both tables come out of one bare run: -A is presentation only and changes nothing that is + # compared here. ISa is not among them - there is one error model, fitted on the hands, and + # REFRES_ISA is it. + r["per_hand_reference"] = False + if ref.get("anomalous"): + for k in ("unique_reflections", "completeness", "multiplicity", "i_over_sigma", + "r_meas", "cc_half"): + v = fnum(rep.get("ANOM_REFRES_" + k.upper())) + if v is not None: + r["refres_" + k] = v + r["per_hand_reference"] = True r["isa_ratio"] = round(r["refres_isa"] / r["isa_ref"], 4) if r["refres_isa"] and r["isa_ref"] else None r["r_meas_ratio"] = (round(r["refres_r_meas"] / r["r_meas_ref"], 4) if r["refres_r_meas"] and r["r_meas_ref"] else None)