From f3e8379a554b7b84d70776e4a5d1fdd4e2748592 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 17 Feb 2026 13:08:59 +0100 Subject: [PATCH] jfjoch_process: Write amplitudes at the end into hkl file in addition to mmCIF file (to be improved later) --- tools/jfjoch_process.cpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tools/jfjoch_process.cpp b/tools/jfjoch_process.cpp index f6725a5e..0f3e1090 100644 --- a/tools/jfjoch_process.cpp +++ b/tools/jfjoch_process.cpp @@ -179,6 +179,7 @@ int main(int argc, char **argv) { experiment.Mode(DetectorMode::Standard); // Ensure full image analysis experiment.PixelSigned(true); experiment.OverwriteExistingFiles(true); + experiment.PolarizationFactor(0.99); // Unpolarized beam // Configure Indexing IndexingSettings indexing_settings; @@ -446,21 +447,7 @@ int main(int argc, char **argv) { scale_time, scale_result->gof2, scale_result->merged.size(), scale_result->image_ids.size()); - // Write scaled.hkl (h k l I sigma) - { - const std::string hkl_path = output_prefix + "_scaled.hkl"; - std::ofstream hkl_file(hkl_path); - if (!hkl_file) { - logger.Error("Cannot open {} for writing", hkl_path); - } else { - for (const auto &r: scale_result->merged) { - hkl_file << r.h << " " << r.k << " " << r.l << " " - << r.I << " " << r.sigma << "\n"; - } - hkl_file.close(); - logger.Info("Wrote {} reflections to {}", scale_result->merged.size(), hkl_path); - } - } + // Write image.dat (image_id mosaicity_deg K) { @@ -486,13 +473,29 @@ int main(int argc, char **argv) { fw_opts.acentric = true; // typical for MX fw_opts.num_shells = 20; - auto fw = FrenchWilson(scale_result->merged, fw_opts); { + auto fw = FrenchWilson(scale_result->merged, fw_opts); + { + { + // Write scaled.hkl (h k l I sigma) + const std::string hkl_path = output_prefix + "_amplitudes.hkl"; + std::ofstream hkl_file(hkl_path); + if (!hkl_file) { + logger.Error("Cannot open {} for writing", hkl_path); + } else { + for (const auto &r: fw) { + hkl_file << r.h << " " << r.k << " " << r.l << " " + << r.F << " " << r.sigmaF << " " + << r.I << " " << r.sigmaI + << "\n"; + } + hkl_file.close(); + logger.Info("Wrote {} reflections to {}", scale_result->merged.size(), hkl_path); + } + } MmcifMetadata cif_meta; // Unit cell — from rotation indexing result or experiment setting if (rotation_indexer_ret.has_value()) { - logger.Info("Bla {:f} {:f}", rotation_indexer_ret->lattice.GetUnitCell().a, - rotation_indexer_ret->lattice.GetUnitCell().b); cif_meta.unit_cell = rotation_indexer_ret->lattice.GetUnitCell(); } else if (experiment.GetUnitCell().has_value()) { cif_meta.unit_cell = experiment.GetUnitCell().value();