Stills beam centre: walk the grid from every candidate, and on while it moves
The count of spots on the lattice, which decides the stills beam centre, has
local maxima of its own about a centre 15-25 px off: a nearly cubic cell
indexes a few frames on a permuted lattice from there. The coarse grid
(3 px, +-12 px) was walked once about the candidate that won the
file/background/capture comparison, on margins the capture itself calls
flat, so a wrong winner's walk ended on such a maximum (a few hundred spots)
while the right centre, two steps past the rim, put thousands there. On a
run of 1500-3000 frames the result was a centre 18 px off, a quarter of the
frames indexed and a merge of CC1/2 0.01; the live pre-pass runs the same
code on its first 1000 frames.
The coarse grid is now walked about every candidate - the centre decided,
the file's, the background walk's and the capture's - then again about the
best for as long as it moves, then the fine step about where it settled.
The objective and the 1/0.9 decision against the centre decided stay. A
run whose centre was already right walks the same points first and takes
the same decision; the extra seeds cost a few seconds of indexing on the 32
strongest sample frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3
(cherry picked from commit 1c010a7eedb2d7ad5e9d0a77d93d5819f486052b)
(cherry picked from commit 8b76680f9d)
This commit is contained in:
1 parent
db1581856a
commit
b4ab518590
2 files changed
+34
-20
No files matched your search
@@ -303,7 +303,11 @@ refinement has fitted one de novo (below), the detector distance is a hypothesis
|
||||
distance being checked) and spots piled up at one radius - a powder ring - are left out. A scan over
|
||||
30-3000 mm in 2.5 % steps at every centre candidate finds the peaks, the strongest are looked at more
|
||||
closely and a finer step about the best decides against the file's distance, which is kept unless the best
|
||||
puts at least 1/0.9 as many spots on the lattice; a local grid of centres follows at the distance decided.
|
||||
puts at least 1/0.9 as many spots on the lattice. A grid of centres follows at the distance decided: coarse
|
||||
(3 px steps, 12 px either way) about every candidate - the count of spots on the lattice has local maxima of
|
||||
its own about a centre 15-25 px off, so a walk about the candidate that won would end on one of them where
|
||||
the right centre lies past its rim - then coarse again about the best for as long as it moves, then fine
|
||||
(1 px, 2 px either way), and the best is taken against the centre decided by the same 1/0.9 rule.
|
||||
The range is in millimetres, not in multiples of the file's value, so a stated camera length that is
|
||||
nominal or wrong does not limit where the search looks, and an input that states no distance (an XTC) is
|
||||
searched too. The spot count is flat to a percent or two about the right distance, so with `-C` the same sample is also
|
||||
|
||||
+29
-19
@@ -1294,32 +1294,42 @@ bool Rugnux::DecideStillsGeometry(int start_image, int images_to_process) {
|
||||
decide_centre(distance);
|
||||
}
|
||||
|
||||
// With a cell, also a local grid of centres about the one decided, at the distance decided: the two
|
||||
// background estimators can both be several pixels off (a shadowed or uneven background), and the
|
||||
// geometry refinement only moves the centre a few pixels. Coarse, then fine about the coarse best.
|
||||
// With a cell, also a local grid of centres at the distance decided: the two background estimators can
|
||||
// both be several pixels off (a shadowed or uneven background), and the geometry refinement only moves
|
||||
// the centre a few pixels. The coarse grid is walked about every candidate, not only the one decided -
|
||||
// the count of spots on the lattice has local maxima of its own about a centre 15-25 px off (a nearly
|
||||
// cubic cell indexes a few frames on a permuted lattice from there), and the candidates are decided
|
||||
// between on margins the capture itself calls flat; a walk of +-12 px about the wrong one ends on a
|
||||
// maximum of a few hundred spots while the right centre, two steps further, puts thousands on the
|
||||
// lattice. Then coarse again about the best for as long as it moves (a grid that ends on its rim has
|
||||
// not seen past it), then fine about where it settled.
|
||||
if (experiment_.GetUnitCell().has_value()) {
|
||||
float gx = x, gy = y;
|
||||
int64_t g_best = trial(x, y, distance, strongest);
|
||||
for (const auto &[step, reach] : {std::pair{3.0f, 4}, std::pair{1.0f, 2}}) {
|
||||
const float cx0 = gx, cy0 = gy;
|
||||
const auto grid_about = [&](const std::vector<std::pair<float, float>> &seeds, float step, int reach) {
|
||||
std::vector<TrialKey> keys;
|
||||
for (int i = -reach; i <= reach; i++)
|
||||
for (int j = -reach; j <= reach; j++)
|
||||
if (i != 0 || j != 0)
|
||||
for (const auto &[cx0, cy0] : seeds)
|
||||
for (int i = -reach; i <= reach; i++)
|
||||
for (int j = -reach; j <= reach; j++)
|
||||
keys.emplace_back(cx0 + step * i, cy0 + step * j, distance, &strongest);
|
||||
try_all(keys);
|
||||
for (int i = -reach; i <= reach; i++)
|
||||
for (int j = -reach; j <= reach; j++) {
|
||||
if (i == 0 && j == 0)
|
||||
continue;
|
||||
const int64_t score = trial(cx0 + step * i, cy0 + step * j, distance, strongest);
|
||||
if (score > g_best) {
|
||||
g_best = score;
|
||||
gx = cx0 + step * i;
|
||||
gy = cy0 + step * j;
|
||||
}
|
||||
bool moved = false;
|
||||
for (const auto &[cx, cy, d, on] : keys) {
|
||||
const int64_t score = trial(cx, cy, d, *on);
|
||||
if (score > g_best) {
|
||||
g_best = score;
|
||||
gx = cx;
|
||||
gy = cy;
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return moved;
|
||||
};
|
||||
std::vector<std::pair<float, float>> seeds{{x, y}, {file_x, file_y}};
|
||||
seeds.insert(seeds.end(), candidates.begin(), candidates.end());
|
||||
grid_about(seeds, 3.0f, 4);
|
||||
while (grid_about({{gx, gy}}, 3.0f, 4)) {}
|
||||
grid_about({{gx, gy}}, 1.0f, 2);
|
||||
try_all({{x, y, distance, &frames}, {gx, gy, distance, &frames}});
|
||||
const int64_t here = trial(x, y, distance, frames), there = trial(gx, gy, distance, frames);
|
||||
logger.Info("Stills beam centre grid at {:.2f} mm: ({:.2f},{:.2f}) puts {} sampled spots on the lattice, "
|
||||
|
||||
Reference in new issue
Block a user