DiffractionExperiment: Adjust storage cell delay as a parameter

This commit is contained in:
2023-07-04 20:58:48 +02:00
parent 3067604e2a
commit 4ce2fcf98f
13 changed files with 205 additions and 118 deletions
+16 -3
View File
@@ -78,7 +78,7 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
internal.set_storage_cells(1);
internal.set_storage_cell_start(15);
internal.set_storage_cell_delay_ns(10*1000);
Detector(det_setup);
Mode(DetectorMode::Conversion);
}
@@ -854,7 +854,7 @@ DiffractionExperiment::operator JFJochProtoBuf::DetectorInput() const {
}
ret.set_storage_cell_start(GetStorageCellStart());
ret.set_storage_cell_number(GetStorageCellNumber());
ret.set_storage_cell_delay(7.5);
ret.set_storage_cell_delay_ns(GetStorageCellDelay().count());
if (GetStorageCellNumber() > 1) {
ret.set_period_us((GetFrameTime().count() +10) * GetStorageCellNumber());
@@ -955,7 +955,8 @@ void DiffractionExperiment::LoadDetectorSettings(const JFJochProtoBuf::DetectorS
if (settings.has_pedestal_g2_frames())
PedestalG2Frames(settings.pedestal_g2_frames());
if (settings.has_storage_cell_delay_ns())
StorageCellDelay(std::chrono::nanoseconds(settings.storage_cell_delay_ns()));
ConversionOnCPU(settings.conversion_on_cpu());
} catch (...) {
internal = tmp;
@@ -973,6 +974,7 @@ JFJochProtoBuf::DetectorSettings DiffractionExperiment::GetDetectorSettings() co
ret.set_pedestal_g0_frames(GetPedestalG0Frames());
ret.set_pedestal_g1_frames(GetPedestalG1Frames());
ret.set_pedestal_g2_frames(GetPedestalG2Frames());
ret.set_storage_cell_delay_ns(GetStorageCellDelay().count());
return ret;
}
@@ -1052,6 +1054,7 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
message.compression_block_size = JFJochBitShuffleCompressor::DefaultBlockSize;
message.pixel_bit_depth = GetPixelDepth() * 8;
message.storage_cell_number = GetStorageCellNumber();
message.storage_cell_delay_ns = GetStorageCellDelay().count();
message.file_prefix = GetFilePrefix();
message.pixel_signed = IsPixelSigned();
message.sample_name = GetSampleName();
@@ -1241,3 +1244,13 @@ bool DiffractionExperiment::GetSaveCalibration() const {
return dataset.save_calibration();
}
DiffractionExperiment &DiffractionExperiment::StorageCellDelay(std::chrono::nanoseconds input) {
check_min("Storage cell delay [ns]", input.count(), MIN_STORAGE_CELL_DELAY_IN_NS);
internal.set_storage_cell_delay_ns(input.count());
return *this;
}
std::chrono::nanoseconds DiffractionExperiment::GetStorageCellDelay() const {
return std::chrono::nanoseconds(internal.storage_cell_delay_ns());
}