Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 28m9s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / Validation Battery (push) Successful in 47m56s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m51s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 10m33s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 26m49s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 30m10s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 32m0s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 32m49s
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 16m57s
Build Packages / Build documentation (push) Successful in 47s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m7s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 29m33s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 21m36s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 24m26s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 30m56s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 32m3s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 30m50s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 28m52s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 25m22s
Build Packages / Unit tests (push) Successful in 1h44m43s
* Rugnux: Fixed indexing of stills of a centred lattice with a known cell. * jfjoch_broker (experimental): Live Rugnux processing of serial collections. * Rugnux: Stills detector modules are placed from the data and written to `<prefix>_module_placement.json`; `--panel-refine` replaces `--refine-modules`. * Rugnux: More reliable rotation processing - indexing, monoclinic setting, space-group choice and refinement of multi-domain twins. Reviewed-on: #93 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
85 lines
4.3 KiB
C++
85 lines
4.3 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include "Indexer.h"
|
|
#include "../../common/UnitCell.h"
|
|
#include "../../common/Coord.h"
|
|
#include "../../common/CrystalLattice.h"
|
|
#include "../../common/IndexingSettings.h"
|
|
#include "FFTResult.h"
|
|
#include "SpindleBlindFraction.h"
|
|
|
|
#define FFT_MAX_SPOTS (64*1024)
|
|
|
|
// The shortest lattice row the short-row search looks for (FFTIndexer::Fundamentals) - the minimum
|
|
// cell DIALS' fft3d searches down to.
|
|
constexpr float SHORT_ROW_MIN_A = 3.0f;
|
|
|
|
class FFTIndexer : public Indexer {
|
|
|
|
protected:
|
|
const float min_length_A;
|
|
const float max_length_A;
|
|
const float min_angle_deg;
|
|
const float max_angle_deg;
|
|
|
|
const int nDirections;
|
|
const unsigned refine_threads;
|
|
float histogram_spacing;
|
|
int64_t histogram_size;
|
|
std::vector<Coord> direction_vectors;
|
|
|
|
size_t input_size;
|
|
size_t output_size;
|
|
|
|
// Per-direction best peaks (host)
|
|
std::vector<FFTResult> result_fft;
|
|
|
|
void SetupUnitCell(const std::optional<UnitCell> &cell) override;
|
|
// widen=false: combine only the shortest few filtered vectors (fast, correct for compact cells).
|
|
// widen=true: anchor the two short axes but let the third range over all vectors (reaches the long
|
|
// axis of a large/elongated cell). Used only as a fallback when the standard reduction indexes poorly.
|
|
std::vector<CrystalLattice> ReduceResults(const std::vector<Coord> &results, bool widen, float min_length) const;
|
|
// `magnitudes`, when given, receives the FFT peak prominence of each returned row, in the
|
|
// same order. The spindle severity needs it to tell a crystal's real rows from the short
|
|
// spurious ones a long cell produces; nothing else does, so it is optional.
|
|
std::vector<Coord> FilterFFTResults(size_t max_vectors,
|
|
std::vector<float> *magnitudes = nullptr) const;
|
|
// Replace each row whose FFT length is an alias of a longer one by that longer row (see the definition).
|
|
void DeAlias(const std::vector<Coord> &coord, size_t nspots, std::vector<Coord> &rows) const;
|
|
// Replace each row reported past min_length_A at a multiple of a shorter row by that row (see the
|
|
// definition); true where any was replaced.
|
|
bool Fundamentals(const std::vector<Coord> &coord, size_t nspots, std::vector<Coord> &rows) const;
|
|
// `short_rows`, when not empty, are reduced as well (widened, down to SHORT_ROW_MIN_A) and their cells
|
|
// refined and ranked together with those of `filtered`.
|
|
std::vector<CrystalLattice> ReduceAndRefine(const std::vector<Coord> &coord, size_t nspots,
|
|
const std::vector<Coord> &filtered, bool widen,
|
|
const std::vector<Coord> &short_rows = {});
|
|
float IndexedFraction(const CrystalLattice &latt, const std::vector<Coord> &coord, size_t nspots) const;
|
|
void SetupDirectionVectors();
|
|
// Replace the search directions with a small cap around `axis` (same count, so the transform and
|
|
// its plan are unchanged) and return the strongest peak found in it.
|
|
std::optional<Coord> SearchCap(const std::vector<Coord> &coord, size_t nspots,
|
|
const Coord &axis, float half_angle_deg);
|
|
// Direction perpendicular to every vector of `filtered`, when they all lie in one plane and so
|
|
// cannot close a cell; empty otherwise.
|
|
std::optional<Coord> DegeneratePlaneNormal(const std::vector<Coord> &filtered) const;
|
|
// Filled by RunInternal from the shortlist it already computes; read out by Indexer::Run.
|
|
std::optional<SpindleSeverity> spindle_severity;
|
|
std::optional<SpindleSeverity> GetSpindleSeverity() const override { return spindle_severity; }
|
|
std::optional<SpindleSeverity> RunSeverityOnly(const std::vector<Coord> &coord) override;
|
|
|
|
virtual void ExecuteFFT(const std::vector<Coord> &coord, size_t nspots) = 0;
|
|
// Called after direction_vectors is rewritten, for implementations that keep a copy of it.
|
|
virtual void DirectionsChanged() {}
|
|
public:
|
|
|
|
explicit FFTIndexer(const IndexingSettings& settings);
|
|
~FFTIndexer() override = default;
|
|
|
|
std::vector<CrystalLattice> RunInternal(const std::vector<Coord> &coord, size_t nspots) override;
|
|
};
|
|
|