A rotation merge now keeps each acentric reflection's Bijvoet split - the inverse-variance I(+)/I(-) from the same scaled fulls - even when the merge is Friedel-averaged (the default, no -A). IMEAN stays the primary intensity and is bit-identical to before; the split is purely additive and scaled non-anomalously, so a weak anomalous signal is preserved in the output without having to reprocess with -A. French-Wilson now also fills F(+)/F(-) from the two hands (one pass, shared Wilson prior). Writers: the default (Friedel-merged) MTZ and mmCIF now carry IMEAN plus I(+)/I(-) and F/F(+)/F(-) whenever a reflection has an anomalous split (the stills path, which computes none, keeps the previous columns). A missing mate or a centric is emitted as the CCP4 missing-value flag (NaN). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <cmath>
|
|
|
|
#include "SpotToSave.h"
|
|
|
|
struct Reflection {
|
|
int32_t h;
|
|
int32_t k;
|
|
int32_t l;
|
|
float image_number; // Can be in-between for 3D integration
|
|
float delta_phi_deg; // phi angle from XDS - difference from middle of current frame (NOT an absolute angle)
|
|
float predicted_x;
|
|
float predicted_y;
|
|
float observed_x;
|
|
float observed_y;
|
|
float d;
|
|
float I;
|
|
float bkg;
|
|
float sigma;
|
|
float dist_ewald;
|
|
float rlp;
|
|
float partiality; // fraction of the reflection recorded in the sampled (rocking) slice
|
|
float zeta;
|
|
float image_scale_corr; // I_true = scaling_correction * I; scaling_correction = rlp / (partiality * image_scale)
|
|
bool observed = false;
|
|
bool on_ice_ring = false; // sits on a hexagonal-ice powder ring: excluded from scaling, kept for merging
|
|
};
|
|
|
|
struct MergedReflection {
|
|
int32_t h = 0;
|
|
int32_t k = 0;
|
|
int32_t l = 0;
|
|
float I = NAN;
|
|
float sigma = NAN;
|
|
float I_half[2] = {NAN, NAN};
|
|
float sigma_half[2] = {NAN, NAN};
|
|
float d = 0.0;
|
|
bool rfree_flag = false;
|
|
float F = NAN; // French-Wilson amplitude |F| (filled by ApplyFrenchWilson at end of merge)
|
|
float sigmaF = NAN; // its sigma
|
|
// Anomalous (Bijvoet) split of this reflection's own observations, kept even when the merge is
|
|
// Friedel-averaged (I above is the Friedel mean). Lets I(+)/I(-) be written and CCano reported by
|
|
// default without scaling anomalously; NaN when a hand was not measured or for centrics.
|
|
float I_plus = NAN;
|
|
float sigma_plus = NAN;
|
|
float I_minus = NAN;
|
|
float sigma_minus = NAN;
|
|
// French-Wilson amplitudes of the two hands (filled by ApplyFrenchWilson from I_plus/I_minus).
|
|
float F_plus = NAN;
|
|
float sigmaF_plus = NAN;
|
|
float F_minus = NAN;
|
|
float sigmaF_minus = NAN;
|
|
};
|
|
|
|
|