mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-06 21:00:41 +02:00

major changes: - add python bindings for all c++ features except network_io - changes to cross compile on windows,linux and macos - fix bugs with cluster_finder - use Dtype in Frame instead of bitdepth - remove boost::program_options and replace with our implementation - add Transforms class that applies a sequence of functions (c++ or python functions) on a Frame. - remove frame reorder and flip from SubFile.cpp. use Transforms instead - Test clusterFinder and Pedestal results in comparison with slsDetectorCalibration --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com> Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#include "aare.hpp"
|
|
#include "aare/examples/defs.hpp"
|
|
|
|
#include <ctime> // std::time
|
|
#include <fmt/core.h>
|
|
#include <string>
|
|
|
|
// sleep
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
using namespace aare;
|
|
|
|
int main() {
|
|
std::srand(std::time(nullptr));
|
|
std::string const endpoint = "tcp://*:5555";
|
|
aare::ZmqSocketSender socket(endpoint);
|
|
socket.bind();
|
|
Frame frame(1024, 1024, Dtype::UINT32);
|
|
for (int i = 0; i < 1024; i++) {
|
|
for (int j = 0; j < 1024; j++) {
|
|
frame.set(i, j, i + j);
|
|
}
|
|
}
|
|
aare::ZmqHeader header;
|
|
header.shape = {1024, 1024};
|
|
header.size = sizeof(uint32_t) * 1024 * 1024;
|
|
header.bitmode = 32;
|
|
|
|
std::vector<ZmqFrame> zmq_frames;
|
|
// send two exact frames
|
|
|
|
std::chrono::milliseconds sleep_time(1); // or whatever
|
|
int acqid = 0;
|
|
while (true) {
|
|
zmq_frames.clear();
|
|
header.acqIndex = acqid++;
|
|
size_t const n_frames = std::rand() % 10 + 1;
|
|
|
|
aare::logger::info("acquisition:", header.acqIndex);
|
|
aare::logger::info("Header size:", header.to_string().size());
|
|
aare::logger::info("Frame size:", frame.bytes());
|
|
aare::logger::info("Number of frames:", n_frames);
|
|
|
|
for (size_t i = 0; i < n_frames; i++) {
|
|
zmq_frames.push_back({header, frame});
|
|
}
|
|
size_t const rc = socket.send(zmq_frames);
|
|
aare::logger::info("Sent bytes", rc);
|
|
std::this_thread::sleep_for(sleep_time);
|
|
}
|
|
return 0;
|
|
} |