Files
Jungfraujoch/common
leonarski_fandClaude Opus 4.8 87af0f419b scale_merge: compute French-Wilson amplitudes at end of merge, write them alongside intensities
Merged reflections carried only intensities; a naive sqrt(max(I,0)) turns every weak or
negative measurement into a biased (or zero) amplitude. Add a French-Wilson step so the
merged reflections themselves carry proper Bayesian amplitudes.

New FrenchWilson.{h,cpp}: ApplyFrenchWilson() fills F and sigmaF on each MergedReflection
with the posterior mean |F| given I and its sigma under the Wilson prior:
  - correct centric vs acentric prior (gemmi is_reflection_centric);
  - epsilon (symmetry-enhancement) multiplicity: the shell mean is <I/eps> and the prior
    mean for a reflection is eps * <I/eps>;
  - numerically stable log-shift integration of the posterior;
  - strong reflections (I > 4 sigma) short-circuit to sqrt(I) where the FW bias is negligible;
  - unusable I/sigma falls back to sqrt(max(I,0)).

It runs as the last step of the merge routine (both MergeOnTheFly and RotationScaleMerge),
so F/sigmaF are part of the merged result and downstream consumers (file writing AND, later,
map calculation) all use the same amplitudes rather than each recomputing FW and risking
divergence. The writers just emit the fields; extended additively:
  - MTZ: F (F) + SIGF (Q) columns;
  - mmCIF: _refln.F_meas_au / _refln.F_meas_sigma_au;
  - HKL text: F sigmaF appended (rfree flag kept in place for back-compat).
Existing intensity columns are unchanged, so current readers keep working while
phenix.refine (etc.) can now refine against the amplitudes.

Verified on lyso (1.3 A): all 173 negative-intensity reflections get F>0, strong reflections
have F/sqrt(I)=1.000, no NaN, and the mmCIF _refln loop is well-formed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 21:27:44 +02:00
..
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-04-29 09:50:50 +02:00
2026-07-12 19:42:29 +02:00
2026-03-05 22:13:12 +01:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-02-01 13:29:33 +01:00
2026-06-08 08:30:35 +02:00
2025-05-28 18:49:27 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2026-05-28 18:48:35 +02:00
2026-05-28 18:48:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-04-29 09:50:50 +02:00
2026-06-08 08:30:35 +02:00
2026-07-12 19:42:29 +02:00
2026-07-12 19:42:29 +02:00
2026-07-03 19:18:56 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2026-06-08 08:30:35 +02:00
2025-11-19 09:40:50 +01:00
2026-06-08 08:30:35 +02:00
2026-04-29 09:50:50 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-07-12 19:42:29 +02:00
2026-07-12 19:42:29 +02:00
2026-07-12 19:42:29 +02:00
2026-07-12 19:42:29 +02:00
2026-06-08 08:30:35 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2024-11-22 21:25:20 +01:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2025-11-19 17:28:10 +01:00
2026-06-08 08:30:35 +02:00
2026-06-08 08:30:35 +02:00
2026-02-01 13:29:33 +01:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2026-04-29 09:50:50 +02:00
2026-06-08 08:30:35 +02:00
2026-06-08 08:30:35 +02:00
2026-06-25 22:01:48 +02:00
2024-12-02 21:17:14 +01:00
2026-06-08 08:30:35 +02:00
2026-07-11 07:19:11 +02:00
2026-06-23 20:29:49 +02:00
2026-07-11 07:19:11 +02:00
2026-07-03 19:18:56 +02:00
2026-07-03 19:18:56 +02:00
2026-07-12 19:42:29 +02:00
2025-09-22 19:49:39 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2025-05-28 18:49:27 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-07-03 19:18:56 +02:00
2026-06-08 08:30:35 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2024-12-08 13:26:13 +01:00
2026-06-08 08:30:35 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-23 20:29:49 +02:00
2026-06-08 08:30:35 +02:00
2026-07-12 19:42:29 +02:00
2026-07-12 19:42:29 +02:00
2025-06-15 17:46:46 +02:00
2026-07-03 19:18:56 +02:00
2026-07-11 07:19:11 +02:00
2026-06-08 08:30:35 +02:00
2025-09-08 20:28:59 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-23 20:29:49 +02:00
2025-12-12 21:24:20 +01:00
2026-06-08 08:30:35 +02:00
2026-05-28 18:48:35 +02:00
2026-05-28 18:48:35 +02:00
2025-09-21 19:27:51 +02:00
2026-06-08 08:30:35 +02:00
2026-03-03 22:24:44 +01:00
2026-06-08 08:30:35 +02:00
2026-04-16 11:59:59 +02:00
2026-06-08 08:30:35 +02:00