Updates March 2023
This commit is contained in:
@@ -7,38 +7,6 @@
|
||||
|
||||
#define STORAGE_CELL_FOR_TEST 11
|
||||
|
||||
JFJochReceiverOutput RunJFJochReceiverTest(AcquisitionDeviceGroup &aq_devices, ImagePusher &pusher,
|
||||
const DiffractionExperiment &x,
|
||||
Logger &logger, JFCalibration &calib,
|
||||
uint16_t nthreads, bool abort,
|
||||
ZMQStream2PreviewPublisher *in_preview_writer,
|
||||
const std::string &numa_policy) {
|
||||
ZMQContext context;
|
||||
context.NumThreads(4);
|
||||
|
||||
JFJochReceiverService service(aq_devices, logger, pusher);
|
||||
service.PreviewPublisher(in_preview_writer).NumThreads(nthreads).NUMAPolicy(numa_policy);
|
||||
|
||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||
settings.signal_to_noise_threshold = 2.5;
|
||||
settings.photon_count_threshold = 5;
|
||||
settings.min_pix_per_spot = 1;
|
||||
settings.max_pix_per_spot = 200;
|
||||
service.SetSpotFindingSettings(settings);
|
||||
|
||||
service.Start(x, &calib);
|
||||
|
||||
if (x.GetImageNum() > 0) {
|
||||
// Initial communication
|
||||
if (abort) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(60));
|
||||
service.Cancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
return service.Stop();
|
||||
}
|
||||
|
||||
static JFCalibration GeneratePedestalCalibration(const DiffractionExperiment &x) {
|
||||
JFCalibration ret(x);
|
||||
|
||||
@@ -66,7 +34,7 @@ static JFCalibration GeneratePedestalCalibration(const DiffractionExperiment &x)
|
||||
|
||||
bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
||||
AcquisitionDeviceGroup &aq_devices, const DiffractionExperiment &x,
|
||||
uint16_t nthreads, bool abort,
|
||||
uint16_t nthreads,
|
||||
ZMQStream2PreviewPublisher *in_preview_writer,
|
||||
const std::string &numa_policy) {
|
||||
|
||||
@@ -75,38 +43,16 @@ bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
||||
for (int i = 0; i < raw_expected_image.size(); i++)
|
||||
raw_expected_image[i] = i % 65536;
|
||||
|
||||
return JFJochReceiverTest(output, logger, aq_devices, x,
|
||||
raw_expected_image, nthreads, abort,
|
||||
in_preview_writer, numa_policy);
|
||||
return JFJochReceiverTest(output, logger, aq_devices, x, raw_expected_image, nthreads, in_preview_writer, numa_policy);
|
||||
}
|
||||
|
||||
bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
||||
AcquisitionDeviceGroup &aq_devices, const DiffractionExperiment &x,
|
||||
const std::vector<uint16_t> &raw_expected_image,
|
||||
uint16_t nthreads, bool abort,
|
||||
uint16_t nthreads,
|
||||
ZMQStream2PreviewPublisher *in_preview_writer,
|
||||
const std::string &numa_policy) {
|
||||
|
||||
if (raw_expected_image.size() != RAW_MODULE_SIZE * x.GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Size of input array with raw expected image is wrong");
|
||||
|
||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||
uint32_t module0 = x.GetFirstModuleOfDataStream(i);
|
||||
|
||||
if (x.GetDetectorSetup().GetDetectorType() == DetectorType::JUNGFRAU) {
|
||||
for (int m = 0; m < x.GetModulesNum(i); m++)
|
||||
aq_devices[i].SetInternalGeneratorFrame(raw_expected_image.data() + (module0 + m) * RAW_MODULE_SIZE, m);
|
||||
} else if (x.GetDetectorSetup().GetDetectorType() == DetectorType::EIGER) {
|
||||
std::vector<uint16_t> tmp(RAW_MODULE_SIZE);
|
||||
for (int m = 0; m < x.GetModulesNum(i); m++) {
|
||||
RawToEigerInput(tmp.data(), raw_expected_image.data() + (module0 + m) * RAW_MODULE_SIZE);
|
||||
aq_devices[i].SetInternalGeneratorFrame(tmp.data(), m);
|
||||
}
|
||||
} else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Detector not supported");
|
||||
}
|
||||
|
||||
JFCalibration calib = GeneratePedestalCalibration(x);
|
||||
|
||||
int64_t image_number = x.GetImageNum() - 1;
|
||||
@@ -118,12 +64,23 @@ bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
||||
|
||||
TestImagePusher pusher(image_number);
|
||||
|
||||
output = RunJFJochReceiverTest(aq_devices, pusher, x, logger, calib, nthreads, abort,
|
||||
in_preview_writer, numa_policy);
|
||||
JFJochReceiverService service(aq_devices, logger, pusher);
|
||||
service.PreviewPublisher(in_preview_writer).NumThreads(nthreads).NUMAPolicy(numa_policy);
|
||||
service.LoadInternalGeneratorImage(x, raw_expected_image, 0);
|
||||
|
||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||
settings.signal_to_noise_threshold = 2.5;
|
||||
settings.photon_count_threshold = 5;
|
||||
settings.min_pix_per_spot = 1;
|
||||
settings.max_pix_per_spot = 200;
|
||||
service.SetSpotFindingSettings(settings);
|
||||
|
||||
service.Start(x, &calib);
|
||||
output = service.Stop();
|
||||
|
||||
bool no_errors = true;
|
||||
|
||||
if ((x.GetImageNum() > 0) && (!abort)) {
|
||||
if (x.GetImageNum() > 0) {
|
||||
no_errors = pusher.CheckImage(x, raw_expected_image, calib, logger);
|
||||
|
||||
if (output.efficiency != 1.0) {
|
||||
|
||||
Reference in New Issue
Block a user