v1.0.0-rc.118 (#25)
Some checks failed
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m22s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 8m37s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m15s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 9m39s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m17s
Build Packages / Generate python client (push) Successful in 21s
Build Packages / Build documentation (push) Successful in 43s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 7m51s
Build Packages / build:rpm (rocky9) (push) Successful in 8m45s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m55s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m22s
Build Packages / Unit tests (push) Failing after 1h5m51s

This is an UNSTABLE release and not recommended for production use (please use rc.111 instead).

* jfjoch_viewer: Fix issue when HTTP sync silently disconnected when it was enabled when the broker was starting measurement.
* jfjoch_broker: Add protections on time of geometry optimization and reduce rotation recalculations

Reviewed-on: #25
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #25.
This commit is contained in:
2025-12-06 20:05:30 +01:00
committed by leonarski_f
parent d1a4c19ef3
commit b02c412d59
143 changed files with 205 additions and 205 deletions

View File

@@ -104,7 +104,8 @@ void IndexAndRefine::ProcessImage(DataMessage &msg,
.crystal_system = symmetry.crystal_system,
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
.refine_beam_center = true,
.refine_distance_mm = false
.refine_distance_mm = false,
.max_time = 0.04 // 40 ms is max allowed time for the operation
};
if (symmetry.crystal_system == gemmi::CrystalSystem::Trigonal)
@@ -158,6 +159,6 @@ void IndexAndRefine::ProcessImage(DataMessage &msg,
std::optional<RotationIndexerResult> IndexAndRefine::Finalize() {
if (rotation_indexer)
return rotation_indexer->Finalize();
return rotation_indexer->GetLattice();
return {};
}

View File

@@ -41,6 +41,8 @@ void RotationIndexer::SetLattice(const CrystalLattice &lattice) {
}
void RotationIndexer::TryIndex() {
indexing_tried = true;
// Index
std::vector<SpotToSave> v_sel;
std::vector<Coord> coords_sel;
@@ -57,7 +59,6 @@ void RotationIndexer::TryIndex() {
idx.begin() + max_spots,
idx.end(),
[this](std::size_t a, std::size_t b) {
// Replace `.intensity` with the actual SpotToSave intensity member
return v_[a].intensity > v_[b].intensity;
}
);
@@ -111,7 +112,7 @@ std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image
const auto rot = axis_->GetTransformation(image);
if (!indexed_lattice && image >= last_accumulated_image + image_stride) {
if (!indexing_tried && image >= last_accumulated_image + image_stride) {
v_.reserve(v_.size() + spots.size());
coords_.reserve(coords_.size() + spots.size());
@@ -125,32 +126,19 @@ std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image
accumulated_images++;
last_accumulated_image = image;
if (!indexed_lattice && accumulated_images >= min_images_for_indexing && image >= first_image_to_try_indexing) {
if (accumulated_images >= min_images_for_indexing && image >= first_image_to_try_indexing)
TryIndex();
// If fails increase rotation range by a factor of two
if (!indexed_lattice)
first_image_to_try_indexing *= 2;
}
}
if (indexed_lattice) {
return RotationIndexerResult{
.lattice = indexed_lattice->Multiply(rot.transpose()),
.search_result = search_result_,
.geom = updated_geom_
};
}
return {};
return GetLattice();
}
std::optional<RotationIndexerResult> RotationIndexer::Finalize() {
std::optional<RotationIndexerResult> RotationIndexer::GetLattice() {
if (!indexed_lattice)
TryIndex();
if (!indexed_lattice)
return std::nullopt;
return {};
return RotationIndexerResult{
.lattice = indexed_lattice.value(),
.search_result = search_result_,
.geom = geom_
.geom = updated_geom_
};
}

View File

@@ -28,10 +28,11 @@ class RotationIndexer {
mutable std::mutex m;
const DiffractionExperiment& experiment;
constexpr static int64_t max_spots = 60000;
constexpr static int64_t max_spots = 10000;
constexpr static int64_t min_images_for_indexing = 10;
const bool index_ice_rings;
bool indexing_tried = false;
std::vector<SpotToSave> v_;
std::vector<Coord> coords_;
@@ -50,13 +51,12 @@ class RotationIndexer {
std::optional<CrystalLattice> indexed_lattice;
void TryIndex();
public:
RotationIndexer(const DiffractionExperiment& x, IndexerThreadPool& indexer);
void SetLattice(const CrystalLattice &lattice);
std::optional<RotationIndexerResult> ProcessImage(int64_t image, const std::vector<SpotToSave>& spots);
std::optional<RotationIndexerResult> Finalize();
std::optional<RotationIndexerResult> GetLattice();
};
#endif //JFJOCH_ROTATIONINDEXER_H

View File

@@ -517,6 +517,7 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
ceres::Solver::Options options;
options.linear_solver_type = ceres::DENSE_QR;
options.minimizer_progress_to_stdout = false;
options.max_solver_time_in_seconds = data.max_time;
options.logging_type = ceres::LoggingType::SILENT;
ceres::Solver::Summary summary;

View File

@@ -27,6 +27,8 @@ struct XtalOptimizerData {
bool refine_distance_mm = false;
bool refine_detector_angles = false;
float max_time = 1.0;
std::optional<GoniometerAxis> axis;
// output