diff --git a/acquisition_device/AcquisitionDevice.cpp b/acquisition_device/AcquisitionDevice.cpp index d9e8ed7c..dcbf9a2c 100644 --- a/acquisition_device/AcquisitionDevice.cpp +++ b/acquisition_device/AcquisitionDevice.cpp @@ -191,7 +191,7 @@ void AcquisitionDevice::InitializeROIMap(const DiffractionExperiment& experiment auto offset = experiment.GetFirstModuleOfDataStream(data_stream); size_t modules = experiment.GetModulesNum(data_stream); for (int m = 0; m < modules; m++) { - experiment.ExportROIMask(tmp.data(), offset + m); + experiment.ExportROIMap(tmp.data(), offset + m); InitializeROIMap(tmp.data(), m); } } diff --git a/acquisition_device/FPGAAcquisitionDevice.cpp b/acquisition_device/FPGAAcquisitionDevice.cpp index d6df274a..2e86f06e 100644 --- a/acquisition_device/FPGAAcquisitionDevice.cpp +++ b/acquisition_device/FPGAAcquisitionDevice.cpp @@ -179,39 +179,22 @@ void FPGAAcquisitionDevice::InitializeCalibration(const DiffractionExperiment &e } for (int s = 0; s < storage_cells; s++) { - auto mask = calib.CalculateMask(experiment, s); for (int m = 0; m < modules; m++) { - auto pedestal_g1 = calib.Pedestal(offset + m, 1, s).GetPedestal(); - for (int i = 0; i < RAW_MODULE_SIZE; i++) { - if (experiment.GetApplyPixelMaskInFPGA() && (mask[(offset + m) * RAW_MODULE_SIZE + i] != 0)) - buffer_device[0]->pixels[i] = 16384; - else - ((uint16_t *) buffer_device[0]->pixels)[i] = pedestal_g1[i]; - } + memcpy(buffer_device[0]->pixels, pedestal_g1, RAW_MODULE_SIZE * sizeof(uint16_t)); buffer_device[0]->module_statistics.module_number = m + modules * s; buffer_device[0]->module_statistics.load_calibration_destination = LOAD_CALIBRATION_DEST_PEDESTAL_G1; LoadCalibration(0); if (!experiment.IsFixedGainG1()) { auto pedestal_g0 = calib.Pedestal(offset + m, 0, s).GetPedestal(); - for (int i = 0; i < RAW_MODULE_SIZE; i++) { - if (experiment.GetApplyPixelMaskInFPGA() && (mask[(offset + m) * RAW_MODULE_SIZE + i] != 0)) - buffer_device[0]->pixels[i] = 16384; - else - ((uint16_t *) buffer_device[0]->pixels)[i] = pedestal_g0[i]; - } + memcpy(buffer_device[0]->pixels, pedestal_g0, RAW_MODULE_SIZE * sizeof(uint16_t)); buffer_device[0]->module_statistics.module_number = m + modules * s; buffer_device[0]->module_statistics.load_calibration_destination = LOAD_CALIBRATION_DEST_PEDESTAL_G0; LoadCalibration(0); auto pedestal_g2 = calib.Pedestal(offset + m, 2, s).GetPedestal(); - for (int i = 0; i < RAW_MODULE_SIZE; i++) { - if (experiment.GetApplyPixelMaskInFPGA() && (mask[(offset + m) * RAW_MODULE_SIZE + i] != 0)) - buffer_device[0]->pixels[i] = 16384; - else - ((uint16_t *) buffer_device[0]->pixels)[i] = pedestal_g2[i]; - } + memcpy(buffer_device[0]->pixels, pedestal_g2, RAW_MODULE_SIZE * sizeof(uint16_t)); buffer_device[0]->module_statistics.module_number = m + modules * s; buffer_device[0]->module_statistics.load_calibration_destination = LOAD_CALIBRATION_DEST_PEDESTAL_G2; LoadCalibration(0); diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 14fcf466..ea90e5a2 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -48,6 +48,7 @@ inline org::openapitools::server::model::Measurement_statistics Convert(const Me ret.setImagesExpected(input.images_expected); ret.setImagesCollected(input.images_collected); ret.setImagesSent(input.images_sent); + ret.setImagesDiscardedLossyCompression(input.images_skipped); ret.setMaxImageNumberSent(input.max_image_number_sent); if (input.collection_efficiency) ret.setCollectionEfficiency(input.collection_efficiency.value()); @@ -167,7 +168,7 @@ inline org::openapitools::server::model::Calibration_statistics_inner Convert(co org::openapitools::server::model::Calibration_statistics_inner output; output.setModuleNumber(input.module_number); - output.setMaskedPixels(input.masked_pixels); + output.setMaskedPixels(input.bad_pixels); output.setStorageCellNumber(input.storage_cell_number); output.setGainG0Mean(input.gain_g0_mean); output.setGainG1Mean(input.gain_g1_mean); diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 4a504217..24722579 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -406,6 +406,7 @@ void JFJochStateMachine::SetFullMeasurementOutput(const JFJochServicesOutput &ou tmp.collection_efficiency = output.receiver_output.efficiency; tmp.images_collected = output.receiver_output.status.images_collected; tmp.images_sent = output.receiver_output.status.images_sent; + tmp.images_skipped = output.receiver_output.status.images_skipped; tmp.cancelled = output.receiver_output.status.cancelled; tmp.max_image_number_sent = output.receiver_output.status.max_image_number_sent; tmp.max_receive_delay = output.receiver_output.status.max_receive_delay; diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index 69f90e4d..83e318aa 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -13,7 +13,7 @@ #include "../common/Logger.h" #include "JFJochServices.h" -#include "../common/ROIMask.h" +#include "../common/ROIMap.h" enum class JFJochState {Inactive, Idle, Measuring, Error, Busy, Pedestal}; @@ -40,6 +40,7 @@ struct MeasurementStatistics { int64_t images_expected; int64_t images_collected; int64_t images_sent; + int64_t images_skipped; int64_t max_image_number_sent; std::optional collection_efficiency; std::optional compression_ratio; diff --git a/broker/gen/model/Measurement_statistics.cpp b/broker/gen/model/Measurement_statistics.cpp index c4ef1e93..aa056adf 100644 --- a/broker/gen/model/Measurement_statistics.cpp +++ b/broker/gen/model/Measurement_statistics.cpp @@ -29,6 +29,8 @@ Measurement_statistics::Measurement_statistics() m_Images_collectedIsSet = false; m_Images_sent = 0L; m_Images_sentIsSet = false; + m_Images_discarded_lossy_compression = 0L; + m_Images_discarded_lossy_compressionIsSet = false; m_Max_image_number_sent = 0L; m_Max_image_number_sentIsSet = false; m_Collection_efficiency = 0.0f; @@ -75,7 +77,7 @@ bool Measurement_statistics::validate(std::stringstream& msg, const std::string& bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Measurement_statistics" : pathPrefix; - + if (collectionEfficiencyIsSet()) { const float& value = m_Collection_efficiency; @@ -130,6 +132,9 @@ bool Measurement_statistics::operator==(const Measurement_statistics& rhs) const ((!imagesSentIsSet() && !rhs.imagesSentIsSet()) || (imagesSentIsSet() && rhs.imagesSentIsSet() && getImagesSent() == rhs.getImagesSent())) && + ((!imagesDiscardedLossyCompressionIsSet() && !rhs.imagesDiscardedLossyCompressionIsSet()) || (imagesDiscardedLossyCompressionIsSet() && rhs.imagesDiscardedLossyCompressionIsSet() && getImagesDiscardedLossyCompression() == rhs.getImagesDiscardedLossyCompression())) && + + ((!maxImageNumberSentIsSet() && !rhs.maxImageNumberSentIsSet()) || (maxImageNumberSentIsSet() && rhs.maxImageNumberSentIsSet() && getMaxImageNumberSent() == rhs.getMaxImageNumberSent())) && @@ -184,6 +189,8 @@ void to_json(nlohmann::json& j, const Measurement_statistics& o) j["images_collected"] = o.m_Images_collected; if(o.imagesSentIsSet()) j["images_sent"] = o.m_Images_sent; + if(o.imagesDiscardedLossyCompressionIsSet()) + j["images_discarded_lossy_compression"] = o.m_Images_discarded_lossy_compression; if(o.maxImageNumberSentIsSet()) j["max_image_number_sent"] = o.m_Max_image_number_sent; if(o.collectionEfficiencyIsSet()) @@ -233,6 +240,11 @@ void from_json(const nlohmann::json& j, Measurement_statistics& o) j.at("images_sent").get_to(o.m_Images_sent); o.m_Images_sentIsSet = true; } + if(j.find("images_discarded_lossy_compression") != j.end()) + { + j.at("images_discarded_lossy_compression").get_to(o.m_Images_discarded_lossy_compression); + o.m_Images_discarded_lossy_compressionIsSet = true; + } if(j.find("max_image_number_sent") != j.end()) { j.at("max_image_number_sent").get_to(o.m_Max_image_number_sent); @@ -364,6 +376,23 @@ void Measurement_statistics::unsetImages_sent() { m_Images_sentIsSet = false; } +int64_t Measurement_statistics::getImagesDiscardedLossyCompression() const +{ + return m_Images_discarded_lossy_compression; +} +void Measurement_statistics::setImagesDiscardedLossyCompression(int64_t const value) +{ + m_Images_discarded_lossy_compression = value; + m_Images_discarded_lossy_compressionIsSet = true; +} +bool Measurement_statistics::imagesDiscardedLossyCompressionIsSet() const +{ + return m_Images_discarded_lossy_compressionIsSet; +} +void Measurement_statistics::unsetImages_discarded_lossy_compression() +{ + m_Images_discarded_lossy_compressionIsSet = false; +} int64_t Measurement_statistics::getMaxImageNumberSent() const { return m_Max_image_number_sent; diff --git a/broker/gen/model/Measurement_statistics.h b/broker/gen/model/Measurement_statistics.h index 2bf3c711..d2b7d701 100644 --- a/broker/gen/model/Measurement_statistics.h +++ b/broker/gen/model/Measurement_statistics.h @@ -73,20 +73,27 @@ public: bool imagesExpectedIsSet() const; void unsetImages_expected(); /// - /// + /// Images collected by the receiver. This number will be lower than images expected if there were issues with data collection performance. /// int64_t getImagesCollected() const; void setImagesCollected(int64_t const value); bool imagesCollectedIsSet() const; void unsetImages_collected(); /// - /// + /// Images sent to the writer. The value does not include images discarded by lossy compression filter and images not forwarded due to full ZeroMQ queue. /// int64_t getImagesSent() const; void setImagesSent(int64_t const value); bool imagesSentIsSet() const; void unsetImages_sent(); /// + /// Images discarded by the lossy compression filter + /// + int64_t getImagesDiscardedLossyCompression() const; + void setImagesDiscardedLossyCompression(int64_t const value); + bool imagesDiscardedLossyCompressionIsSet() const; + void unsetImages_discarded_lossy_compression(); + /// /// /// int64_t getMaxImageNumberSent() const; @@ -182,6 +189,8 @@ protected: bool m_Images_collectedIsSet; int64_t m_Images_sent; bool m_Images_sentIsSet; + int64_t m_Images_discarded_lossy_compression; + bool m_Images_discarded_lossy_compressionIsSet; int64_t m_Max_image_number_sent; bool m_Max_image_number_sentIsSet; float m_Collection_efficiency; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 7c93bf3c..38492b4e 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -457,9 +457,18 @@ components: images_collected: type: integer format: int64 + description: | + Images collected by the receiver. This number will be lower than images expected if there were issues with data collection performance. images_sent: type: integer format: int64 + description: | + Images sent to the writer. + The value does not include images discarded by lossy compression filter and images not forwarded due to full ZeroMQ queue. + images_discarded_lossy_compression: + type: integer + format: int64 + description: Images discarded by the lossy compression filter max_image_number_sent: type: integer format: int64 diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 00b66ef9..46107175 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -739,7 +739,7 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

Everything OK

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0.1,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0.1,
  • "beam_center_drift_x_pxl": 0.1,
  • "beam_center_drift_y_pxl": 0.1
}

Get calibration statistics

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "images_discarded_lossy_compression": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0.1,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0.1,
  • "beam_center_drift_x_pxl": 0.1,
  • "beam_center_drift_y_pxl": 0.1
}

Get calibration statistics

Statistics are provided for each module/storage cell separately

Responses