Files
Jungfraujoch/writer/HDF5DataFilePluginMX.h
T
leonarski_fandClaude Fable 5 f422988cd2 ice score: per-image ice-ring indicator plumbed through all layers
A single per-image ice_ring_score - the strongest hexagonal-ice ring band/shoulder
intensity ratio from the azimuthal profile (1 = no ice) - computed in the CPU and
FPGA analysis paths and the offline azint worker, then plumbed through every layer:
DataMessage/EndMessage, CBOR (frame_serialize), HDF5 (/entry/MX/iceRingScore),
ScanResult, receiver plots (PlotType::IceRingScore), the OpenAPI spec (plot_type +
scan_result schema, with regenerated broker/gen and frontend client) and
OpenAPIConvert, the reader + Qt viewer, and the React frontend plot. Documented in
docs/CBOR.md, docs/HDF5.md and docs/CPU_DATA_ANALYSIS.md, with the general
"add a per-image quantity" recipe added to CLAUDE.md.

Verified in HDF5: lysoC (weak ice) mean 1.23, EP_cs_01-17 (heavy ice) mean 1.67 /
max 2.23. This is a monitoring quantity - it does not gate scaling (which already
excludes all ice rings) or merging (handled by the CC1/2 ring mask).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:37:12 +02:00

71 lines
2.3 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "HDF5DataFilePlugin.h"
#include "../common/AutoIncrVector.h"
class HDF5DataFilePluginMX : public HDF5DataFilePlugin {
const size_t max_spots;
const size_t max_extra_lattices;
const bool indexing;
// spots
std::vector<float> spot_x;
std::vector<float> spot_y;
std::vector<float> spot_int;
std::vector<int8_t> spot_indexed;
std::vector<int8_t> spot_ice_ring;
std::vector<int8_t> spot_lattice;
std::vector<int32_t> spot_h;
std::vector<int32_t> spot_k;
std::vector<int32_t> spot_l;
std::vector<float> spot_dist_ewald;
AutoIncrVector<float> beam_corr_x{NAN};
AutoIncrVector<float> beam_corr_y{NAN};
AutoIncrVector<uint32_t> npeaks;
AutoIncrVector<uint32_t> strong_pixel_count;
AutoIncrVector<uint32_t> spot_count_total;
AutoIncrVector<uint32_t> spot_count_ice;
AutoIncrVector<uint32_t> spot_count_indexed;
AutoIncrVector<uint32_t> spot_count_low_res;
// indexing
AutoIncrVector<uint8_t> indexed;
AutoIncrVector<uint32_t> indexing_lattice_count;
std::vector<float> indexed_lattice;
std::vector<float> extra_lattices; // [nimages, max_extra_lattices, 9], NaN-filled
// crystal
AutoIncrVector<float> profile_radius{NAN};
AutoIncrVector<float> mosaicity_deg{NAN};
AutoIncrVector<float> b_factor{NAN};
// bkg_estimate
AutoIncrVector<float> bkg_estimate{NAN};
AutoIncrVector<float> ice_ring_score{NAN};
// resolution_estimation
AutoIncrVector<float> resolution_estimate{NAN};
AutoIncrVector<uint32_t> niggli_class;
AutoIncrVector<std::string> bravais_lattice;
AutoIncrVector<int64_t> integrated_reflections;
// scaling
bool image_scale_present = false;
AutoIncrVector<float> image_scale_factor{NAN};
AutoIncrVector<float> image_scale_cc{NAN};
AutoIncrVector<float> image_scale_mosaicity{NAN};
AutoIncrVector<float> image_scale_b_factor{NAN};
public:
explicit HDF5DataFilePluginMX(const StartMessage& msg);
void OpenFile(HDF5File &data_file, const DataMessage& msg, size_t images_per_file) override;
void Write(const DataMessage& msg, uint64_t image_number) override;
void WriteFinal(HDF5File &data_file) override;
};