v1.0.0-rc.91

This commit is contained in:
2025-10-20 20:43:44 +02:00
parent 6524365ffa
commit 061152279c
260 changed files with 4856 additions and 1063 deletions

View File

@@ -4,9 +4,50 @@
#include "HDF5DataFilePluginMX.h"
#define RESERVE_IMAGES 1000
HDF5DataFilePluginMX::HDF5DataFilePluginMX(const StartMessage& msg)
: max_spots(msg.max_spot_count) {
inline std::string to_bravais_code(const std::optional<LatticeMessage> &lm_opt) {
if (!lm_opt.has_value()) return "";
const auto &lm = lm_opt.value();
const char C = lm.centering;
switch (lm.crystal_system) {
case gemmi::CrystalSystem::Triclinic:
if (C == 'P') return "aP";
break;
case gemmi::CrystalSystem::Monoclinic:
if (C == 'P') return "mP";
if (C == 'A') return "mA";
if (C == 'B') return "mB";
if (C == 'C') return "mC";
break;
case gemmi::CrystalSystem::Orthorhombic:
if (C == 'P') return "oP";
if (C == 'A') return "oA";
if (C == 'B') return "oB";
if (C == 'C') return "oC";
if (C == 'F') return "oF";
if (C == 'I') return "oI";
break;
case gemmi::CrystalSystem::Tetragonal:
if (C == 'P') return "tP";
if (C == 'I') return "tI";
break;
case gemmi::CrystalSystem::Trigonal:
if (C == 'R') return "hR"; // rhombohedral in hex setting
break;
case gemmi::CrystalSystem::Hexagonal:
if (C == 'P') return "hP";
break;
case gemmi::CrystalSystem::Cubic:
if (C == 'P') return "cP";
if (C == 'F') return "cF";
if (C == 'I') return "cI";
break;
}
return "";
}
HDF5DataFilePluginMX::HDF5DataFilePluginMX(const StartMessage &msg)
: max_spots(msg.max_spot_count) {
}
void HDF5DataFilePluginMX::OpenFile(HDF5File &data_file, const DataMessage &msg) {
@@ -69,7 +110,7 @@ void HDF5DataFilePluginMX::Write(const DataMessage &msg, uint64_t image_number)
for (int i = 0; i < spot_cnt; i++) {
spot_x[max_spots * image_number + i] = msg.spots[i].x;
spot_y[max_spots * image_number + i] = msg.spots[i].y;
spot_y[max_spots * image_number + i] = msg.spots[i].y;
spot_int[max_spots * image_number + i] = msg.spots[i].intensity;
spot_indexed[max_spots * image_number + i] = msg.spots[i].indexed;
spot_ice_ring[max_spots * image_number + i] = msg.spots[i].ice_ring;
@@ -118,6 +159,11 @@ void HDF5DataFilePluginMX::Write(const DataMessage &msg, uint64_t image_number)
for (int i = 0; i < 9; i++)
indexed_lattice[image_number * 9 + i] = tmp[i];
}
if (msg.lattice_type) {
bravais_lattice[image_number] = to_bravais_code(msg.lattice_type);
niggli_class[image_number] = msg.lattice_type->niggli_class;
}
}
void HDF5DataFilePluginMX::WriteFinal(HDF5File &data_file) {
@@ -134,7 +180,8 @@ void HDF5DataFilePluginMX::WriteFinal(HDF5File &data_file) {
data_file.SaveVector("/entry/MX/peakH", spot_h, {(hsize_t) (max_image_number + 1), max_spots});
data_file.SaveVector("/entry/MX/peakK", spot_k, {(hsize_t) (max_image_number + 1), max_spots});
data_file.SaveVector("/entry/MX/peakL", spot_l, {(hsize_t) (max_image_number + 1), max_spots});
data_file.SaveVector("/entry/MX/peakDistEwaldSphere", spot_dist_ewald, {(hsize_t) (max_image_number + 1), max_spots});
data_file.SaveVector("/entry/MX/peakDistEwaldSphere", spot_dist_ewald,
{(hsize_t) (max_image_number + 1), max_spots});
}
if (!strong_pixel_count.empty())
@@ -164,7 +211,10 @@ void HDF5DataFilePluginMX::WriteFinal(HDF5File &data_file) {
data_file.SaveVector("/entry/MX/beam_corr_x", beam_corr_x.vec())->Units("pixel");
if (!beam_corr_y.empty())
data_file.SaveVector("/entry/MX/beam_corr_y", beam_corr_y.vec())->Units("pixel");
if (!niggli_class.empty())
data_file.SaveVector("/entry/MX/niggli_class", niggli_class.vec());
if (!bravais_lattice.empty())
data_file.SaveVector("/entry/MX/bravais_lattice", bravais_lattice.vec());
if (!resolution_estimate.empty())
data_file.SaveVector("/entry/MX/resolutionEstimate", resolution_estimate.vec())->Units("Angstrom");
}