Spot plot: the resolution axis comes from the detector, not from 1.5 A
Dropping the fixed spot-finding limit left the reader still generating the spot-vs-resolution plot over shells that stop at 1.5 A, so a stored file reopened in the viewer showed a plot truncated at exactly the limit that was removed - GenerateSpotPlot drops every spot outside its shells. Pass the detector's own maximum resolution, as SpotAnalyze already does. That value is 0 when the geometry gives no scattering angle at all (no distance or no wavelength), and ResolutionShells throws on a non-positive d_min, once per image. There is no resolution axis to plot against in that case, so skip the plot. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,10 @@ std::optional<float> GetResolution(const std::vector<SpotToSave> &spots) {
|
||||
|
||||
void GenerateSpotPlot(DataMessage &msg, const std::vector<SpotToSave> &spots, float d_min_A) {
|
||||
const int nshells = 20;
|
||||
// The geometry gives no usable high-resolution corner (no distance or no wavelength), so there is
|
||||
// no resolution axis to plot the spots against. ResolutionShells would throw on it, once per image.
|
||||
if (d_min_A <= 0.0f || d_min_A >= 50.0f)
|
||||
return;
|
||||
ResolutionShells shells(d_min_A, 50.0, nshells);
|
||||
|
||||
std::vector<float> intensity(nshells);
|
||||
|
||||
@@ -788,6 +788,7 @@ static void ReadSpotsFromFiles(HDF5Object &master_file,
|
||||
hsize_t source_image,
|
||||
int64_t image_number,
|
||||
const DiffractionGeometry &geom,
|
||||
float plot_d_min_A,
|
||||
DataMessage &message) {
|
||||
auto spot_count_opt = ReadElementMasterFirst<uint32_t>(master_file,
|
||||
source_file,
|
||||
@@ -899,7 +900,7 @@ static void ReadSpotsFromFiles(HDF5Object &master_file,
|
||||
message.spot_count_indexed = ReadElementMasterFirst<uint32_t>(
|
||||
master_file, source_file, "/entry/MX/peakCountIndexed", master_image, source_image);
|
||||
|
||||
GenerateSpotPlot(message, message.spots, 1.5);
|
||||
GenerateSpotPlot(message, message.spots, plot_d_min_A);
|
||||
}
|
||||
|
||||
void HDF5MetadataSource::FillPerImage(DataMessage &message, int64_t requested_image,
|
||||
@@ -917,7 +918,8 @@ void HDF5MetadataSource::FillPerImage(DataMessage &message, int64_t requested_im
|
||||
const auto source_image = static_cast<hsize_t>(image_id);
|
||||
|
||||
ReadSpotsFromFiles(*master_file, *source_file, master_image, source_image,
|
||||
requested_image, dataset->experiment.GetDiffractionGeometry(), message);
|
||||
requested_image, dataset->experiment.GetDiffractionGeometry(),
|
||||
dataset->experiment.GetDetectorMaxResolution_A(), message);
|
||||
|
||||
if (!dataset->az_int_bin_to_q.empty()) {
|
||||
if (dataset->azimuthal_bins == 0) {
|
||||
@@ -1194,6 +1196,7 @@ std::vector<SpotToSave> HDF5MetadataSource::ReadSpots(int64_t requested_image) c
|
||||
image, meta_image_id,
|
||||
requested_image,
|
||||
cached_geom,
|
||||
dataset_ ? dataset_->experiment.GetDetectorMaxResolution_A() : 0.0f,
|
||||
tmp_message);
|
||||
|
||||
return tmp_message.spots;
|
||||
|
||||
Reference in New Issue
Block a user