JFJochStateMachine: Limit ProtoBuf structures

This commit is contained in:
2023-11-16 16:20:01 +01:00
parent 59765091b9
commit 03d2acfbe2
5 changed files with 222 additions and 138 deletions

View File

@@ -97,6 +97,71 @@ inline JFJochProtoBuf::JFCalibrationStatistics Convert(const std::vector<JFCalib
}
return output;
}
inline JFJochProtoBuf::BrokerStatus Convert(const BrokerStatus& input) {
JFJochProtoBuf::BrokerStatus ret;
switch (input.broker_state) {
case JFJochState::Inactive:
ret.set_broker_state(JFJochProtoBuf::NOT_INITIALIZED);
break;
case JFJochState::Idle:
ret.set_broker_state(JFJochProtoBuf::IDLE);
break;
case JFJochState::Measuring:
ret.set_broker_state(JFJochProtoBuf::DATA_COLLECTION);
break;
case JFJochState::Error:
ret.set_broker_state(JFJochProtoBuf::ERROR);
break;
case JFJochState::Busy:
ret.set_broker_state(JFJochProtoBuf::BUSY);
break;
case JFJochState::Pedestal:
ret.set_broker_state(JFJochProtoBuf::PEDESTAL);
break;
}
ret.set_progress(input.progress);
ret.set_indexing_rate(input.indexing_rate);
ret.set_receiver_send_buffers_avail(input.receiver_send_buffers_avail);
return ret;
}
JFJochProtoBuf::DetectorList Convert(const DetectorList &input) {
JFJochProtoBuf::DetectorList ret;
for (const auto &i: input.detector) {
auto tmp = ret.add_detector();
tmp->set_id(i.id);
tmp->set_nmodules(i.nmodules);
tmp->set_description(i.description);
}
ret.set_current_description(input.current_description);
ret.set_current_id(input.current_id);
return ret;
}
JFJochProtoBuf::MeasurementStatistics Convert(const MeasurementStatistics &input) {
JFJochProtoBuf::MeasurementStatistics ret{};
ret.set_file_prefix(input.file_prefix);
ret.set_images_collected(input.images_collected);
ret.set_max_image_number_sent(input.max_image_number_sent);
ret.set_collection_efficiency(input.collection_efficiency);
ret.set_compression_ratio(input.compression_ratio);
ret.set_cancelled(input.cancelled);
ret.set_max_receive_delay(input.max_receive_delay);
ret.set_indexing_rate(input.indexing_rate);
ret.set_detector_width(input.detector_width);
ret.set_detector_height(input.detector_height);
ret.set_detector_pixel_depth(input.detector_pixel_depth);
ret.set_bkg_estimate(input.bkg_estimate);
return ret;
}
JFJochBroker::JFJochBroker(const DiffractionExperiment &experiment) {
state_machine.NotThreadSafe_Experiment() = experiment;
@@ -139,7 +204,7 @@ grpc::Status JFJochBroker::Trigger(grpc::ServerContext *context, const JFJochPro
grpc::Status JFJochBroker::GetStatus(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request,
JFJochProtoBuf::BrokerStatus *response) {
GRPC_RUN( *response = state_machine.GetStatus() );
GRPC_RUN( *response = Convert(state_machine.GetStatus()) );
}
grpc::Status JFJochBroker::GetPlots(grpc::ServerContext *context, const JFJochProtoBuf::PlotRequest *request,
@@ -184,7 +249,7 @@ grpc::Status JFJochBroker::GetMeasurementStatistics(grpc::ServerContext *context
GRPC_RUN({
auto stat = state_machine.GetMeasurementStatistics();
if (stat)
*response = stat.value();
*response = Convert(stat.value());
else
*response = JFJochProtoBuf::MeasurementStatistics();
});
@@ -202,7 +267,7 @@ void JFJochBroker::AddDetectorSetup(const DetectorSetup &setup) {
grpc::Status JFJochBroker::GetDetectorList(grpc::ServerContext *context,
const JFJochProtoBuf::Empty *request,
JFJochProtoBuf::DetectorList *response) {
GRPC_RUN(*response = state_machine.GetDetectorsList() );
GRPC_RUN(*response = Convert(state_machine.GetDetectorsList()) );
}
grpc::Status JFJochBroker::SelectDetector(grpc::ServerContext *context,

View File

@@ -400,33 +400,34 @@ JFJochStateMachine::~JFJochStateMachine() {
void JFJochStateMachine::SetFullMeasurementOutput(const JFJochServicesOutput &output) {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
auto tmp = JFJochProtoBuf::MeasurementStatistics(); // reset last measurement statistics
MeasurementStatistics tmp{}; // reset last measurement statistics
tmp.set_file_prefix(experiment.GetFilePrefix());
tmp.set_detector_width(experiment.GetXPixelsNum());
tmp.set_detector_height(experiment.GetYPixelsNum());
tmp.set_detector_pixel_depth(experiment.GetPixelDepth());
tmp.file_prefix = experiment.GetFilePrefix();
tmp.detector_width = experiment.GetXPixelsNum();
tmp.detector_height = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetPixelDepth();
tmp.set_compression_ratio(output.receiver_output.compressed_ratio);
tmp.set_collection_efficiency(output.receiver_output.efficiency);
tmp.set_images_collected(output.receiver_output.images_sent);
tmp.set_cancelled(output.receiver_output.cancelled);
tmp.set_max_image_number_sent(output.receiver_output.max_image_number_sent);
tmp.set_max_receive_delay(output.receiver_output.max_receive_delay);
tmp.set_indexing_rate(output.receiver_output.indexing_rate);
tmp.set_bkg_estimate(output.receiver_output.bkg_estimate);
tmp.compression_ratio = output.receiver_output.compressed_ratio;
tmp.collection_efficiency = output.receiver_output.efficiency;
tmp.images_collected = output.receiver_output.images_sent;
tmp.cancelled = output.receiver_output.cancelled;
tmp.max_image_number_sent = output.receiver_output.max_image_number_sent;
tmp.max_receive_delay = output.receiver_output.max_receive_delay;
tmp.indexing_rate = output.receiver_output.indexing_rate;
tmp.bkg_estimate = output.receiver_output.bkg_estimate;
measurement_statistics = tmp;
}
void JFJochStateMachine::ClearAndSetMeasurementStatistics() {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
measurement_statistics = JFJochProtoBuf::MeasurementStatistics();
MeasurementStatistics tmp{};
measurement_statistics->set_file_prefix(experiment.GetFilePrefix());
measurement_statistics->set_detector_height(experiment.GetXPixelsNum());
measurement_statistics->set_detector_width(experiment.GetYPixelsNum());
measurement_statistics->set_detector_pixel_depth(experiment.GetPixelDepth());
tmp.file_prefix = experiment.GetFilePrefix();
tmp.detector_height = experiment.GetXPixelsNum();
tmp.detector_width = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetPixelDepth();
measurement_statistics = tmp;
}
void JFJochStateMachine::ClearMeasurementStatistics() {
@@ -434,7 +435,7 @@ void JFJochStateMachine::ClearMeasurementStatistics() {
measurement_statistics.reset();
}
std::optional<JFJochProtoBuf::MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistics() const {
std::optional<MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistics() const {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
return measurement_statistics;
}
@@ -499,35 +500,15 @@ DiffractionExperiment &JFJochStateMachine::NotThreadSafe_Experiment() {
return experiment;
}
JFJochProtoBuf::BrokerStatus JFJochStateMachine::GetStatus() const {
JFJochProtoBuf::BrokerStatus ret;
switch (state) {
case JFJochState::Inactive:
ret.set_broker_state(JFJochProtoBuf::NOT_INITIALIZED);
break;
case JFJochState::Idle:
ret.set_broker_state(JFJochProtoBuf::IDLE);
break;
case JFJochState::Measuring:
ret.set_broker_state(JFJochProtoBuf::DATA_COLLECTION);
break;
case JFJochState::Error:
ret.set_broker_state(JFJochProtoBuf::ERROR);
break;
case JFJochState::Busy:
ret.set_broker_state(JFJochProtoBuf::BUSY);
break;
case JFJochState::Pedestal:
ret.set_broker_state(JFJochProtoBuf::PEDESTAL);
break;
}
BrokerStatus JFJochStateMachine::GetStatus() const {
BrokerStatus ret{};
ret.broker_state = state;
try {
auto rcv_status = services.GetReceiverStatus();
ret.set_progress(rcv_status.progress);
ret.set_indexing_rate(rcv_status.indexing_rate);
ret.set_receiver_send_buffers_avail(rcv_status.send_buffers_avail);
ret.progress = rcv_status.progress;
ret.indexing_rate = rcv_status.indexing_rate;
ret.receiver_send_buffers_avail = rcv_status.send_buffers_avail;
} catch (JFJochException &e) {} // ignore exception in getting receiver status (don't really care, e.g. if receiver is down)
return ret;
@@ -573,19 +554,20 @@ void JFJochStateMachine::AddDetectorSetup(const DetectorSetup &setup) {
detector_setup.emplace_back(setup);
}
JFJochProtoBuf::DetectorList JFJochStateMachine::GetDetectorsList() {
DetectorList JFJochStateMachine::GetDetectorsList() {
std::unique_lock<std::mutex> ul(m);
JFJochProtoBuf::DetectorList ret;
DetectorList ret;
for (int i = 0; i < detector_setup.size(); i++) {
auto tmp = ret.add_detector();
tmp->set_description(detector_setup[i].GetDescription());
tmp->set_nmodules(detector_setup[i].GetModulesNum());
tmp->set_id(i);
DetectorListElement tmp;
tmp.description = detector_setup[i].GetDescription();
tmp.nmodules = detector_setup[i].GetModulesNum();
tmp.id = i;
ret.detector.emplace_back(std::move(tmp));
}
ret.set_current_id(current_detector_setup);
ret.set_current_description(experiment.GetDetectorDescription());
ret.current_id = current_detector_setup;
ret.current_description = experiment.GetDetectorDescription();
return ret;
}

View File

@@ -20,6 +20,44 @@ enum class JFJochState {Inactive, Idle, Measuring, Error, Busy, Pedestal};
void LoadDatasetSettings(DiffractionExperiment& experiment, const JFJochProtoBuf::DatasetSettings &settings);
struct BrokerStatus {
JFJochState broker_state;
float progress;
float indexing_rate;
float receiver_send_buffers_avail;
};
struct DetectorListElement {
std::string description;
int64_t nmodules;
int64_t id;
};
struct DetectorList {
std::vector<DetectorListElement> detector;
int64_t current_id;
std::string current_description;
};
struct MeasurementStatistics {
std::string file_prefix;
int64_t images_collected;
int64_t max_image_number_sent;
float collection_efficiency;
float compression_ratio;
bool cancelled;
int64_t max_receive_delay;
float indexing_rate;
int64_t detector_width;
int64_t detector_height;
int64_t detector_pixel_depth;
float bkg_estimate;
};
class JFJochStateMachine {
Logger &logger;
JFJochServices &services;
@@ -42,7 +80,7 @@ class JFJochStateMachine {
std::vector<JFCalibrationModuleStatistics> calibration_statistics;
mutable std::mutex last_receiver_output_mutex;
std::optional<JFJochProtoBuf::MeasurementStatistics> measurement_statistics;
std::optional<MeasurementStatistics> measurement_statistics;
void SetFullMeasurementOutput(const JFJochServicesOutput &output);
void ClearMeasurementStatistics();
void ClearAndSetMeasurementStatistics();
@@ -81,10 +119,10 @@ public:
void SetDetectorSettings(const JFJochProtoBuf::DetectorSettings& settings);
// return by value to ensure thread safety
std::optional<JFJochProtoBuf::MeasurementStatistics> GetMeasurementStatistics() const;
std::optional<MeasurementStatistics> GetMeasurementStatistics() const;
std::vector<JFCalibrationModuleStatistics> GetCalibrationStatistics() const;
JFJochProtoBuf::BrokerStatus GetStatus() const;
BrokerStatus GetStatus() const;
Plot GetPlots(const PlotRequest &request) const;
RadialIntegrationProfiles GetRadialIntegrationProfiles() const;
@@ -101,7 +139,7 @@ public:
void DebugOnly_SetState(JFJochState state);
void AddDetectorSetup(const DetectorSetup& setup);
JFJochProtoBuf::DetectorList GetDetectorsList();
DetectorList GetDetectorsList();
void SelectDetector(int64_t id);
};

View File

@@ -212,13 +212,13 @@ TEST_CASE("JFJochStateMachine_AddDetectorSetup_Multiple") {
REQUIRE_NOTHROW(state_machine.AddDetectorSetup(DetectorSetup(DetectorGeometry(1), "Det3", {"mx1"})));
auto dl = state_machine.GetDetectorsList();
REQUIRE(dl.detector_size() == 3);
REQUIRE(dl.detector(0).description() == "Det1");
REQUIRE(dl.detector(0).nmodules() == 4);
REQUIRE(dl.detector(1).description() == "Det2");
REQUIRE(dl.detector(1).nmodules() == 2);
REQUIRE(dl.detector(2).description() == "Det3");
REQUIRE(dl.detector(2).nmodules() == 1);
REQUIRE(dl.detector.size() == 3);
REQUIRE(dl.detector[0].description == "Det1");
REQUIRE(dl.detector[0].nmodules == 4);
REQUIRE(dl.detector[1].description == "Det2");
REQUIRE(dl.detector[1].nmodules == 2);
REQUIRE(dl.detector[2].description == "Det3");
REQUIRE(dl.detector[2].nmodules == 1);
REQUIRE_NOTHROW(state_machine.Initialize());
REQUIRE(state_machine.NotThreadSafe_Experiment().GetModulesNum() == 4);

View File

@@ -63,10 +63,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ", "[JFJochReceiver]") {
REQUIRE_NOTHROW(state_machine.Start(setup));
logger.Info("Started measurement");
JFJochProtoBuf::BrokerStatus status;
BrokerStatus status;
status = state_machine.GetStatus();
REQUIRE(status.progress() == Approx(0.0));
REQUIRE(status.broker_state() == JFJochProtoBuf::DATA_COLLECTION);
REQUIRE(status.progress == Approx(0.0));
REQUIRE(status.broker_state == JFJochState::Measuring);
for (int i = 0; i < ndatastream; i++) {
for (int m = 0; m < state_machine.NotThreadSafe_Experiment().GetModulesNum(i); m++) {
@@ -80,20 +80,20 @@ TEST_CASE("JFJochIntegrationTest_ZMQ", "[JFJochReceiver]") {
logger.Info("Stopped measurement");
status = state_machine.GetStatus();
REQUIRE(status.broker_state() == JFJochProtoBuf::IDLE);
REQUIRE(status.broker_state == JFJochState::Idle);
auto tmp = state_machine.GetMeasurementStatistics();
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.max_image_number_sent() == 4);
REQUIRE(!statistics.cancelled());
REQUIRE(statistics.file_prefix() == "integration_test");
REQUIRE(statistics.detector_width() == 2068);
REQUIRE(statistics.detector_height() == 2164);
REQUIRE(statistics.detector_pixel_depth() == 2);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
REQUIRE(statistics.max_image_number_sent == 4);
REQUIRE(!statistics.cancelled);
REQUIRE(statistics.file_prefix == "integration_test");
REQUIRE(statistics.detector_width == 2068);
REQUIRE(statistics.detector_height == 2164);
REQUIRE(statistics.detector_pixel_depth == 2);
writer_future.get();
}
@@ -149,10 +149,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_save_calibration", "[JFJochReceiver]") {
REQUIRE_NOTHROW(state_machine.Start(setup));
logger.Info("Started measurement");
JFJochProtoBuf::BrokerStatus status;
BrokerStatus status;
status = state_machine.GetStatus();
REQUIRE(status.progress() == Approx(0.0));
REQUIRE(status.broker_state() == JFJochProtoBuf::DATA_COLLECTION);
REQUIRE(status.progress == Approx(0.0));
REQUIRE(status.broker_state == JFJochState::Measuring);
for (int i = 0; i < ndatastream; i++) {
for (int m = 0; m < state_machine.NotThreadSafe_Experiment().GetModulesNum(i); m++) {
@@ -166,20 +166,20 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_save_calibration", "[JFJochReceiver]") {
logger.Info("Stopped measurement");
status = state_machine.GetStatus();
REQUIRE(status.broker_state() == JFJochProtoBuf::IDLE);
REQUIRE(status.broker_state == JFJochState::Idle);
auto tmp = state_machine.GetMeasurementStatistics();
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.max_image_number_sent() == 4);
REQUIRE(!statistics.cancelled());
REQUIRE(statistics.file_prefix() == "integration_test_with_calibration");
REQUIRE(statistics.detector_width() == 2068);
REQUIRE(statistics.detector_height() == 2164);
REQUIRE(statistics.detector_pixel_depth() == 2);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
REQUIRE(statistics.max_image_number_sent == 4);
REQUIRE(!statistics.cancelled);
REQUIRE(statistics.file_prefix == "integration_test_with_calibration");
REQUIRE(statistics.detector_width == 2068);
REQUIRE(statistics.detector_height == 2164);
REQUIRE(statistics.detector_pixel_depth == 2);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -235,10 +235,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_2DataStreams_4Devices", "[JFJochReceiver]")
REQUIRE_NOTHROW(state_machine.Start(setup));
logger.Info("Started measurement");
JFJochProtoBuf::BrokerStatus status;
BrokerStatus status;
status = state_machine.GetStatus();
REQUIRE(status.progress() == Approx(0.0));
REQUIRE(status.broker_state() == JFJochProtoBuf::DATA_COLLECTION);
REQUIRE(status.progress == Approx(0.0));
REQUIRE(status.broker_state == JFJochState::Measuring);
for (int i = 0; i < ndatastream; i++) {
for (int m = 0; m < state_machine.NotThreadSafe_Experiment().GetModulesNum(i); m++) {
@@ -252,20 +252,20 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_2DataStreams_4Devices", "[JFJochReceiver]")
logger.Info("Stopped measurement");
status = state_machine.GetStatus();
REQUIRE(status.broker_state() == JFJochProtoBuf::IDLE);
REQUIRE(status.broker_state == JFJochState::Idle);
auto tmp = state_machine.GetMeasurementStatistics();
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.max_image_number_sent() == 4);
REQUIRE(!statistics.cancelled());
REQUIRE(statistics.file_prefix() == "integration_test");
REQUIRE(statistics.detector_width() == 2068);
REQUIRE(statistics.detector_height() == 2164);
REQUIRE(statistics.detector_pixel_depth() == 2);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
REQUIRE(statistics.max_image_number_sent == 4);
REQUIRE(!statistics.cancelled);
REQUIRE(statistics.file_prefix == "integration_test");
REQUIRE(statistics.detector_width == 2068);
REQUIRE(statistics.detector_height == 2164);
REQUIRE(statistics.detector_pixel_depth == 2);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -326,10 +326,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_RAW", "[JFJochReceiver]") {
REQUIRE_NOTHROW(state_machine.Start(setup));
logger.Info("Started measurement");
JFJochProtoBuf::BrokerStatus status;
BrokerStatus status;
status = state_machine.GetStatus();
REQUIRE(status.progress() == Approx(0.0));
REQUIRE(status.broker_state() == JFJochProtoBuf::DATA_COLLECTION);
REQUIRE(status.progress == Approx(0.0));
REQUIRE(status.broker_state == JFJochState::Measuring);
for (int i = 0; i < ndatastream; i++) {
for (int m = 0; m < state_machine.NotThreadSafe_Experiment().GetModulesNum(i); m++) {
@@ -343,18 +343,18 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_RAW", "[JFJochReceiver]") {
logger.Info("Stopped measurement");
status = state_machine.GetStatus();
REQUIRE(status.broker_state() == JFJochProtoBuf::IDLE);
REQUIRE(status.broker_state == JFJochState::Idle);
auto tmp = state_machine.GetMeasurementStatistics();
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.file_prefix() == "integration_raw_test");
REQUIRE(statistics.detector_width() == 1024);
REQUIRE(statistics.detector_height() == 8 * 512);
REQUIRE(statistics.detector_pixel_depth() == 2);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
REQUIRE(statistics.file_prefix == "integration_raw_test");
REQUIRE(statistics.detector_width == 1024);
REQUIRE(statistics.detector_height == 8 * 512);
REQUIRE(statistics.detector_pixel_depth == 2);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -415,10 +415,9 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_3Writers", "[JFJochReceiver]") {
REQUIRE_NOTHROW(state_machine.Start(setup));
logger.Info("Started measurement");
JFJochProtoBuf::BrokerStatus status;
status = state_machine.GetStatus();
REQUIRE(status.progress() == Approx(0.0));
REQUIRE(status.broker_state() == JFJochProtoBuf::DATA_COLLECTION);
auto status = state_machine.GetStatus();
REQUIRE(status.progress == Approx(0.0));
REQUIRE(status.broker_state == JFJochState::Measuring);
for (int i = 0; i < ndatastream; i++) {
for (int image_num = 1; image_num <= nimages; image_num++) {
@@ -432,14 +431,14 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_3Writers", "[JFJochReceiver]") {
logger.Info("Stopped measurement");
status = state_machine.GetStatus();
REQUIRE(status.broker_state() == JFJochProtoBuf::IDLE);
REQUIRE(status.broker_state == JFJochState::Idle);
auto tmp = state_machine.GetMeasurementStatistics();
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == nimages);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == nimages);
REQUIRE_NOTHROW(writer_0_future.get());
REQUIRE_NOTHROW(writer_1_future.get());
@@ -510,10 +509,10 @@ TEST_CASE("JFJochIntegrationTest_Cancel", "[JFJochReceiver]") {
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 0.5);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.max_image_number_sent() == 4);
REQUIRE(statistics.cancelled());
REQUIRE(statistics.collection_efficiency == 0.5);
REQUIRE(statistics.images_collected == 5);
REQUIRE(statistics.max_image_number_sent == 4);
REQUIRE(statistics.cancelled);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -613,8 +612,8 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview", "[JFJochReceiver]") {
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -709,8 +708,8 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview_no_writer", "[JFJochReceiver]"
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 5);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 5);
}
TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot", "[JFJochReceiver]") {
@@ -815,8 +814,8 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot", "[JFJochReceiver]") {
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == 1);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == 1);
REQUIRE_NOTHROW(writer_future.get());
}
@@ -927,10 +926,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index", "[JFJochReceiver]
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.has_indexing_rate());
REQUIRE(statistics.indexing_rate() == 1.0);
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == nimages);
REQUIRE(statistics.has_indexing_rate);
REQUIRE(statistics.indexing_rate == 1.0);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == nimages);
writer_server->Shutdown();
@@ -1158,10 +1157,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum", "[JFJochRecei
REQUIRE(tmp.has_value());
auto statistics = tmp.value();
REQUIRE(statistics.collection_efficiency() == 1.0);
REQUIRE(statistics.images_collected() == nimages / 3);
REQUIRE(statistics.has_indexing_rate());
REQUIRE(statistics.indexing_rate() == 1.0);
REQUIRE(statistics.collection_efficiency == 1.0);
REQUIRE(statistics.images_collected == nimages / 3);
REQUIRE(statistics.has_indexing_rate);
REQUIRE(statistics.indexing_rate == 1.0);
writer_server->Shutdown();