DiffractionExperiment: Rename GetFPGAOutputDepth -> GetPixelDepth and GetFPGASummation -> GetSummation
This commit is contained in:
@@ -31,10 +31,6 @@ std::string DetectorSetup::GetDescription() const {
|
||||
return description;
|
||||
}
|
||||
|
||||
JFJochProtoBuf::DetectorType DetectorSetup::GetDetectorType() const {
|
||||
return JFJochProtoBuf::DetectorType::JUNGFRAU;
|
||||
}
|
||||
|
||||
float DetectorSetup::GetPixelSize_mm() const {
|
||||
return PIXEL_SIZE_IN_MM;
|
||||
}
|
||||
@@ -69,6 +65,5 @@ DetectorSetup::operator JFJochProtoBuf::Detector() const {
|
||||
ret.add_module_hostname(iter);
|
||||
|
||||
*ret.mutable_geometry() = geometry;
|
||||
ret.set_type(JFJochProtoBuf::DetectorType::JUNGFRAU);
|
||||
return ret;
|
||||
}
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
[[nodiscard]] const std::vector<std::string>& GetDetectorModuleHostname() const;
|
||||
[[nodiscard]] uint64_t GetModulesNum() const;
|
||||
[[nodiscard]] std::string GetDescription() const;
|
||||
[[nodiscard]] JFJochProtoBuf::DetectorType GetDetectorType() const;
|
||||
[[nodiscard]] float GetPixelSize_mm() const;
|
||||
[[nodiscard]] const std::vector<JFModuleGainCalibration> &GetGainCalibration() const;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
|
||||
|
||||
dataset.set_ntrigger(1);
|
||||
dataset.set_images_per_trigger(1);
|
||||
dataset.set_fpga_summation(1);
|
||||
dataset.set_summation(1);
|
||||
dataset.set_fpga_pixel_output(JFJochProtoBuf::AUTO);
|
||||
dataset.set_space_group_number(0); // not set
|
||||
|
||||
@@ -396,7 +396,7 @@ std::chrono::microseconds DiffractionExperiment::GetImageTime() const {
|
||||
return std::chrono::microseconds(internal.frame_time_pedestalg1g2_us());
|
||||
case DetectorMode::Conversion:
|
||||
case DetectorMode::Raw:
|
||||
return GetFrameTime() * GetFPGASummation();
|
||||
return GetFrameTime() * GetSummation();
|
||||
case DetectorMode::PedestalG0:
|
||||
default:
|
||||
return GetFrameTime();
|
||||
@@ -422,7 +422,7 @@ int64_t DiffractionExperiment::GetImageNumPerTrigger() const {
|
||||
case DetectorMode::Raw:
|
||||
if (GetStorageCellNumber() > 1)
|
||||
return GetStorageCellNumber();
|
||||
return GetFrameNumPerTrigger() / GetFPGASummation();
|
||||
return GetFrameNumPerTrigger() / GetSummation();
|
||||
case DetectorMode::PedestalG0:
|
||||
case DetectorMode::PedestalG1:
|
||||
case DetectorMode::PedestalG2:
|
||||
@@ -442,7 +442,7 @@ int64_t DiffractionExperiment::GetFrameNumPerTrigger() const {
|
||||
if (GetStorageCellNumber() > 1)
|
||||
return GetStorageCellNumber();
|
||||
else
|
||||
return dataset.images_per_trigger() * GetFPGASummation();
|
||||
return dataset.images_per_trigger() * GetSummation();
|
||||
case DetectorMode::PedestalG0:
|
||||
if (GetPedestalWithExternalTrigger())
|
||||
return GetStorageCellNumber();
|
||||
@@ -465,7 +465,7 @@ std::chrono::microseconds DiffractionExperiment::GetFrameCountTime() const {
|
||||
}
|
||||
|
||||
std::chrono::microseconds DiffractionExperiment::GetImageCountTime() const {
|
||||
return GetFrameCountTime() * GetFPGASummation();
|
||||
return GetFrameCountTime() * GetSummation();
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetPedestalG0Frames() const {
|
||||
@@ -536,11 +536,34 @@ CompressionAlgorithm DiffractionExperiment::GetCompressionAlgorithmEnum() const
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetPixelDepth() const {
|
||||
return GetFPGAOutputDepth();
|
||||
switch (GetFPGAOutputMode()) {
|
||||
case JFJochProtoBuf::INT16:
|
||||
case JFJochProtoBuf::UINT16:
|
||||
return 2;
|
||||
case JFJochProtoBuf::AUTO:
|
||||
if (GetSummation() > 2)
|
||||
return 4;
|
||||
else
|
||||
return 2;
|
||||
default:
|
||||
case JFJochProtoBuf::INT32:
|
||||
case JFJochProtoBuf::UINT32:
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::IsPixelSigned() const {
|
||||
return GetFPGAOutputSigned();
|
||||
switch (GetFPGAOutputMode()) {
|
||||
case JFJochProtoBuf::INT16:
|
||||
case JFJochProtoBuf::INT32:
|
||||
case JFJochProtoBuf::AUTO:
|
||||
return true;
|
||||
default:
|
||||
case JFJochProtoBuf::UINT16:
|
||||
case JFJochProtoBuf::UINT32:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetDataStreamsNum() const {
|
||||
@@ -726,10 +749,6 @@ float DiffractionExperiment::GetQSpacingForRadialInt_recipA() const {
|
||||
return internal.q_spacing();
|
||||
}
|
||||
|
||||
JFJochProtoBuf::DetectorType DiffractionExperiment::GetDetectorType() const {
|
||||
return internal.detector().type();
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetMaxSpotCount() const {
|
||||
return max_spot_count;
|
||||
}
|
||||
@@ -829,10 +848,10 @@ void DiffractionExperiment::LoadDatasetSettings(const JFJochProtoBuf::DatasetSet
|
||||
SampleName(settings.sample_name());
|
||||
Compression(settings.compression());
|
||||
SaveCalibration(settings.save_calibration());
|
||||
if (settings.fpga_summation() == 0)
|
||||
FPGASummation(1);
|
||||
if (settings.summation() == 0)
|
||||
Summation(1);
|
||||
else
|
||||
FPGASummation(settings.fpga_summation());
|
||||
Summation(settings.summation());
|
||||
FPGAOutputMode(settings.fpga_pixel_output());
|
||||
} catch (...) {
|
||||
dataset = tmp;
|
||||
@@ -973,7 +992,7 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
|
||||
message.instrument_name = GetInstrumentName();
|
||||
message.instrument_name_short = GetInstrumentNameShort();
|
||||
message.summation = GetFPGASummation();
|
||||
message.summation = GetSummation();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplyPixelMaskInFPGA(bool input) {
|
||||
@@ -1101,14 +1120,14 @@ std::chrono::nanoseconds DiffractionExperiment::GetStorageCellDelay() const {
|
||||
return std::chrono::nanoseconds(internal.storage_cell_delay_ns());
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::FPGASummation(int64_t input) {
|
||||
DiffractionExperiment &DiffractionExperiment::Summation(int64_t input) {
|
||||
check_min("Summation", input, 1);
|
||||
check_max("Summation", input, MAX_FPGA_SUMMATION);
|
||||
dataset.set_fpga_summation(input);
|
||||
dataset.set_summation(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetFPGASummation() const {
|
||||
int64_t DiffractionExperiment::GetSummation() const {
|
||||
switch (GetDetectorMode()) {
|
||||
case DetectorMode::PedestalG0:
|
||||
case DetectorMode::PedestalG1:
|
||||
@@ -1118,7 +1137,7 @@ int64_t DiffractionExperiment::GetFPGASummation() const {
|
||||
case DetectorMode::Conversion:
|
||||
case DetectorMode::Raw:
|
||||
// FPGA summation for raw data makes zero sense - but it is still available as a means for debug, etc.
|
||||
return dataset.fpga_summation();
|
||||
return dataset.summation();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1128,36 +1147,6 @@ DiffractionExperiment &DiffractionExperiment::FPGAOutputMode(const JFJochProtoBu
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetFPGAOutputSigned() const {
|
||||
switch (GetFPGAOutputMode()) {
|
||||
case JFJochProtoBuf::INT16:
|
||||
case JFJochProtoBuf::INT32:
|
||||
case JFJochProtoBuf::AUTO:
|
||||
return true;
|
||||
default:
|
||||
case JFJochProtoBuf::UINT16:
|
||||
case JFJochProtoBuf::UINT32:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetFPGAOutputDepth() const {
|
||||
switch (GetFPGAOutputMode()) {
|
||||
case JFJochProtoBuf::INT16:
|
||||
case JFJochProtoBuf::UINT16:
|
||||
return 2;
|
||||
case JFJochProtoBuf::AUTO:
|
||||
if (GetFPGASummation() > 2)
|
||||
return 4;
|
||||
else
|
||||
return 2;
|
||||
default:
|
||||
case JFJochProtoBuf::INT32:
|
||||
case JFJochProtoBuf::UINT32:
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
JFJochProtoBuf::FPGAPixelOutput DiffractionExperiment::GetFPGAOutputMode() const {
|
||||
return dataset.fpga_pixel_output();
|
||||
}
|
||||
|
||||
@@ -179,7 +179,6 @@ public:
|
||||
int64_t GetStorageCellNumber() const;
|
||||
int64_t GetStorageCellStart() const;
|
||||
|
||||
JFJochProtoBuf::DetectorType GetDetectorType() const;
|
||||
int64_t GetMaxSpotCount() const;
|
||||
std::string GetSampleName() const;
|
||||
|
||||
@@ -204,12 +203,10 @@ public:
|
||||
DiffractionExperiment& SaveCalibration(bool input);
|
||||
bool GetSaveCalibration() const;
|
||||
|
||||
DiffractionExperiment& FPGASummation(int64_t input);
|
||||
int64_t GetFPGASummation() const;
|
||||
DiffractionExperiment& Summation(int64_t input);
|
||||
int64_t GetSummation() const;
|
||||
|
||||
DiffractionExperiment& FPGAOutputMode(const JFJochProtoBuf::FPGAPixelOutput& input);
|
||||
bool GetFPGAOutputSigned() const;
|
||||
int64_t GetFPGAOutputDepth() const;
|
||||
JFJochProtoBuf::FPGAPixelOutput GetFPGAOutputMode() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,11 +11,6 @@ enum Compression {
|
||||
NO_COMPRESSION = 3;
|
||||
}
|
||||
|
||||
enum DetectorType {
|
||||
JUNGFRAU = 0;
|
||||
EIGER = 1;
|
||||
};
|
||||
|
||||
enum DetectorMode {
|
||||
CONVERSION = 0;
|
||||
RAW = 1;
|
||||
@@ -84,7 +79,7 @@ message DatasetSettings {
|
||||
int64 ntrigger = 2;
|
||||
|
||||
FPGAPixelOutput fpga_pixel_output = 3;
|
||||
int64 fpga_summation = 4;
|
||||
int64 summation = 4;
|
||||
|
||||
float beam_x_pxl = 5;
|
||||
float beam_y_pxl = 6;
|
||||
@@ -140,7 +135,6 @@ message Detector {
|
||||
float pixel_size_mm = 3;
|
||||
repeated string module_hostname = 4;
|
||||
DetectorGeometry geometry = 5;
|
||||
DetectorType type = 6;
|
||||
int64 udp_interface_count = 7;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -34,7 +34,7 @@ void AcquisitionCounters::Reset(const DiffractionExperiment &experiment, uint16_
|
||||
saved_completions = std::vector<Completion>(expected_frames * nmodules);
|
||||
packets_per_module = std::vector<uint64_t>(nmodules);
|
||||
total_packets = 0;
|
||||
expected_packets_per_module = 128 * experiment.GetFPGASummation();
|
||||
expected_packets_per_module = 128 * experiment.GetSummation();
|
||||
}
|
||||
|
||||
void AcquisitionCounters::UpdateCounters(const Completion *c) {
|
||||
|
||||
@@ -61,7 +61,7 @@ void AcquisitionDevice::StartAction(const DiffractionExperiment &experiment, uin
|
||||
}
|
||||
|
||||
counters.Reset(experiment, data_stream);
|
||||
expected_frames = experiment.GetFrameNum() / experiment.GetFPGASummation();
|
||||
expected_frames = experiment.GetFrameNum() / experiment.GetSummation();
|
||||
|
||||
// Ensure internal WR queue is empty
|
||||
work_request_queue.Clear();
|
||||
|
||||
@@ -207,13 +207,13 @@ void FPGAAcquisitionDevice::FillActionRegister(const DiffractionExperiment& x, D
|
||||
job.one_over_energy = std::lround((1<<20)/ x.GetPhotonEnergy_keV());
|
||||
job.nstorage_cells = x.GetStorageCellNumber() - 1;
|
||||
job.mode = data_collection_id << 16;
|
||||
job.nsummation = x.GetFPGASummation() - 1;
|
||||
job.nsummation = x.GetSummation() - 1;
|
||||
|
||||
if (x.GetDetectorMode() == DetectorMode::Conversion)
|
||||
job.mode |= MODE_CONV;
|
||||
if (!x.GetFPGAOutputSigned())
|
||||
if (!x.IsPixelSigned())
|
||||
job.mode |= MODE_UNSIGNED;
|
||||
if (x.GetFPGAOutputDepth() == 4)
|
||||
if (x.GetPixelDepth() == 4)
|
||||
job.mode |= MODE_32BIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ TEST_CASE("AcquisitionCountersTest_OutOfBounds","[AcquisitionDeviceCounters]") {
|
||||
|
||||
TEST_CASE("AcquisitionCountersTest_PacketCount","[AcquisitionDeviceCounters]") {
|
||||
DiffractionExperiment x(DetectorGeometry(2));
|
||||
x.NumTriggers(1).ImagesPerTrigger(50).FPGASummation(2);
|
||||
x.NumTriggers(1).ImagesPerTrigger(50).Summation(2);
|
||||
|
||||
AcquisitionCounters counters;
|
||||
counters.Reset(x, 0);
|
||||
|
||||
@@ -12,7 +12,6 @@ TEST_CASE("DetectorSetup_MismatchInSize") {
|
||||
TEST_CASE("DetectorSetup_ProtoBuf") {
|
||||
DetectorSetup setup(DetectorGeometry(4), "JF", {"mx1","mx2","mx3","mx4"});
|
||||
JFJochProtoBuf::Detector detector = setup;
|
||||
REQUIRE(detector.type() == JFJochProtoBuf::JUNGFRAU);
|
||||
REQUIRE(detector.description() == "JF");
|
||||
REQUIRE(detector.module_hostname_size() == 4);
|
||||
REQUIRE(detector.module_hostname(3) == "mx4");
|
||||
|
||||
@@ -706,7 +706,7 @@ TEST_CASE("DiffractionExperiment_LoadDatasetSettings", "[DiffractionExperiment]"
|
||||
settings.set_data_file_count(5);
|
||||
settings.set_space_group_number(45);
|
||||
settings.set_sample_name("lyso1");
|
||||
settings.set_fpga_summation(36);
|
||||
settings.set_summation(36);
|
||||
settings.set_fpga_pixel_output(JFJochProtoBuf::INT16);
|
||||
REQUIRE_NOTHROW(x.LoadDatasetSettings(settings));
|
||||
|
||||
@@ -718,7 +718,7 @@ TEST_CASE("DiffractionExperiment_LoadDatasetSettings", "[DiffractionExperiment]"
|
||||
REQUIRE(x.GetSampleName() == "lyso1");
|
||||
REQUIRE(x.GetDataFileCount() == 5);
|
||||
REQUIRE(x.GetDetectorDistance_mm() == Approx(57.6));
|
||||
REQUIRE(x.GetFPGASummation() == 36);
|
||||
REQUIRE(x.GetSummation() == 36);
|
||||
REQUIRE(x.GetFPGAOutputMode() == JFJochProtoBuf::INT16);
|
||||
}
|
||||
|
||||
@@ -836,36 +836,36 @@ TEST_CASE("DiffractionExperiment_DefaultDataProcessingSettings","[DiffractionExp
|
||||
TEST_CASE("DiffractionExperiment_FPGA_Summation_output","[DiffractionExperiment]") {
|
||||
DiffractionExperiment x;
|
||||
|
||||
REQUIRE_THROWS(x.FPGASummation(0));
|
||||
REQUIRE_THROWS(x.FPGASummation(-1));
|
||||
REQUIRE_THROWS(x.FPGASummation(MAX_FPGA_SUMMATION + 1));
|
||||
REQUIRE_THROWS(x.Summation(0));
|
||||
REQUIRE_THROWS(x.Summation(-1));
|
||||
REQUIRE_THROWS(x.Summation(MAX_FPGA_SUMMATION + 1));
|
||||
|
||||
x.FPGAOutputMode(JFJochProtoBuf::AUTO);
|
||||
REQUIRE_NOTHROW(x.FPGASummation(1));
|
||||
REQUIRE(x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 2);
|
||||
REQUIRE(x.GetFPGASummation() == 1);
|
||||
REQUIRE_NOTHROW(x.Summation(1));
|
||||
REQUIRE(x.IsPixelSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 2);
|
||||
REQUIRE(x.GetSummation() == 1);
|
||||
|
||||
REQUIRE_NOTHROW(x.FPGASummation(3));
|
||||
REQUIRE(x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 4);
|
||||
REQUIRE(x.GetFPGASummation() == 3);
|
||||
REQUIRE_NOTHROW(x.Summation(3));
|
||||
REQUIRE(x.IsPixelSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 4);
|
||||
REQUIRE(x.GetSummation() == 3);
|
||||
|
||||
x.FPGAOutputMode(JFJochProtoBuf::INT16);
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 2);
|
||||
REQUIRE(x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 2);
|
||||
REQUIRE(x.IsPixelSigned());
|
||||
|
||||
x.FPGAOutputMode(JFJochProtoBuf::INT32);
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 4);
|
||||
REQUIRE(x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 4);
|
||||
REQUIRE(x.IsPixelSigned());
|
||||
|
||||
x.FPGAOutputMode(JFJochProtoBuf::UINT16);
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 2);
|
||||
REQUIRE(!x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 2);
|
||||
REQUIRE(!x.IsPixelSigned());
|
||||
|
||||
x.FPGAOutputMode(JFJochProtoBuf::UINT32);
|
||||
REQUIRE(x.GetFPGAOutputDepth() == 4);
|
||||
REQUIRE(!x.GetFPGAOutputSigned());
|
||||
REQUIRE(x.GetPixelDepth() == 4);
|
||||
REQUIRE(!x.IsPixelSigned());
|
||||
}
|
||||
|
||||
TEST_CASE("DiffractionExperiment_DetectorModuleHostname","[DiffractionExperiment]") {
|
||||
|
||||
@@ -1396,7 +1396,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_summation", "[FPGA][Full]"
|
||||
i = dist(g1);
|
||||
|
||||
x.Mode(DetectorMode::Raw);
|
||||
x.UseInternalPacketGenerator(true).ImagesPerTrigger(nframes).PedestalG0Frames(0).FPGASummation(nsummation);
|
||||
x.UseInternalPacketGenerator(true).ImagesPerTrigger(nframes).PedestalG0Frames(0).Summation(nsummation);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
test.SetInternalGeneratorFrame(test_frame);
|
||||
|
||||
Reference in New Issue
Block a user