v1.0.0-rc.179 (#90)
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m11s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 10m32s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 18m26s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m11s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 23m32s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 27m28s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m10s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 28m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m24s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 21m45s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / Build documentation (push) Successful in 1m21s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 24m2s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 29m25s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 30m27s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 27m12s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m20s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 33m36s
Build Packages / Unit tests (push) Successful in 2h7m18s
Build Packages / Validation Battery (push) Successful in 33m19s
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m11s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 10m32s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 18m26s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m11s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 23m32s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 27m28s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m10s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 28m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m24s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 21m45s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / Build documentation (push) Successful in 1m21s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 24m2s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 29m25s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 30m27s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 27m12s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m20s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 33m36s
Build Packages / Unit tests (push) Successful in 2h7m18s
Build Packages / Validation Battery (push) Successful in 33m19s
* Rugnux: Stills processing needs only the unit cell and space group beyond what the file records - detector distance, beam centre, tilt, panel placement, saturation level, gain and polarisation plane are found from the images - and is up to twice as fast. * Rugnux: Stills can be indexed without a GPU, with a CPU implementation of the fast-feedback indexer (macOS, computers without a GPU). * Rugnux: Rotation and stills data are integrated in the detector's own units with one gain model, improving data from CCD detectors. * Web frontend: The Rugnux live page shows the placed model with its electron density and anomalous difference map in a Mol* viewer. Reviewed-on: #90 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #90.
This commit is contained in:
1 parent
afbe844b20
commit
b00c668e3a
394 files changed
+57778
-2178
No files matched your search
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "../../common/JFJochMath.h" // PI (M_PI is not standard, and MSVC does not define it)
|
||||
#include "../SensorAbsorption.h"
|
||||
#include "RingBackground.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -51,7 +52,8 @@ std::map<RadialKernelKey, std::vector<float>> radial_kernel_cache;
|
||||
} // namespace
|
||||
|
||||
BraggIntegrationEngine::BraggIntegrationEngine(const DiffractionExperiment &experiment)
|
||||
: geom(experiment.GetDiffractionGeometry()) {
|
||||
: geom(experiment.GetDiffractionGeometry()), modules(experiment.GetModules()),
|
||||
plane_bounds(modules.PlaneBounds(experiment.GetXPixelsNum(), experiment.GetYPixelsNum())) {
|
||||
const auto settings = experiment.GetBraggIntegrationSettings();
|
||||
const auto &det = experiment.GetDetectorSetup();
|
||||
|
||||
@@ -115,7 +117,7 @@ BraggIntegrationEngine::BraggIntegrationEngine(const DiffractionExperiment &expe
|
||||
// symmetric trimmed mean (rugnux --background-trim). The caller owns the choice - the engine no
|
||||
// longer overrides it for broadband data.
|
||||
bkg_clip_nsigma = settings.GetBackgroundClipNSigma();
|
||||
bkg_pixel_gain = settings.GetBackgroundPixelGain();
|
||||
pixel_gain = settings.GetPixelGain();
|
||||
bkg_trim = bkg_clip_nsigma > 0.0f ? 0.0f : settings.GetBackgroundTrimFraction();
|
||||
|
||||
// Overlap treatment. Ownership is decided out to the fit grid's half size, which is where the
|
||||
@@ -126,6 +128,8 @@ BraggIntegrationEngine::BraggIntegrationEngine(const DiffractionExperiment &expe
|
||||
if (overlap == OverlapMode::Exclude && mode == IntegratorMode::BoxSum)
|
||||
overlap = OverlapMode::Off;
|
||||
overlap_min_peak = settings.GetOverlapMinPeak();
|
||||
keep_overloads = !experiment.IsRotationIndexing();
|
||||
saturation_limit = static_cast<double>(experiment.GetSaturationLimit());
|
||||
claim = static_cast<float>(R);
|
||||
inv_claim = 1.0f / claim;
|
||||
|
||||
@@ -148,8 +152,8 @@ BraggIntegrationEngine::BraggIntegrationEngine(const DiffractionExperiment &expe
|
||||
// bkg_radial is raised after construction only by the auto mode (MXAnalysisWithoutFPGA), which
|
||||
// requires bkg_radial_auto, and the GPU allocates its curve buffers under the same condition.
|
||||
// n_kern is the largest row BraggStencilKernelIndex can select, plus one.
|
||||
r_max = std::hypot(std::max<double>(beam_x, static_cast<double>(xpixel) - beam_x),
|
||||
std::max<double>(beam_y, static_cast<double>(ypixel) - beam_y));
|
||||
r_max = std::hypot(std::max<double>(beam_x - plane_bounds.x0, plane_bounds.x1 - beam_x),
|
||||
std::max<double>(beam_y - plane_bounds.y0, plane_bounds.y1 - beam_y));
|
||||
bkg_radial_built = bkg_radial || bkg_radial_auto;
|
||||
const float grow_max = bkg_radial_built ? BraggStencilMaxGrow_px(static_cast<float>(r_max), stencil)
|
||||
: 0.0f;
|
||||
@@ -217,10 +221,37 @@ void BraggIntegrationEngine::BuildRadialKernel(float grow) {
|
||||
k_diff.push_back(static_cast<float>(hist_ann[k] / sa - hist_disk[k] / sd));
|
||||
}
|
||||
|
||||
void BraggIntegrationEngine::RadialBackgroundFromRings(const std::vector<float> &ring_bkg, int32_t q_bins,
|
||||
float low_q, float dq) {
|
||||
radial_curve.clear();
|
||||
const RingBackground rings(ring_bkg, q_bins, low_q, dq);
|
||||
if (rings.empty())
|
||||
return;
|
||||
// The same bins as the engines' own curve: one per pixel of distance from the beam, out to the far
|
||||
// corner.
|
||||
const int n = static_cast<int>(std::ceil(r_max)) + 2;
|
||||
const double two_k = 4.0 * PI / geom.GetWavelength_A();
|
||||
radial_curve.resize(n);
|
||||
for (int r = 0; r < n; ++r)
|
||||
radial_curve[r] = static_cast<float>(rings.At(two_k * std::sin(0.5 * std::atan(r / F_px))));
|
||||
}
|
||||
|
||||
std::vector<BraggPanel> BraggIntegrationEngine::Panels(const std::vector<Reflection> &predicted,
|
||||
size_t npredicted) const {
|
||||
std::vector<BraggPanel> out(npredicted);
|
||||
for (size_t i = 0; i < npredicted; ++i) {
|
||||
const float x = predicted[i].predicted_x, y = predicted[i].predicted_y;
|
||||
out[i] = MakeBraggPanel(modules, modules.ModuleOfImagePixel(x, y), static_cast<int64_t>(xpixel),
|
||||
static_cast<int64_t>(ypixel), x, y);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<Reflection> BraggIntegrationEngine::Finalize(const std::vector<Reflection> &predicted,
|
||||
size_t npredicted,
|
||||
const std::vector<BraggPanel> &panels,
|
||||
const std::vector<BraggFitResult> &results,
|
||||
int64_t image_number) const {
|
||||
int64_t image_number) {
|
||||
// Sized to what is kept, not to what was predicted: this vector is the one every image holds to the
|
||||
// end of the pass, and a background ring lost to the neighbours drops a reflection here - on a
|
||||
// dense pattern more than half of them, which a reserve of npredicted would carry as dead capacity.
|
||||
@@ -234,10 +265,11 @@ std::vector<Reflection> BraggIntegrationEngine::Finalize(const std::vector<Refle
|
||||
if (!fr.ok)
|
||||
continue;
|
||||
Reflection refl = predicted[i];
|
||||
refl.I = fr.I;
|
||||
refl.sigma = fr.sigma;
|
||||
refl.bkg = fr.bkg;
|
||||
refl.var_bkg = fr.var_bkg;
|
||||
// In photons: the engine measured in ADU, with variances already taken at the gain.
|
||||
refl.I = fr.I / pixel_gain;
|
||||
refl.sigma = fr.sigma / pixel_gain;
|
||||
refl.bkg = fr.bkg / pixel_gain;
|
||||
refl.var_bkg = fr.var_bkg / (pixel_gain * pixel_gain);
|
||||
if (fr.has_observed) {
|
||||
refl.observed_x = fr.observed_x;
|
||||
refl.observed_y = fr.observed_y;
|
||||
@@ -245,9 +277,30 @@ std::vector<Reflection> BraggIntegrationEngine::Finalize(const std::vector<Refle
|
||||
// has_observed is set only for a signal disk every pixel of which was readable.
|
||||
refl.clipped = !fr.has_observed;
|
||||
refl.overloaded = fr.overloaded;
|
||||
// A rotation merge drops the whole rocking event of an overloaded reflection. A still has no
|
||||
// rocking event: its overloaded observations are the fully recorded ones of the strongest
|
||||
// reflections, so dropping them leaves those reflections to their partial observations, whose
|
||||
// partiality correction then sets the merged intensity - and it reads low. Measured on clipped
|
||||
// CCD stills, the merged low-resolution intensities came out at 0.4-0.6x of the deposited ones.
|
||||
// So a still keeps the observation as a lower bound: each saturated pixel counted at the
|
||||
// saturation limit. (A fit to the unsaturated wings was tried and read lower still: the
|
||||
// profile learned from unsaturated spots does not describe the wings of a clipped one.)
|
||||
// That takes a pixel AT the limit: an observation overloaded only by pixels unreadable on
|
||||
// this frame has nothing to count at the limit, and counting those pixels as zero is no
|
||||
// lower bound of anything - it stays overloaded and is dropped. (A pixel stuck at the limit
|
||||
// is no clipped spot either; the pre-scan masks it, HotPixelFinder.)
|
||||
// Counted in ADU like everything else, its own variance at the gain, then in photons.
|
||||
if (fr.overloaded && keep_overloads && fr.saturated > 0) {
|
||||
const float I = fr.I + static_cast<float>(fr.saturated * (saturation_limit - fr.bkg));
|
||||
refl.I = I / pixel_gain;
|
||||
refl.sigma = std::sqrt(fr.var_bkg + pixel_gain * std::max(I, pixel_gain)) / pixel_gain;
|
||||
refl.overloaded = false;
|
||||
++counts.overloads_kept;
|
||||
}
|
||||
refl.observed = true;
|
||||
if (polarization)
|
||||
refl.prescaling_corr /= geom.CalcAzIntPolarizationCorr(refl.predicted_x, refl.predicted_y, polarization.value());
|
||||
refl.prescaling_corr /= geom.CalcAzIntPolarizationCorr(panels[i].plane_x, panels[i].plane_y,
|
||||
polarization.value());
|
||||
refl.image_scale_corr = refl.prescaling_corr * refl.qe_corr * refl.flight_corr / refl.partiality;
|
||||
refl.image_number = static_cast<float>(image_number);
|
||||
out.push_back(refl);
|
||||
|
||||
Reference in new issue
Block a user