Live stills: frames indexed on the pre-pass's refined cell and spot budget, as offline
The pre-pass refines the cell beside the distance (their scales trade), and offline indexes every frame on that refined cell with up to 1000 spots. Live kept the stated cell at the refined distance (off in scale by as much as the distance moved, 1.7% on one 9M set) and the broker's 250-spot cap (a third short of a 9M frame's ~380 spots). Both now come from the pre-pass result; the start message keeps the stated cell, and the merge keeps it as the given cell. Replay on the first N frames (live before -> after, offline rugnux on the same frames): 9M 100 frames 0.99 -> 1.00 (offline 0.99), merge CC1/2 0.758 -> 0.798; 9M 30 frames 0.967 -> 1.00; 4M 100 frames 1.00 -> 1.00 (offline 1.00); 8M 200 frames 0.320 -> 0.325 (offline with the file's space group 0.320). Per-image analysis +10% on 9M (16.0 -> 17.6 ms, more spots). The 8M gap reported (live 0.35 vs offline 0.56) was the comparison: the file carries a space group, which live takes from it and offline only with -S. Offline with -S gives 0.349 = live; without it, offline indexes 13-14 more frames of 6-10 spots out of ~40, and merges worse (CC1/2 0.10 vs 0.20). jfjoch_stills_gpu_replay: -p spots per image; per-frame <prefix>_images.tsv and _spots.tsv to compare frame by frame with an offline _process.h5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqXYdHHZ4cogS1mrGUtfN7
This commit is contained in:
1 parent
9f38cffdda
commit
17bfca6a22
5 files changed
+37
-3
No files matched your search
@@ -161,6 +161,8 @@ void JFJochReceiverRugnuxStills::StillsReady(const StillsSetup &setup) {
|
|||||||
plots.Setup(setup.experiment, *setup.mapping);
|
plots.Setup(setup.experiment, *setup.mapping);
|
||||||
DiffractionExperiment written(setup.experiment);
|
DiffractionExperiment written(setup.experiment);
|
||||||
written.Goniometer(experiment.GetGoniometer());
|
written.Goniometer(experiment.GetGoniometer());
|
||||||
|
// The cell as stated: the one the frames are indexed on is the analysis's, and the merge reports its own
|
||||||
|
written.SetUnitCell(experiment.GetUnitCell());
|
||||||
SendStartMessage(MakeStartMessage(written, setup.mask, *setup.mapping));
|
SendStartMessage(MakeStartMessage(written, setup.mask, *setup.mapping));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,13 @@ void StillsGPUAnalysis::PrePassThread() {
|
|||||||
int geometry_frames = 0;
|
int geometry_frames = 0;
|
||||||
if (result) {
|
if (result) {
|
||||||
setup.experiment.BeamX_pxl(result->beam_x_pxl).BeamY_pxl(result->beam_y_pxl).DetectorDistance_mm(result->distance_mm);
|
setup.experiment.BeamX_pxl(result->beam_x_pxl).BeamY_pxl(result->beam_y_pxl).DetectorDistance_mm(result->distance_mm);
|
||||||
|
// The frames are indexed on the cell refined beside that distance, as offline: the stated cell at the refined
|
||||||
|
// distance is off in scale by as much as the distance moved (1.7% on a set whose header was that far off)
|
||||||
|
if (result->cell)
|
||||||
|
setup.experiment.SetUnitCell(*result->cell);
|
||||||
|
// and on as many spots as the pre-pass kept, as offline (the broker's default of 250 left a 9M frame of
|
||||||
|
// ~380 spots a third short of what its lattice is refined on)
|
||||||
|
setup.experiment.MaxSpotCount(result->max_spot_count);
|
||||||
// The frames are integrated as the pre-pass integrated its own: its polarization and background ring
|
// The frames are integrated as the pre-pass integrated its own: its polarization and background ring
|
||||||
setup.experiment.PolarizationFactor(result->polarization);
|
setup.experiment.PolarizationFactor(result->polarization);
|
||||||
setup.experiment.ImportBraggIntegrationSettings(result->integration);
|
setup.experiment.ImportBraggIntegrationSettings(result->integration);
|
||||||
@@ -260,7 +267,7 @@ void StillsGPUAnalysis::PrePassThread() {
|
|||||||
merge_experiment = setup.experiment;
|
merge_experiment = setup.experiment;
|
||||||
merge_experiment.ImportScalingSettings(RugnuxDefaultScalingSettings(false));
|
merge_experiment.ImportScalingSettings(RugnuxDefaultScalingSettings(false));
|
||||||
merge = std::make_unique<StillsLiveMerge>(merge_experiment, experiment.GetImageNum(),
|
merge = std::make_unique<StillsLiveMerge>(merge_experiment, experiment.GetImageNum(),
|
||||||
setup.experiment.GetUnitCell(),
|
experiment.GetUnitCell(),
|
||||||
result ? result->run_width : std::nullopt,
|
result ? result->run_width : std::nullopt,
|
||||||
setup.experiment.IsDetectIceRings(),
|
setup.experiment.IsDetectIceRings(),
|
||||||
SpotFindingSettings().ice_ring_width_Q_recipA, logger);
|
SpotFindingSettings().ice_ring_width_Q_recipA, logger);
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ StillsPrePassResult RunStillsPrePass(const StartMessage &start, const std::map<i
|
|||||||
.mask = rugnux.GetPixelMask(),
|
.mask = rugnux.GetPixelMask(),
|
||||||
.images = images.size(),
|
.images = images.size(),
|
||||||
.geometry_frames = result.stills_geometry_frames,
|
.geometry_frames = result.stills_geometry_frames,
|
||||||
|
.cell = rugnux.GetExperiment().GetUnitCell(),
|
||||||
|
.max_spot_count = rugnux.GetExperiment().GetMaxSpotCount(),
|
||||||
.polarization = rugnux.GetExperiment().GetPolarizationFactor(),
|
.polarization = rugnux.GetExperiment().GetPolarizationFactor(),
|
||||||
.integration = rugnux.GetExperiment().GetBraggIntegrationSettings(),
|
.integration = rugnux.GetExperiment().GetBraggIntegrationSettings(),
|
||||||
.run_width = rugnux.GetStillsRunWidth(),
|
.run_width = rugnux.GetStillsRunWidth(),
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ struct StillsPrePassResult {
|
|||||||
PixelMask mask;
|
PixelMask mask;
|
||||||
size_t images = 0;
|
size_t images = 0;
|
||||||
int geometry_frames = 0; // the indexed frames the distance and centre were refined on; 0: kept as stated
|
int geometry_frames = 0; // the indexed frames the distance and centre were refined on; 0: kept as stated
|
||||||
|
// The cell the pre-pass indexed its frames on: the one stated, or found de novo, as refined beside the distance
|
||||||
|
// (its scale trades with the distance, so the two go together)
|
||||||
|
std::optional<UnitCell> cell;
|
||||||
|
int64_t max_spot_count = 0; // the spots kept per frame, the strongest
|
||||||
// What the pre-pass integrated its frames with, for the frames after it: the polarization, the integration
|
// What the pre-pass integrated its frames with, for the frames after it: the polarization, the integration
|
||||||
// radii and background ring as the pre-scan measured them, and the run's rocking width with the prediction
|
// radii and background ring as the pre-scan measured them, and the run's rocking width with the prediction
|
||||||
// window made from it (empty where the pre-pass could not measure it).
|
// window made from it (empty where the pre-pass could not measure it).
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
// Replays the frames of a stored serial collection through the broker's live analysis of serial
|
// Replays the frames of a stored serial collection through the broker's live analysis of serial
|
||||||
// frames (StillsGPUAnalysis): the pre-pass on the first images, then every frame analysed with the
|
// frames (StillsGPUAnalysis): the pre-pass on the first images, then every frame analysed with the
|
||||||
// beam centre and mask it decided. Reports the pre-pass, the indexed fraction and the sustained rate, and
|
// beam centre and mask it decided. Reports the pre-pass, the indexed fraction and the sustained rate, and
|
||||||
// writes the mask the frames were analysed with (<prefix>_mask.u32, uint32, row by row). With a model (-m), the
|
// writes the mask the frames were analysed with (<prefix>_mask.u32, uint32, row by row), and per frame its spot
|
||||||
|
// count, indexed spot count and outcome (<prefix>_images.tsv) and its spots (<prefix>_spots.tsv). With a model (-m), the
|
||||||
// model step of the merges as the broker makes it, and the files the end message would carry: <prefix>.mtz (the
|
// model step of the merges as the broker makes it, and the files the end message would carry: <prefix>.mtz (the
|
||||||
// merge, in the model's frame), <prefix>_maps.mtz, <prefix>_model.cif, <prefix>_refined_model.cif,
|
// merge, in the model's frame), <prefix>_maps.mtz, <prefix>_model.cif, <prefix>_refined_model.cif,
|
||||||
// <prefix>_refined_maps.mtz.
|
// <prefix>_refined_maps.mtz.
|
||||||
@@ -59,6 +60,7 @@ void print_usage() {
|
|||||||
std::cout << " -M no merge (StillsGPUAnalysis merge = false)" << std::endl;
|
std::cout << " -M no merge (StillsGPUAnalysis merge = false)" << std::endl;
|
||||||
std::cout << " -e <images> the first images given as empty frames (no diffraction)" << std::endl;
|
std::cout << " -e <images> the first images given as empty frames (no diffraction)" << std::endl;
|
||||||
std::cout << " -m <file> model (PDB/mmCIF) placed and refined against the merges" << std::endl;
|
std::cout << " -m <file> model (PDB/mmCIF) placed and refined against the merges" << std::endl;
|
||||||
|
std::cout << " -p <num> spots kept per image (default: the file's, as the broker's)" << std::endl;
|
||||||
std::cout << " -D <s> deadline of the model step after the last image (default 60, 0 = none)" << std::endl;
|
std::cout << " -D <s> deadline of the model step after the last image (default 60, 0 = none)" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +75,7 @@ int main(int argc, char **argv) {
|
|||||||
int nthreads = 16;
|
int nthreads = 16;
|
||||||
size_t buffer_MiB = 8192;
|
size_t buffer_MiB = 8192;
|
||||||
std::optional<float> beam_x, beam_y;
|
std::optional<float> beam_x, beam_y;
|
||||||
|
std::optional<int64_t> max_spots;
|
||||||
std::optional<UnitCell> cell;
|
std::optional<UnitCell> cell;
|
||||||
bool no_cell = false;
|
bool no_cell = false;
|
||||||
bool fixed_threshold = false;
|
bool fixed_threshold = false;
|
||||||
@@ -83,7 +86,7 @@ int main(int argc, char **argv) {
|
|||||||
double deadline_s = 60;
|
double deadline_s = 60;
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "o:s:n:r:N:b:x:y:C:cFS:Me:m:D:")) != -1) {
|
while ((opt = getopt(argc, argv, "o:s:n:r:N:b:x:y:C:cFS:Me:m:D:p:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'o': prefix = optarg; break;
|
case 'o': prefix = optarg; break;
|
||||||
case 's': first = atoll(optarg); break;
|
case 's': first = atoll(optarg); break;
|
||||||
@@ -97,6 +100,7 @@ int main(int argc, char **argv) {
|
|||||||
case 'F': fixed_threshold = true; break;
|
case 'F': fixed_threshold = true; break;
|
||||||
case 'S': space_group = optarg; break;
|
case 'S': space_group = optarg; break;
|
||||||
case 'M': merge = false; break;
|
case 'M': merge = false; break;
|
||||||
|
case 'p': max_spots = atoll(optarg); break;
|
||||||
case 'e': empty_frames = atoll(optarg); break;
|
case 'e': empty_frames = atoll(optarg); break;
|
||||||
case 'm': model = std::make_shared<const RugnuxModel>(ReadRugnuxModelFile(optarg)); break;
|
case 'm': model = std::make_shared<const RugnuxModel>(ReadRugnuxModelFile(optarg)); break;
|
||||||
case 'D': deadline_s = atof(optarg); break;
|
case 'D': deadline_s = atof(optarg); break;
|
||||||
@@ -139,6 +143,8 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
if (cell)
|
if (cell)
|
||||||
x.SetUnitCell(cell);
|
x.SetUnitCell(cell);
|
||||||
|
if (max_spots)
|
||||||
|
x.MaxSpotCount(*max_spots);
|
||||||
if (space_group)
|
if (space_group)
|
||||||
x.SetSpaceGroup(*gemmi::find_spacegroup_by_name(*space_group));
|
x.SetSpaceGroup(*gemmi::find_spacegroup_by_name(*space_group));
|
||||||
const PixelMask &mask = *dataset->pixel_mask;
|
const PixelMask &mask = *dataset->pixel_mask;
|
||||||
@@ -175,6 +181,10 @@ int main(int argc, char **argv) {
|
|||||||
std::unique_ptr<AzimuthalIntegrationProfile> run_profile;
|
std::unique_ptr<AzimuthalIntegrationProfile> run_profile;
|
||||||
RugnuxLiveStatus status; // nobody reads it here
|
RugnuxLiveStatus status; // nobody reads it here
|
||||||
ReplaySink sink;
|
ReplaySink sink;
|
||||||
|
std::mutex image_log_mutex;
|
||||||
|
std::ofstream image_log(prefix + "_images.tsv"), spot_log(prefix + "_spots.tsv");
|
||||||
|
image_log << "image\tspots\tindexed_spots\tindexed\n";
|
||||||
|
spot_log << "image\tx\ty\tintensity\tindexed\n";
|
||||||
sink.ready = [&](const StillsSetup &setup) {
|
sink.ready = [&](const StillsSetup &setup) {
|
||||||
t_ready = std::chrono::steady_clock::now();
|
t_ready = std::chrono::steady_clock::now();
|
||||||
run_profile = std::make_unique<AzimuthalIntegrationProfile>(*setup.mapping);
|
run_profile = std::make_unique<AzimuthalIntegrationProfile>(*setup.mapping);
|
||||||
@@ -186,6 +196,15 @@ int main(int argc, char **argv) {
|
|||||||
setup.experiment.GetBeamX_pxl(), setup.experiment.GetBeamY_pxl());
|
setup.experiment.GetBeamX_pxl(), setup.experiment.GetBeamY_pxl());
|
||||||
};
|
};
|
||||||
sink.analysed = [&](DataMessage &m, const AzimuthalIntegrationProfile &profile) {
|
sink.analysed = [&](DataMessage &m, const AzimuthalIntegrationProfile &profile) {
|
||||||
|
{
|
||||||
|
// One line per frame and per spot, to compare frame by frame with an offline run's _process.h5
|
||||||
|
std::unique_lock ul(image_log_mutex);
|
||||||
|
image_log << m.number << '\t' << m.spots.size() << '\t' << m.spot_count_indexed.value_or(0) << '\t'
|
||||||
|
<< m.indexing_result.value_or(false) << '\n';
|
||||||
|
for (const auto &s: m.spots)
|
||||||
|
spot_log << m.number << '\t' << s.x << '\t' << s.y << '\t' << s.intensity << '\t' << s.indexed
|
||||||
|
<< '\n';
|
||||||
|
}
|
||||||
{
|
{
|
||||||
// As the receiver's plots do: the frames' profiles add up over the run.
|
// As the receiver's plots do: the frames' profiles add up over the run.
|
||||||
std::unique_lock ul(run_profile_mutex);
|
std::unique_lock ul(run_profile_mutex);
|
||||||
|
|||||||
Reference in new issue
Block a user