jfjoch_process: Save reflections as mmCIF (experimental)
This commit is contained in:
+38
-12
@@ -25,6 +25,7 @@
|
||||
#include "../receiver/JFJochReceiverPlots.h"
|
||||
#include "../compression/JFJochCompressor.h"
|
||||
#include "../image_analysis/scale_merge/FrenchWilson.h"
|
||||
#include "../image_analysis/WriteMmcif.h" // (actually include at top of file)
|
||||
|
||||
void print_usage(Logger &logger) {
|
||||
logger.Info("Usage ./jfjoch_analysis {<options>} <input.h5>");
|
||||
@@ -489,19 +490,44 @@ int main(int argc, char **argv) {
|
||||
|
||||
auto fw = FrenchWilson(scale_result->merged, fw_opts);
|
||||
|
||||
const std::string fw_path = output_prefix + "_amplitudes.hkl";
|
||||
std::ofstream fw_file(fw_path);
|
||||
if (!fw_file) {
|
||||
logger.Error("Cannot open {} for writing", fw_path);
|
||||
} else {
|
||||
fw_file << "# h k l F sigmaF I_fw sigmaI\n";
|
||||
for (const auto& r : fw) {
|
||||
fw_file << r.h << " " << r.k << " " << r.l << " "
|
||||
<< r.F << " " << r.sigmaF << " "
|
||||
<< r.I << " " << r.sigmaI << "\n";
|
||||
{
|
||||
|
||||
MmcifMetadata cif_meta;
|
||||
|
||||
// Unit cell — from rotation indexing result or experiment setting
|
||||
if (rotation_indexer_ret.has_value()) {
|
||||
cif_meta.unit_cell = rotation_indexer_ret->lattice.GetUnitCell();
|
||||
} else if (experiment.GetUnitCell().has_value()) {
|
||||
cif_meta.unit_cell = experiment.GetUnitCell().value();
|
||||
}
|
||||
|
||||
// Space group
|
||||
if (auto sg = experiment.GetGemmiSpaceGroup(); sg.has_value()) {
|
||||
cif_meta.space_group_name = sg->hm;
|
||||
cif_meta.space_group_number = sg->number;
|
||||
} else if (space_group) {
|
||||
cif_meta.space_group_name = space_group->hm;
|
||||
cif_meta.space_group_number = space_group->number;
|
||||
}
|
||||
|
||||
// Detector & experiment info
|
||||
cif_meta.detector_name = experiment.GetDetectorDescription();
|
||||
cif_meta.wavelength_A = experiment.GetWavelength_A();
|
||||
cif_meta.detector_distance_mm = experiment.GetDetectorDistance_mm();
|
||||
cif_meta.sample_temperature_K = experiment.GetSampleTemperature_K();
|
||||
cif_meta.sample_name = experiment.GetSampleName();
|
||||
cif_meta.data_block_name = output_prefix;
|
||||
|
||||
cif_meta.beamline = experiment.GetInstrumentName();
|
||||
cif_meta.source = experiment.GetSourceName();
|
||||
|
||||
const std::string cif_path = output_prefix + "_amplitudes.cif";
|
||||
try {
|
||||
WriteMmcifReflections(cif_path, fw, cif_meta);
|
||||
logger.Info("Wrote mmCIF reflections to {}", cif_path);
|
||||
} catch (const std::exception& e) {
|
||||
logger.Error("Failed to write mmCIF: {}", e.what());
|
||||
}
|
||||
fw_file.close();
|
||||
logger.Info("French-Wilson: wrote {} amplitudes to {}", fw.size(), fw_path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user