CCP4: Add library to save MTZs
Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Failing after 8m35s
Build Packages / build:rpm (rocky8_nocuda) (push) Failing after 10m40s
Build Packages / build:rpm (rocky9_nocuda) (push) Failing after 10m50s
Build Packages / Generate python client (push) Successful in 34s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Failing after 11m16s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8_sls9) (push) Failing after 11m25s
Build Packages / build:rpm (rocky8) (push) Failing after 11m29s
Build Packages / Build documentation (push) Successful in 53s
Build Packages / build:rpm (rocky9) (push) Failing after 11m45s
Build Packages / build:rpm (ubuntu2204) (push) Failing after 11m54s
Build Packages / Unit tests (push) Failing after 3m37s
Build Packages / build:rpm (ubuntu2404) (push) Failing after 6m40s

This commit is contained in:
2026-02-08 19:55:48 +01:00
parent 58f29409e6
commit d4d1f6cd9c
70 changed files with 50833 additions and 5 deletions

View File

@@ -25,6 +25,7 @@
#include "../receiver/JFJochReceiverPlots.h"
#include "../compression/JFJochCompressor.h"
#include "../image_analysis/scale_merge/FrenchWilson.h"
#include "../image_analysis/scale_merge/MtzWriter.h"
void print_usage(Logger &logger) {
logger.Info("Usage ./jfjoch_analysis {<options>} <input.h5>");
@@ -426,10 +427,9 @@ int main(int argc, char **argv) {
}
}
// --- French-Wilson: convert I → F ---
{
FrenchWilsonOptions fw_opts;
fw_opts.acentric = true; // typical for MX
fw_opts.acentric = true;
fw_opts.num_shells = 20;
auto fw = FrenchWilson(scale_result->merged, fw_opts);
@@ -448,6 +448,30 @@ int main(int argc, char **argv) {
fw_file.close();
logger.Info("French-Wilson: wrote {} amplitudes to {}", fw.size(), fw_path);
}
// --- Write MTZ files ---
MtzWriteOptions mtz_opts(experiment,
rotation_indexer_ret.has_value()
? std::optional<UnitCell>(rotation_indexer_ret->lattice.GetUnitCell())
: std::nullopt);
// Intensities MTZ
{
const std::string mtz_i_path = output_prefix + "_scaled.mtz";
if (WriteMtzIntensities(mtz_i_path, scale_result->merged, mtz_opts))
logger.Info("Wrote {} reflections to {}", scale_result->merged.size(), mtz_i_path);
else
logger.Error("Failed to write {}", mtz_i_path);
}
// Amplitudes MTZ (French-Wilson)
{
const std::string mtz_f_path = output_prefix + "_amplitudes.mtz";
if (WriteMtzAmplitudes(mtz_f_path, fw, mtz_opts))
logger.Info("Wrote {} reflections to {}", fw.size(), mtz_f_path);
else
logger.Error("Failed to write {}", mtz_f_path);
}
}
} else {
logger.Warning("Scaling skipped — too few reflections accumulated (need >= 20)");