Support providing trimming energies
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "../image_pusher/HDF5FilePusher.h"
|
||||
#include "OpenAPIConvert.h"
|
||||
#include "Detector_type.h"
|
||||
#include "../cmake-build-release-nogpu/_deps/catch2-src/src/catch2/internal/catch_string_manip.hpp"
|
||||
#include "../image_pusher/NonePusher.h"
|
||||
#include "../image_pusher/TCPStreamPusher.h"
|
||||
|
||||
@@ -91,10 +92,15 @@ DetectorSetup ParseDetectorSetup(const org::openapitools::server::model::Detecto
|
||||
DetectorSetup setup(geom, detector_type, d.getDescription(), d.getHostname());
|
||||
|
||||
auto calib = d.getCalibrationFile();
|
||||
auto trim_energies = d.getTrimEnergiesEV();
|
||||
if (!calib.empty()) {
|
||||
switch (detector_type) {
|
||||
case DetectorType::EIGER:
|
||||
setup.SetTrimFiles(calib);
|
||||
if (trim_energies.empty())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Trimming energies not provided");
|
||||
setup.TrimEnergies_eV(trim_energies);
|
||||
break;
|
||||
case DetectorType::JUNGFRAU:
|
||||
setup.LoadGain(calib);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
|
||||
#include "DetectorSetup.h"
|
||||
#include "JFJochException.h"
|
||||
@@ -449,3 +450,12 @@ DetectorSetup &DetectorSetup::TempThreshold_degC(int64_t input) {
|
||||
temperature_thresold_degC = static_cast<int32_t>(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DetectorSetup &DetectorSetup::TrimEnergies_eV(std::vector<int> input) {
|
||||
trim_energy_eV_values = std::move(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<int> DetectorSetup::GetTrimEnergies_eV() const {
|
||||
return trim_energy_eV_values;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class DetectorSetup {
|
||||
std::vector<std::string> gain_file_names;
|
||||
std::vector<std::string> trim_file_names;
|
||||
std::string trim_file_directory;
|
||||
std::vector<int> trim_energy_eV_values;
|
||||
std::shared_ptr<JFGainCalibration> gain_calibration;
|
||||
int64_t udp_interface_count = 2;
|
||||
float pixel_size_um = 75.0f;
|
||||
@@ -85,6 +86,7 @@ public:
|
||||
DetectorSetup& DECTRISROI(const std::string &input);
|
||||
DetectorSetup& DefaultSettings(const std::optional<DetectorSettings> &input);
|
||||
DetectorSetup& TempThreshold_degC(int64_t input);
|
||||
DetectorSetup& TrimEnergies_eV(std::vector<int> input);
|
||||
|
||||
[[nodiscard]] DetectorType GetDetectorType() const;
|
||||
[[nodiscard]] const DetectorGeometry& GetGeometry() const;
|
||||
@@ -116,6 +118,7 @@ public:
|
||||
[[nodiscard]] std::string GetDECTRISROI() const;
|
||||
[[nodiscard]] std::optional<DetectorSettings> GetDefaultSettings() const;
|
||||
[[nodiscard]] int32_t GetTempThreshold_degC() const;
|
||||
[[nodiscard]] std::vector<int> GetTrimEnergies_eV() const;
|
||||
};
|
||||
|
||||
DetectorSetup DetJF4M(const std::string &description = "Detector",
|
||||
|
||||
@@ -145,10 +145,11 @@ void SLSDetectorWrapper::Initialize(DiffractionExperiment& experiment,
|
||||
auto trim_directory = experiment.GetDetectorSetup().GetTrimFileDirectory();
|
||||
if (!trim_directory.empty()) {
|
||||
// Hardcoded for now - need to make it nicer
|
||||
std::vector<int> trim_en = {4500, 5400, 6400, 8000, 9900, 15800};
|
||||
std::vector<int> trim_en = experiment.GetDetectorSetup().GetTrimEnergies_eV();
|
||||
if (trim_en.empty())
|
||||
throw JFJochException(JFJochExceptionCategory::Detector, "Trimming energies not provided");
|
||||
det.setTrimEnergies(trim_en);
|
||||
det.setSettingsPath(trim_directory);
|
||||
|
||||
}
|
||||
auto trim_files = experiment.GetDetectorSetup().GetTrimFileNames();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user