Files
Jungfraujoch/common/ScalingSettings.h
leonarski_fandClaude Opus 4.8 383072ac80 Consolidate viewer settings into the panel + add the merge-stats window
Make the inline settings dock the single home for processing settings and
retire the separate Processing-settings window (and the dock<->window sync):
- "Analyze image" / "Analyze dataset" move to the top of the panel; the
  MX/AzInt toggle decides the dataset-job kind, so the job dialog drops its
  mode combo.
- The panel gains the most-used spot-finding (max spots, high-resolution,
  min pixels), Bragg (Gaussian profile-fit, r1/r2/r3) and scaling (partiality,
  "3D rotation scaling" = rot3d combine + scale-fulls, merge Friedel, refine
  B, resolution limit) handles, a live indexing-algorithm description line,
  and now owns the Bragg/Scaling settings. The now-unused window tab classes
  are deleted.
- Complete the PixelRefine removal on the viewer side (the "Pixel refinement"
  option + profile-multiplier widget), fixing the transient HEAD breakage.

New JFJochMergeStatsWindow: an analysis pop-up for a finished merge (hero
numbers over a per-resolution plot / per-shell table), auto-opened on
completion and reopenable from the processing-jobs dock.

Fixes: disable tear-off dock floating (a floated dock is a dead off-screen
window under WSLg, which has no window manager); version the saved dock
layout so a stale arrangement is discarded instead of restoring a broken one;
keep the Analyze-button icons; right-align and equal-width the stats table;
line-plot / table toggle icons (ToolbarIcons gains linePlot + table).

Add ScalingSettings::HighResolutionLimit_A(optional) so the panel can clear
the resolution limit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:43:04 +02:00

88 lines
3.3 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <optional>
#include "JFJochException.h"
enum class PartialityModel { Fixed, Rotation, Unity };
enum class IntensityFormat { Text, mmCIF, MTZ};
class ScalingSettings {
std::optional<PartialityModel> partiality_mode;
bool refine_b = false;
double max_b = 200.0;
double min_b = -50.0;
bool refine_wedge = false;
bool merge_friedel = true;
std::optional<double> high_resolution_limit_A;
std::optional<double> wedge_for_scaling;
double min_partiality = 0.02;
double min_cc_for_image = 0.0;
double outlier_reject_nsigma = 0.0; // per-observation merge outlier rejection (XDS/DIALS-style); 0 = off, e.g. 6 enables
// The "-P rot3d" 3D combine: scale per-frame as Rotation, then weight-sum each reflection's
// per-frame partials into one counting-limited full before merging (orthogonal to the partiality
// model, which stays Rotation - see Combine3D).
bool combine_3d = false;
// Scale fulls: after the rot3d combine, refit a per-frame scale on the combined fulls (XDS
// order). A no-op without rot3d.
bool scale_fulls = false;
double rfree_fraction = 0.05;
IntensityFormat intensity_format = IntensityFormat::MTZ;
bool scaling_regularize = false;
public:
ScalingSettings& SetPartialityModel(PartialityModel mode);
ScalingSettings& RefineB(bool input);
ScalingSettings& RefineRotationWedge(bool input);
ScalingSettings& RotationWedgeForScaling(std::optional<double> input);
ScalingSettings& MergeFriedel(bool input);
ScalingSettings& HighResolutionLimit_A(double limit);
ScalingSettings& HighResolutionLimit_A(std::optional<double> limit); // nullopt clears the limit
ScalingSettings& MinPartiality(double min_partiality);
ScalingSettings& MinCCForImage(double min_cc_for_image);
ScalingSettings& OutlierRejectNsigma(double input);
ScalingSettings& Combine3D(bool input);
ScalingSettings& ScaleFulls(bool input);
ScalingSettings& RfreeFraction(double input);
ScalingSettings& FileFormat(IntensityFormat input);
ScalingSettings& ScalingRegularize(bool input);
[[nodiscard]] bool GetRefineB() const;
[[nodiscard]] bool GetRefineWedge() const;
[[nodiscard]] double GetMinB() const;
[[nodiscard]] double GetMaxB() const;
[[nodiscard]] double GetMinMosaicity() const;
[[nodiscard]] double GetDefaultMosaicity() const;
[[nodiscard]] double GetMaxMosaicity() const;
[[nodiscard]] double GetMinWedge() const;
[[nodiscard]] std::optional<double> GetRotationWedgeForScaling() const;
[[nodiscard]] double GetMaxWedge() const;
[[nodiscard]] bool GetMergeFriedel() const;
[[nodiscard]] std::optional<PartialityModel> GetPartialityModel() const;
[[nodiscard]] std::optional<double> GetHighResolutionLimit_A() const;
[[nodiscard]] double GetMinPartiality() const;
[[nodiscard]] double GetMinCCForImage() const;
[[nodiscard]] double GetOutlierRejectNsigma() const;
[[nodiscard]] bool GetCombine3D() const;
[[nodiscard]] bool GetScaleFulls() const;
[[nodiscard]] double GetRfreeFraction() const;
[[nodiscard]] IntensityFormat GetFileFormat() const;
[[nodiscard]] bool GetScalingRegularize() const;
};