Panel id on spots and the panel table in the start message
SpotToSave gains int16_t panel (-1 = no panel table). It sits in the padding after the two bools, so sizeof(SpotToSave) stays 80. It is serialised only where it is set: CBOR spot key "panel", HDF5 /entry/MX/peakPanel (data file, plus a virtual dataset in a VDS master when the start message has panels), read back by HDF5MetadataSource. For a flat detector none of these is written, so files and streams for existing data are byte-for-byte unchanged. The start message carries the panel table (detector_modules, CBOR key absent when empty), filled from the experiment; JFJochHttpReader takes it, so a stream viewer knows the panels too. AssignModules takes the spot's panel id where it has one - the stored pixel box it was found in - and falls back to the plane position otherwise (every spot until per-panel spot finding sets the id). Reflection deliberately gets no panel id (owner decision): it is needed only between prediction and integration, and the struct feeds GPU layout and memory budgets. Tests: CBORSerialize_SpotPanelId, CBORSerialize_StartDetectorModules, JFJochReader_PanelId (VDS/legacy/integrated, with and without panels). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
This commit is contained in:
1 parent
c8fb472f4d
commit
dc784c073d
15 files changed
+274
-4
No files matched your search
@@ -238,6 +238,8 @@ inline void CBOR_ENC(CborEncoder &encoder, const SpotToSave& spot) {
|
||||
CBOR_ENC(mapEncoder, "indexed", spot.indexed);
|
||||
CBOR_ENC(mapEncoder, "latt", spot.lattice);
|
||||
CBOR_ENC(mapEncoder, "image", spot.image);
|
||||
if (spot.panel >= 0)
|
||||
CBOR_ENC(mapEncoder, "panel", static_cast<int64_t>(spot.panel));
|
||||
if (spot.indexed) {
|
||||
CBOR_ENC(mapEncoder, "h", spot.h);
|
||||
CBOR_ENC(mapEncoder, "k", spot.k);
|
||||
@@ -484,6 +486,33 @@ inline void CBOR_ENC_AZINT_MAP(CborEncoder &encoder, const StartMessage &msg) {
|
||||
CBOR_ENC_2D_TYPED_ARRAY(encoder, image);
|
||||
}
|
||||
|
||||
// Not a DECTRIS field. Absent for a flat detector (no panel table), which is what every stream written
|
||||
// before the key existed means.
|
||||
inline void CBOR_ENC_DETECTOR_MODULES(CborEncoder &encoder, const std::vector<DetectorModule> &modules) {
|
||||
if (modules.empty())
|
||||
return;
|
||||
CborEncoder arrayEncoder;
|
||||
cborErr(cbor_encode_text_stringz(&encoder, "detector_modules"));
|
||||
cborErr(cbor_encoder_create_array(&encoder, &arrayEncoder, modules.size()));
|
||||
for (const auto &m: modules) {
|
||||
CborEncoder mapEncoder;
|
||||
cborErr(cbor_encoder_create_map(&arrayEncoder, &mapEncoder, 10));
|
||||
CBOR_ENC(mapEncoder, "x0", m.x0);
|
||||
CBOR_ENC(mapEncoder, "y0", m.y0);
|
||||
CBOR_ENC(mapEncoder, "width", m.width);
|
||||
CBOR_ENC(mapEncoder, "height", m.height);
|
||||
const std::pair<const char *, double> placement[] = {
|
||||
{"ox", m.ox}, {"oy", m.oy}, {"fx", m.fx}, {"fy", m.fy}, {"sx", m.sx}, {"sy", m.sy}
|
||||
};
|
||||
for (const auto &[key, val]: placement) {
|
||||
cborErr(cbor_encode_text_stringz(&mapEncoder, key));
|
||||
cborErr(cbor_encode_double(&mapEncoder, val));
|
||||
}
|
||||
cborErr(cbor_encoder_close_container(&arrayEncoder, &mapEncoder));
|
||||
}
|
||||
cborErr(cbor_encoder_close_container(&encoder, &arrayEncoder));
|
||||
}
|
||||
|
||||
inline void CBOR_ENC_ROI_MAP(CborEncoder &encoder, const StartMessage &msg) {
|
||||
if (msg.roi_map.empty())
|
||||
return;
|
||||
@@ -835,6 +864,7 @@ void CBORStream2Serializer::SerializeSequenceStart(const StartMessage& message)
|
||||
CBOR_ENC_PIXEL_MASK(mapEncoder, message);
|
||||
CBOR_ENC_AZINT_MAP(mapEncoder, message);
|
||||
CBOR_ENC_ROI_MAP(mapEncoder, message);
|
||||
CBOR_ENC_DETECTOR_MODULES(mapEncoder, message.detector_modules);
|
||||
|
||||
CBOR_ENC(mapEncoder, "channels", message.channels);
|
||||
CBOR_ENC(mapEncoder, "max_spot_count", message.max_spot_count);
|
||||
|
||||
Reference in new issue
Block a user