Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 12m22s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 14m0s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 13m56s
Build Packages / Generate python client (push) Successful in 12s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 14m3s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 14m17s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 14m22s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 14m34s
Build Packages / Build documentation (push) Successful in 34s
Build Packages / build:rpm (rocky9) (push) Successful in 14m46s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m13s
Build Packages / Unit tests (push) Failing after 45m21s
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
|
|
#include "../../common/Reflection.h"
|
|
#include "gemmi/symmetry.hpp"
|
|
|
|
struct ScaleMergeOptions {
|
|
bool refine_b_factor = true;
|
|
|
|
bool use_huber_loss = true;
|
|
double huber_delta = 2.0;
|
|
|
|
int max_num_iterations = 100;
|
|
double max_solver_time_s = 1.0;
|
|
|
|
double image_number_rounding = 1.0;
|
|
double min_sigma = 1e-3;
|
|
|
|
bool fix_first_image_scale = true;
|
|
|
|
std::optional<double> b_min = 0.0;
|
|
std::optional<double> b_max = 200.0;
|
|
|
|
// Symmetry canonicalization of HKL prior to merging/scaling.
|
|
// If not set, the routine uses raw HKL as-is.
|
|
std::optional<gemmi::SpaceGroup> space_group;
|
|
|
|
// If true, treat Friedel mates as equivalent (merge anomalous pairs).
|
|
// If false, keep them separate by including a sign flag in the HKL key.
|
|
bool merge_friedel = true;
|
|
};
|
|
|
|
struct MergedReflection {
|
|
int h;
|
|
int k;
|
|
int l;
|
|
double I;
|
|
double sigma;
|
|
};
|
|
|
|
struct ScaleMergeResult {
|
|
std::vector<MergedReflection> merged;
|
|
std::vector<double> image_scale_k;
|
|
std::vector<double> image_b_factor;
|
|
std::vector<int> image_ids;
|
|
};
|
|
|
|
ScaleMergeResult ScaleAndMergeReflectionsCeres(const std::vector<Reflection>& observations,
|
|
const ScaleMergeOptions& opt = {});
|