From db5ee64f7458e6b6ba59116f9c050b4958b00db5 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Wed, 27 Nov 2024 16:27:41 +0100 Subject: [PATCH] version 1.0.0-rc.26 minor fixes --- common/AutoIncrVector.h | 1 + docs/JFJOCH_WRITER.md | 50 ++++++++++++++++++++++++++++---- writer/HDF5DataFilePluginROI.cpp | 5 +++- writer/HDF5DataFilePluginROI.h | 6 ++-- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/common/AutoIncrVector.h b/common/AutoIncrVector.h index 8fa3d2c8..183a893d 100644 --- a/common/AutoIncrVector.h +++ b/common/AutoIncrVector.h @@ -4,6 +4,7 @@ #ifndef JFJOCH_AUTOINCRVECTOR_H #define JFJOCH_AUTOINCRVECTOR_H +#include #include "JFJochException.h" template diff --git a/docs/JFJOCH_WRITER.md b/docs/JFJOCH_WRITER.md index 108ba377..13ffdb08 100644 --- a/docs/JFJOCH_WRITER.md +++ b/docs/JFJOCH_WRITER.md @@ -17,10 +17,12 @@ Writer needs to be started as a background service, with the following command: jfjoch_writer {options}
Options: +-R | --root_dir= Root directory for file writing -H | --http_port= HTTP port for statistics -r | --zmq_repub_port= ZeroMQ port for PUSH socket to republish images -f | --zmq_file_port= ZeroMQ port for PUB socket for notifications on finalized files - +-w | --rcv_watermark= Receiving ZeroMQ socket watermark (default = 100) +-W | --repub_watermark= Republish ZeroMQ socket watermark (default = 1000) ``` for example: ``` @@ -111,14 +113,50 @@ For example `header_appendix` of `{"param1": "test1", "param2": ["test1", "test2 Notifications for finalized files are optional, if notification port number is omitted this functionality is not enabled. -## NXmx extensions -Jungfraujoch aims to generate files compliant with NXmx format, as well as make them as close as possible to files -written by DECTRIS Filewriter. This ensures the file compatibility of Neggia and Durin XDS plugins, as well as Albula viewer. +## HDF5 file structure +Jungfraujoch aims to generate files compliant with NXmx format, as well as make them as close as possible to files +written by DECTRIS Filewriter. This ensures the file compatibility of Neggia and Durin XDS plugins, as well as Albula viewer. + +### Master file + +There are custom extension to NXmx format. These will be documented in the future. + +Specifically, if data collection was configured with `header_appendix` having key equal to `hdf5` and value as JSON +object with number and string values. These will be added to `/entry/user`. + +### Data file + +Data file has the following structure: + +| Location | Description | Optional | +|------------------------------------|----------------------------------------------------------------------------------------------------------------------|:--------:| +| /entry/data/data | Images | | +| /entry/detector/timestamp | Timestamp of the image | | +| /entry/detector/exptime | Exposure time of the image | | +| /entry/detector/number | Image number; if image rejection was used this will be the original image number | | +| /entry/azint/bin_to_q | Azimuthal integration - bin-to-Q mapping | X | +| /entry/azint/image | Azimuthal integration - per image | X | +| /entry/bkg_estimate | Background estimate table | X | +| /entry/MX/peakXPosRaw | Peak position X (see [CXI format](https://raw.githubusercontent.com/cxidb/CXI/master/cxi_file_format.pdf)) | X | +| /entry/MX/peakYPosRaw | Peak position Y (see [CXI format](https://raw.githubusercontent.com/cxidb/CXI/master/cxi_file_format.pdf)) | X | +| /entry/MX/peakTotalIntensity | Peak total intensity (see [CXI format](https://raw.githubusercontent.com/cxidb/CXI/master/cxi_file_format.pdf)) | X | +| /entry/MX/nPeaks | Number of peaks per image (see [CXI format](https://raw.githubusercontent.com/cxidb/CXI/master/cxi_file_format.pdf)) | X | +| /entry/MX/strongPixels | Number of strong pixel per image | X | +| /entry/MX/nPeaksRingFiltered | Number of peaks not belonging to rings | X | +| /entry/MX/imageIndexed | Image is successfully indexed | X | +| /entry/MX/latticeIndexed | Crystal lattice for the image, assuming it is indexed | X | +| /entry/jungfrau/info | Debug field of the JF detector | X | +| /entry/jungfrau/storageCell | Storage cell number | X | +| /entry/jungfrau/rcvDelay | Receiver delay for the image (Jungfraujoch debugging) | X | +| /entry/jungfrau/rcvFreeSendBuffers | Receiver number of free send buffers at the time of sending the image (Jungfraujoch debugging) | X | +| /entry/roi/{roi_name}/max | Max pixel value for roi named {roi_name} | X | +| /entry/roi/{roi_name}/sum | Sum pixel value for roi named {roi_name} | X | +| /entry/roi/{roi_name}/npixel | Number of valid pixel for roi named {roi_name} | X | +| /entry/xfel/pulseID | Pulse ID (for XFEL only) | X | +| /entry/xfel/eventCode | Event code (for XFEL only) | X | If spot finding is enabled, spots are written in the [CXI format](https://raw.githubusercontent.com/cxidb/CXI/master/cxi_file_format.pdf) and are recognized by CrystFEL. The following has to be added to the CrystFEL geometry file: ``` peak_list = /opt/MX peak_list_type = cxi ``` - -There are custom extension to NXmx format. These will be documented in the future. \ No newline at end of file diff --git a/writer/HDF5DataFilePluginROI.cpp b/writer/HDF5DataFilePluginROI.cpp index a0d75f94..1c9a1d46 100644 --- a/writer/HDF5DataFilePluginROI.cpp +++ b/writer/HDF5DataFilePluginROI.cpp @@ -9,12 +9,14 @@ void HDF5DataFilePluginROI::OpenFile(HDF5File &data_file, const DataMessage &msg void HDF5DataFilePluginROI::Write(const DataMessage &msg, uint64_t image_number) { for (const auto &r: msg.roi) { - if (roi_data.find(r.first) != roi_data.end()) { + if (roi_data.contains(r.first)) { roi_data[r.first].max.reserve(RESERVE_IMAGES); roi_data[r.first].sum.reserve(RESERVE_IMAGES); + roi_data[r.first].npixel.reserve(RESERVE_IMAGES); } roi_data[r.first].max[image_number] = r.second.max_count; roi_data[r.first].sum[image_number] = r.second.sum; + roi_data[r.first].npixel[image_number] = r.second.pixels; } } @@ -29,5 +31,6 @@ void HDF5DataFilePluginROI::WriteFinal(HDF5File &data_file) { HDF5Group group_roi(data_file, "/entry/roi/" + r.first); group.SaveVector("max", r.second.max.vec()); group.SaveVector("sum", r.second.sum.vec()); + group.SaveVector("npixel", r.second.npixel.vec()); } } diff --git a/writer/HDF5DataFilePluginROI.h b/writer/HDF5DataFilePluginROI.h index 8701daa5..c52adfeb 100644 --- a/writer/HDF5DataFilePluginROI.h +++ b/writer/HDF5DataFilePluginROI.h @@ -5,13 +5,13 @@ #define JFJOCH_HDF5DATAFILEPLUGINROI_H #include -#include #include "../common/AutoIncrVector.h" #include "HDF5DataFilePlugin.h" struct ROIData { - AutoIncrVector max; - AutoIncrVector sum; + AutoIncrVector max; + AutoIncrVector sum; + AutoIncrVector npixel; }; class HDF5DataFilePluginROI : public HDF5DataFilePlugin {