jfjoch_fpga_stills_test: -m <frames> sums frames into each image

The card sums up to 256, above that the largest divisor up to 256 and the
host the rest (hybrid summation); images are 32-bit. jfjoch_fpga_test
already has -S for the card-only case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-18 18:49:54 +01:00
1 parent 4e8ccc2b60
commit 27c4306b7a
2 files changed
+17 -5

No files matched your search

+4 -2
View File
@@ -74,7 +74,7 @@ synthesis C model on the CPU, so no FPGA device is required.
Measures rugnux live stills on the FPGA card(s), with a stored dataset standing in for the detector:
```
jfjoch_fpga_stills_test [-i <images>] [-s <cards>] [-N <threads>] [-B <MiB>] [-C a,b,c,al,be,ga] [-X <indexer>] [-r <Hz>,...] [-p <slots>] [-k <F>] [-d] [-v] [-K[<MiB>]] <master.h5>
jfjoch_fpga_stills_test [-i <images>] [-s <cards>] [-N <threads>] [-B <MiB>] [-C a,b,c,al,be,ga] [-X <indexer>] [-r <Hz>,...] [-p <slots>] [-k <F>] [-m <frames>] [-d] [-v] [-K[<MiB>]] <master.h5>
```
- The dataset must be a stored JUNGFRAU dataset with its modules assembled (1030 x 514 each, any placement
@@ -89,7 +89,9 @@ jfjoch_fpga_stills_test [-i <images>] [-s <cards>] [-N <threads>] [-B <MiB>] [-C
conversion off, so the card returns them verbatim; the host assembles them as signed 16-bit photon
counts and rugnux live stills analyses them through `FPGAImagePuller`, as the broker does with rugnux live
on (`-d`: not blocking, as the broker runs; `-v`: each card's progress every 0.5 s; `-k <F>`: analyse 1 of every
F images on average, the rugnux live setting `stills_downsample`). Beam centre, distance, energy and the cell
F images on average, the rugnux live setting `stills_downsample`; `-m <N>`: N frames summed into each image, by
the card up to 256 and above that the largest divisor of N up to 256 on the card and the rest on the host, 32-bit
images). Beam centre, distance, energy and the cell
come from the file (`-C` overrides the cell; without one the frames are indexed de novo). Nothing is
written.
- Each card's generator holds module frames of its own modules only: as many images as its memory holds
+13 -3
View File
@@ -45,6 +45,8 @@ void print_usage(Logger &logger) {
logger.Info(" -p<num> Images FPGAImagePuller keeps compressed for the receiver (default 128)");
logger.Info(" -U No dummy modules: where the cards carry different numbers of modules, they run apart");
logger.Info(" -k<num> Analyse 1 of every <num> images on average (rugnux live stills_downsample, default 1)");
logger.Info(" -m<num> Frames summed into an image (default 1): the card sums the largest divisor up to 256, the");
logger.Info(" host the rest (1000 = 250 on the card x 4 on the host)");
logger.Info(" -d Not blocking, as the broker runs: images the host has no room for are dropped. The cards'");
logger.Info(" generators run free, each at a speed that goes with its modules: where the modules do not");
logger.Info(" divide evenly, each card is given dummy modules up to the largest count (-U: not)");
@@ -94,7 +96,7 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s
std::optional<size_t> nimages, uint16_t nstreams, uint16_t nthreads, size_t send_buffer_size_MiB,
const IndexingSettings &indexing, const std::optional<UnitCell> &cell, size_t puller_queue,
const std::vector<double> &rates, bool dropping, bool pad, bool verbose, int64_t downsample,
const std::optional<gemmi::SpaceGroup> &space_group) {
const std::optional<gemmi::SpaceGroup> &space_group, int64_t summation) {
RegisterHDF5Filter();
JFJochHDF5Reader reader;
reader.ReadFile(file);
@@ -116,6 +118,9 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s
.UseInternalPacketGenerator(true).DataStreams(nstreams);
// The card returns the frames as loaded; the host assembles them as signed 16-bit photon counts
x.JungfrauConvPhotonCnt(false).GeometryTransformation(true).PixelSigned(true).BitDepthImage(16);
// Summed: 32-bit images
if (summation > 1)
x.Summation(summation).BitDepthImage(32);
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
x.IncidentEnergy_keV(file_x.GetIncidentEnergy_keV()).DetectorDistance_mm(file_x.GetDetectorDistance_mm())
.BeamX_pxl(file_x.GetBeamX_pxl()).BeamY_pxl(file_x.GetBeamY_pxl());
@@ -332,10 +337,11 @@ int main(int argc, char **argv) {
bool dropping = false;
bool pad = true;
int64_t downsample = 1;
int64_t summation = 1;
std::optional<gemmi::SpaceGroup> space_group;
int opt;
while ((opt = getopt(argc, argv, "vi:s:N:B:C:S:X:t:r:p:dUk:K::")) != -1) {
while ((opt = getopt(argc, argv, "vi:s:N:B:C:S:X:t:r:p:dUk:m:K::")) != -1) {
switch (opt) {
case 'v':
verbose = true;
@@ -394,6 +400,9 @@ int main(int argc, char **argv) {
case 'k':
downsample = atol(optarg);
break;
case 'm':
summation = atol(optarg);
break;
case 'S': {
const gemmi::SpaceGroup *sg = gemmi::find_spacegroup_by_name(optarg);
if (sg == nullptr) {
@@ -445,7 +454,8 @@ int main(int argc, char **argv) {
bool ret = false;
try {
ret = RunDataset(logger, aq_devices, argv[optind], nimages, nstreams, nthreads, send_buffer_size_MiB,
i_settings, cell, puller_queue, rates, dropping, pad, verbose, downsample, space_group);
i_settings, cell, puller_queue, rates, dropping, pad, verbose, downsample, space_group,
summation);
} catch (std::exception &e) {
logger.Error(e.what());
}