diff --git a/acquisition_device/HLSSimulatedDevice.cpp b/acquisition_device/HLSSimulatedDevice.cpp index 3433498e..ded0064d 100644 --- a/acquisition_device/HLSSimulatedDevice.cpp +++ b/acquisition_device/HLSSimulatedDevice.cpp @@ -309,8 +309,10 @@ void HLSSimulatedDevice::HLSMainThread() { hls::stream> spot_finder_result_0; hls::stream> spot_finder_result_1; - hls::stream> spot_finder_conn_0; - hls::stream> spot_finder_result_2; + hls::stream> spot_finder_conn_0; + hls::stream> spot_finder_result_2; + hls::stream> spot_finder_result_3; + hls::stream> spot_finder_mask_0; hls::stream> roi_calc_result_0; @@ -545,6 +547,11 @@ void HLSSimulatedDevice::HLSMainThread() { logger_hls.Info("spot_finder_merge done"); }); + hls_cores.emplace_back([&] { + axis_32_to_512(spot_finder_result_2, spot_finder_result_3); + logger_hls.Info("axis_32_to_512 done"); + }); + hls_cores.emplace_back([&] { roi_calc(stream_768_4, stream_768_5, @@ -563,7 +570,7 @@ void HLSSimulatedDevice::HLSMainThread() { // 11. Prepare data to write to host memory hls_cores.emplace_back([&] { ap_uint<3> state; - host_writer(data_12, adu_histo_result, integration_result_1, spot_finder_result_2, roi_calc_result_0, + host_writer(data_12, adu_histo_result, integration_result_1, spot_finder_result_3, roi_calc_result_0, axi_compl[11], datamover_out.GetDataStream(), datamover_out.GetCtrlStream(), work_request_stream, completion_stream, dma_address_table.data(), packets_processed, host_writer_idle, cancel_data_collection, state); diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index ff842e13..7d7171c4 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -363,7 +363,6 @@ inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_s ret.PhotonEnergyMultiplayer(input.getPhotonEnergyMultiplier()); ret.FilePrefix(input.getFilePrefix()); - ret.DataFileCount(input.getDataFileCount()); if (!input.compressionIsSet()) ret.Compression(CompressionAlgorithm::BSHUF_LZ4); @@ -410,6 +409,7 @@ inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_s ret.HeaderAppendix(input.getHeaderAppendix()); ret.ImageAppendix(input.getImageAppendix()); ret.SaveCalibration(input.isSaveCalibration()); + ret.ImagesPerFile(input.getImagesPerFile()); return ret; } diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 6d62cfb3..89aa6c0d 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -34,6 +34,19 @@ inline int64_t GET_I64(const nlohmann::json &j, const std::string& tag, int64_t return def; } +inline int32_t GET_I32(const nlohmann::json &j, const std::string& tag, int32_t def) { + if (j.contains(tag)) { + if (!j[tag].is_number_integer()) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer"); + try { + return j[tag].get(); + } catch (std::exception &e) { + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what()); + } + } else + return def; +} + inline float GET_FLOAT(const nlohmann::json &j, const std::string& tag, float def) { if (j.contains(tag)) { if (!j[tag].is_number()) @@ -353,3 +366,7 @@ std::string ParseString(const nlohmann::json &input, const std::string& tag) { int64_t ParseInt64(const nlohmann::json &input, const std::string& tag, int64_t def) { return GET_I64(input, tag, def); } + +int32_t ParseInt32(const nlohmann::json &input, const std::string& tag, int32_t def) { + return GET_I32(input, tag, def); +} diff --git a/broker/JFJochBrokerParser.h b/broker/JFJochBrokerParser.h index 4fa7bd4d..8315c3e6 100644 --- a/broker/JFJochBrokerParser.h +++ b/broker/JFJochBrokerParser.h @@ -20,5 +20,6 @@ void ParseAcquisitionDeviceGroup(const nlohmann::json &input, const std::string& std::vector ParseStringArray(const nlohmann::json &input, const std::string& tag); std::string ParseString(const nlohmann::json &input, const std::string& tag); int64_t ParseInt64(const nlohmann::json &input, const std::string& tag, int64_t def); +int32_t ParseInt32(const nlohmann::json &input, const std::string& tag, int32_t def); #endif //JUNGFRAUJOCH_JFJOCHBROKERPARSER_H diff --git a/broker/gen/model/Dataset_settings.cpp b/broker/gen/model/Dataset_settings.cpp index 9502252d..9efe9527 100644 --- a/broker/gen/model/Dataset_settings.cpp +++ b/broker/gen/model/Dataset_settings.cpp @@ -33,8 +33,8 @@ Dataset_settings::Dataset_settings() m_Photon_energy_keV = 0.0f; m_File_prefix = ""; m_File_prefixIsSet = false; - m_Data_file_count = 1L; - m_Data_file_countIsSet = false; + m_Images_per_file = 1000L; + m_Images_per_fileIsSet = false; m_Space_group_number = 0L; m_Space_group_numberIsSet = false; m_Sample_name = ""; @@ -154,16 +154,16 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP } - if (dataFileCountIsSet()) + if (imagesPerFileIsSet()) { - const int64_t& value = m_Data_file_count; - const std::string currentValuePath = _pathPrefix + ".dataFileCount"; + const int64_t& value = m_Images_per_file; + const std::string currentValuePath = _pathPrefix + ".imagesPerFile"; - if (value < 1ll) + if (value < 0ll) { success = false; - msg << currentValuePath << ": must be greater than or equal to 1;"; + msg << currentValuePath << ": must be greater than or equal to 0;"; } } @@ -258,7 +258,7 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const ((!filePrefixIsSet() && !rhs.filePrefixIsSet()) || (filePrefixIsSet() && rhs.filePrefixIsSet() && getFilePrefix() == rhs.getFilePrefix())) && - ((!dataFileCountIsSet() && !rhs.dataFileCountIsSet()) || (dataFileCountIsSet() && rhs.dataFileCountIsSet() && getDataFileCount() == rhs.getDataFileCount())) && + ((!imagesPerFileIsSet() && !rhs.imagesPerFileIsSet()) || (imagesPerFileIsSet() && rhs.imagesPerFileIsSet() && getImagesPerFile() == rhs.getImagesPerFile())) && ((!spaceGroupNumberIsSet() && !rhs.spaceGroupNumberIsSet()) || (spaceGroupNumberIsSet() && rhs.spaceGroupNumberIsSet() && getSpaceGroupNumber() == rhs.getSpaceGroupNumber())) && @@ -319,8 +319,8 @@ void to_json(nlohmann::json& j, const Dataset_settings& o) j["photon_energy_keV"] = o.m_Photon_energy_keV; if(o.filePrefixIsSet()) j["file_prefix"] = o.m_File_prefix; - if(o.dataFileCountIsSet()) - j["data_file_count"] = o.m_Data_file_count; + if(o.imagesPerFileIsSet()) + j["images_per_file"] = o.m_Images_per_file; if(o.spaceGroupNumberIsSet()) j["space_group_number"] = o.m_Space_group_number; j["sample_name"] = o.m_Sample_name; @@ -373,10 +373,10 @@ void from_json(const nlohmann::json& j, Dataset_settings& o) j.at("file_prefix").get_to(o.m_File_prefix); o.m_File_prefixIsSet = true; } - if(j.find("data_file_count") != j.end()) + if(j.find("images_per_file") != j.end()) { - j.at("data_file_count").get_to(o.m_Data_file_count); - o.m_Data_file_countIsSet = true; + j.at("images_per_file").get_to(o.m_Images_per_file); + o.m_Images_per_fileIsSet = true; } if(j.find("space_group_number") != j.end()) { @@ -537,22 +537,22 @@ void Dataset_settings::unsetFile_prefix() { m_File_prefixIsSet = false; } -int64_t Dataset_settings::getDataFileCount() const +int64_t Dataset_settings::getImagesPerFile() const { - return m_Data_file_count; + return m_Images_per_file; } -void Dataset_settings::setDataFileCount(int64_t const value) +void Dataset_settings::setImagesPerFile(int64_t const value) { - m_Data_file_count = value; - m_Data_file_countIsSet = true; + m_Images_per_file = value; + m_Images_per_fileIsSet = true; } -bool Dataset_settings::dataFileCountIsSet() const +bool Dataset_settings::imagesPerFileIsSet() const { - return m_Data_file_countIsSet; + return m_Images_per_fileIsSet; } -void Dataset_settings::unsetData_file_count() +void Dataset_settings::unsetImages_per_file() { - m_Data_file_countIsSet = false; + m_Images_per_fileIsSet = false; } int64_t Dataset_settings::getSpaceGroupNumber() const { diff --git a/broker/gen/model/Dataset_settings.h b/broker/gen/model/Dataset_settings.h index 697071fc..87a24421 100644 --- a/broker/gen/model/Dataset_settings.h +++ b/broker/gen/model/Dataset_settings.h @@ -109,12 +109,12 @@ public: bool filePrefixIsSet() const; void unsetFile_prefix(); /// - /// Number of round-robin data files + /// Number of files in a single HDF5 data file (0 = write all images to a single data file). /// - int64_t getDataFileCount() const; - void setDataFileCount(int64_t const value); - bool dataFileCountIsSet() const; - void unsetData_file_count(); + int64_t getImagesPerFile() const; + void setImagesPerFile(int64_t const value); + bool imagesPerFileIsSet() const; + void unsetImages_per_file(); /// /// /// @@ -217,8 +217,8 @@ protected: std::string m_File_prefix; bool m_File_prefixIsSet; - int64_t m_Data_file_count; - bool m_Data_file_countIsSet; + int64_t m_Images_per_file; + bool m_Images_per_fileIsSet; int64_t m_Space_group_number; bool m_Space_group_numberIsSet; std::string m_Sample_name; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 572ead97..8cd7d170 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -94,12 +94,12 @@ components: type: string default: "" description: Prefix for filenames. If left empty, no file will be saved. - data_file_count: + images_per_file: type: integer format: int64 - minimum: 1 - default: 1 - description: Number of round-robin data files + minimum: 0 + default: 1000 + description: Number of files in a single HDF5 data file (0 = write all images to a single data file). space_group_number: type: integer format: int64 diff --git a/broker/jfjoch_broker.cpp b/broker/jfjoch_broker.cpp index 47aee013..b93d84a7 100644 --- a/broker/jfjoch_broker.cpp +++ b/broker/jfjoch_broker.cpp @@ -82,7 +82,14 @@ int main (int argc, char **argv) { ParseAcquisitionDeviceGroup(input, "receiver", aq_devices); if (aq_devices.size() > 0) { experiment.DataStreams(aq_devices.size()); - image_pusher = std::make_unique(context, ParseStringArray(input, "zmq_image_addr")); + + int32_t zmq_send_watermark = ParseInt32(input, "zmq_send_watermark", 100); + int32_t zmq_send_buffer_size = ParseInt32(input, "zmq_send_buffer_size", -1); + + image_pusher = std::make_unique(ParseStringArray(input, "zmq_image_addr"), + zmq_send_watermark, + zmq_send_buffer_size); + receiver = std::make_unique(aq_devices, logger, *image_pusher); std::string zmq_preview_addr = ParseString(input, "zmq_preview_addr"); diff --git a/broker/redoc-static.html b/broker/redoc-static.html index b472e899..b9960588 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -429,8 +429,8 @@ Incident photon energy in keV</p> Incident photon energy in keV

file_prefix
string
Default: ""

Prefix for filenames. If left empty, no file will be saved.

-
data_file_count
integer <int64> >= 1
Default: 1

Number of round-robin data files

+
images_per_file
integer <int64> >= 0
Default: 1000

Number of files in a single HDF5 data file (0 = write all images to a single data file).

space_group_number
integer <int64> [ 0 .. 194 ]
Default: 0
sample_name
required
string

/entry/sample/name in NXmx @@ -463,7 +463,7 @@ Transmission of attenuator (filter) [no units]

" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

Input parsing or validation error

Request samples

Content type
application/json
{
  • "images_per_trigger": 1,
  • "ntrigger": 1,
  • "summation": 1,
  • "beam_x_pxl": 0.1,
  • "beam_y_pxl": 0.1,
  • "detector_distance_mm": 0.1,
  • "photon_energy_keV": 0.1,
  • "file_prefix": "",
  • "data_file_count": 1,
  • "space_group_number": 0,
  • "sample_name": "string",
  • "save_calibration": false,
  • "fpga_output": "auto",
  • "compression": "bslz4",
  • "total_flux": 0.1,
  • "transmission": 1,
  • "omega": {
    },
  • "header_appendix": "string",
  • "image_appendix": "string",
  • "photon_energy_multiplier": 1,
  • "unit_cell": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Wait for acquisition done

Request samples

Content type
application/json
{
  • "images_per_trigger": 1,
  • "ntrigger": 1,
  • "summation": 1,
  • "beam_x_pxl": 0.1,
  • "beam_y_pxl": 0.1,
  • "detector_distance_mm": 0.1,
  • "photon_energy_keV": 0.1,
  • "file_prefix": "",
  • "images_per_file": 1000,
  • "space_group_number": 0,
  • "sample_name": "string",
  • "save_calibration": false,
  • "fpga_output": "auto",
  • "compression": "bslz4",
  • "total_flux": 0.1,
  • "transmission": 1,
  • "omega": {
    },
  • "header_appendix": "string",
  • "image_appendix": "string",
  • "photon_energy_multiplier": 1,
  • "unit_cell": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Wait for acquisition done

Block execution of external script till initialization, data collection or pedestal is finished. @@ -749,7 +749,7 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

No preview image recorded so far