diff --git a/include/aare/FileInterface.hpp b/include/aare/FileInterface.hpp index d9176783..5a438c3d 100644 --- a/include/aare/FileInterface.hpp +++ b/include/aare/FileInterface.hpp @@ -33,7 +33,7 @@ struct FileConfig { size_t total_frames{}; std::string to_string() const { return "{ dtype: " + dtype.to_string() + ", rows: " + std::to_string(rows) + ", cols: " + std::to_string(cols) + - ", geometry: " + geometry.to_string() + ", detector_type: " + toString(detector_type) + + ", geometry: " + geometry.to_string() + ", detector_type: " + ToString(detector_type) + ", max_frames_per_file: " + std::to_string(max_frames_per_file) + ", total_frames: " + std::to_string(total_frames) + " }"; } diff --git a/include/aare/defs.hpp b/include/aare/defs.hpp index 89d5b195..434f533e 100644 --- a/include/aare/defs.hpp +++ b/include/aare/defs.hpp @@ -181,10 +181,10 @@ enum class TimingMode { Auto, Trigger }; template T StringTo(const std::string &arg) { return T(arg); } -template std::string toString(T arg) { return T(arg); } +template std::string ToString(T arg) { return T(arg); } template <> DetectorType StringTo(const std::string & /*name*/); -template <> std::string toString(DetectorType arg); +template <> std::string ToString(DetectorType arg); template <> TimingMode StringTo(const std::string & /*mode*/); diff --git a/python/src/file.hpp b/python/src/file.hpp index ded90bf5..65f841db 100644 --- a/python/src/file.hpp +++ b/python/src/file.hpp @@ -32,7 +32,9 @@ void define_file_io_bindings(py::module &m) { .def_property_readonly("cols", &File::cols) .def_property_readonly("bitdepth", &File::bitdepth) .def_property_readonly("bytes_per_pixel", &File::bytes_per_pixel) - .def_property_readonly("detector_type", &File::detector_type) + .def_property_readonly("detector_type", [](File &self){ + return ToString(self.detector_type()); + }) .def("read_frame", [](File &self) { const uint8_t item_size = self.bytes_per_pixel(); py::array image; diff --git a/src/RawFile.cpp b/src/RawFile.cpp index b8fc0365..5b554602 100644 --- a/src/RawFile.cpp +++ b/src/RawFile.cpp @@ -72,7 +72,7 @@ void RawFile::write_master_file() { ss += "\n\t"; aare::write_digit(ss, "Total Frames", m_total_frames); ss += "\n\t"; - aare::write_str(ss, "Detector Type", toString(m_type)); + aare::write_str(ss, "Detector Type", ToString(m_type)); ss += "\n\t"; aare::write_str(ss, "Geometry", m_geometry.to_string()); ss += "\n\t"; @@ -240,8 +240,6 @@ void RawFile::parse_json_metadata() { m_type = DetectorType::Moench03; }else if (m_type == DetectorType::Moench && m_rows == 400 && m_analog_samples == 5000) { m_type = DetectorType::Moench03_old; - }else{ - throw std::runtime_error(LOCATION + "Could not determine Moench detector type"); } diff --git a/src/defs.cpp b/src/defs.cpp index a51104b7..27332a23 100644 --- a/src/defs.cpp +++ b/src/defs.cpp @@ -9,7 +9,7 @@ namespace aare { * @param type DetectorType * @return string representation of the DetectorType */ -template <> std::string toString(DetectorType arg) { +template <> std::string ToString(DetectorType arg) { switch (arg) { case DetectorType::Jungfrau: return "Jungfrau"; diff --git a/src/defs.test.cpp b/src/defs.test.cpp index 7475fe67..136f3fd0 100644 --- a/src/defs.test.cpp +++ b/src/defs.test.cpp @@ -6,7 +6,7 @@ TEST_CASE("Enum to string conversion") { // By the way I don't think the enum string conversions should be in the defs.hpp file // but let's use this to show a test - REQUIRE(toString(aare::DetectorType::Jungfrau) == "Jungfrau"); + REQUIRE(ToString(aare::DetectorType::Jungfrau) == "Jungfrau"); } TEST_CASE("Cluster creation") {