All checks were successful
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m53s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 9m40s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 8m25s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m17s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m5s
Build Packages / Generate python client (push) Successful in 34s
Build Packages / Build documentation (push) Successful in 42s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m35s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m2s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m40s
Build Packages / build:rpm (rocky9) (push) Successful in 9m14s
Build Packages / Unit tests (push) Successful in 1h15m9s
This is an UNSTABLE release and not recommended for production use (please use rc.11 instead). * jfjoch_broker: Experimental rotation (3D) indexing * jfjoch_broker: Minor fix to error in optimizer potentially returning NaN values Reviewed-on: #18 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch> Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
82 lines
3.2 KiB
C++
82 lines
3.2 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "../reader/JFJochHDF5Reader.h"
|
|
#include "../image_analysis/indexing/IndexerFactory.h"
|
|
#include "../common/Logger.h"
|
|
#include "../image_analysis/IndexAndRefine.h"
|
|
#include "../image_analysis/bragg_integration/BraggPredictionFactory.h"
|
|
#include "../writer/FileWriter.h"
|
|
#include "../image_analysis/indexing/AnalyzeIndexing.h"
|
|
|
|
int main(int argc, char** argv) {
|
|
Logger logger("jfjoch_indexing_test");
|
|
|
|
if (argc != 2) {
|
|
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Usage: ./jfjoch_indexing_test <file>");
|
|
}
|
|
|
|
JFJochHDF5Reader reader;
|
|
reader.ReadFile(argv[1]);
|
|
if (!reader.GetDataset())
|
|
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Error opening file");
|
|
|
|
IndexingSettings indexing_settings;
|
|
indexing_settings.Algorithm(IndexingAlgorithmEnum::FFT);
|
|
indexing_settings.RotationIndexing(true);
|
|
indexing_settings.GeomRefinementAlgorithm(GeomRefinementAlgorithmEnum::BeamCenter);
|
|
DiffractionExperiment experiment(reader.GetDataset()->experiment);
|
|
experiment.ImportIndexingSettings(indexing_settings);
|
|
experiment.SetUnitCell({});
|
|
experiment.FilePrefix("output");
|
|
|
|
StartMessage msg;
|
|
experiment.FillMessage(msg);
|
|
// FileWriter fw(msg);
|
|
|
|
IndexerThreadPool indexer(experiment.GetIndexingSettings());
|
|
SpotFindingSettings settings{};
|
|
settings.quick_integration = false;
|
|
settings.indexing = true;
|
|
|
|
auto geom = experiment.GetDiffractionGeometry();
|
|
IndexAndRefine rot_index(experiment, &indexer);
|
|
|
|
auto prediction = CreateBraggPrediction();
|
|
|
|
int cnt = 0;
|
|
for (int i = 0; i < reader.GetNumberOfImages(); i++) {
|
|
auto img = reader.LoadImage(i);
|
|
|
|
if (!img)
|
|
continue;
|
|
|
|
DataMessage msg = img->ImageData();
|
|
|
|
rot_index.ProcessImage(msg, settings, msg.image, *prediction);
|
|
|
|
if (msg.indexing_result && msg.indexing_result.value())
|
|
cnt++;
|
|
|
|
if (i % 200 == 0)
|
|
logger.Info("Image {} {}", i, cnt);
|
|
|
|
}
|
|
auto latt_1 = rot_index.Finalize(false);
|
|
if (latt_1) {
|
|
auto uc = latt_1->lattice.GetUnitCell();
|
|
logger.Info("Unit cell {} {} {} {} {} {}", uc.a, uc.b, uc.c, uc.alpha, uc.beta, uc.gamma);
|
|
logger.Info("Latt1 {} {} {}", latt_1->lattice.Vec0().x, latt_1->lattice.Vec0().y, latt_1->lattice.Vec0().z);
|
|
logger.Info("Latt1 {} {} {}", latt_1->lattice.Vec1().x, latt_1->lattice.Vec1().y, latt_1->lattice.Vec1().z);
|
|
logger.Info("Latt1 {} {} {}", latt_1->lattice.Vec2().x, latt_1->lattice.Vec2().y, latt_1->lattice.Vec2().z);
|
|
}
|
|
auto latt_2 = rot_index.Finalize(true);
|
|
if (latt_2) {
|
|
|
|
auto uc = latt_2->lattice.GetUnitCell();
|
|
logger.Info("Unit cell {} {} {} {} {} {}", uc.a, uc.b, uc.c, uc.alpha, uc.beta, uc.gamma);
|
|
logger.Info("Latt1 {} {} {}", latt_2->lattice.Vec0().x, latt_2->lattice.Vec0().y, latt_2->lattice.Vec0().z);
|
|
logger.Info("Latt1 {} {} {}", latt_2->lattice.Vec1().x, latt_2->lattice.Vec1().y, latt_2->lattice.Vec1().z);
|
|
logger.Info("Latt1 {} {} {}", latt_2->lattice.Vec2().x, latt_2->lattice.Vec2().y, latt_2->lattice.Vec2().z);
|
|
}
|
|
} |