mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-04-20 05:40:03 +02:00
WIP
This commit is contained in:
parent
ec61132296
commit
ae1166b908
@ -33,7 +33,7 @@ struct FileConfig {
|
|||||||
size_t total_frames{};
|
size_t total_frames{};
|
||||||
std::string to_string() const {
|
std::string to_string() const {
|
||||||
return "{ dtype: " + dtype.to_string() + ", rows: " + std::to_string(rows) + ", cols: " + std::to_string(cols) +
|
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) +
|
", max_frames_per_file: " + std::to_string(max_frames_per_file) +
|
||||||
", total_frames: " + std::to_string(total_frames) + " }";
|
", total_frames: " + std::to_string(total_frames) + " }";
|
||||||
}
|
}
|
||||||
|
@ -181,10 +181,10 @@ enum class TimingMode { Auto, Trigger };
|
|||||||
|
|
||||||
template <class T> T StringTo(const std::string &arg) { return T(arg); }
|
template <class T> T StringTo(const std::string &arg) { return T(arg); }
|
||||||
|
|
||||||
template <class T> std::string toString(T arg) { return T(arg); }
|
template <class T> std::string ToString(T arg) { return T(arg); }
|
||||||
|
|
||||||
template <> DetectorType StringTo(const std::string & /*name*/);
|
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*/);
|
template <> TimingMode StringTo(const std::string & /*mode*/);
|
||||||
|
|
||||||
|
@ -32,7 +32,9 @@ void define_file_io_bindings(py::module &m) {
|
|||||||
.def_property_readonly("cols", &File::cols)
|
.def_property_readonly("cols", &File::cols)
|
||||||
.def_property_readonly("bitdepth", &File::bitdepth)
|
.def_property_readonly("bitdepth", &File::bitdepth)
|
||||||
.def_property_readonly("bytes_per_pixel", &File::bytes_per_pixel)
|
.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) {
|
.def("read_frame", [](File &self) {
|
||||||
const uint8_t item_size = self.bytes_per_pixel();
|
const uint8_t item_size = self.bytes_per_pixel();
|
||||||
py::array image;
|
py::array image;
|
||||||
|
@ -72,7 +72,7 @@ void RawFile::write_master_file() {
|
|||||||
ss += "\n\t";
|
ss += "\n\t";
|
||||||
aare::write_digit(ss, "Total Frames", m_total_frames);
|
aare::write_digit(ss, "Total Frames", m_total_frames);
|
||||||
ss += "\n\t";
|
ss += "\n\t";
|
||||||
aare::write_str(ss, "Detector Type", toString(m_type));
|
aare::write_str(ss, "Detector Type", ToString(m_type));
|
||||||
ss += "\n\t";
|
ss += "\n\t";
|
||||||
aare::write_str(ss, "Geometry", m_geometry.to_string());
|
aare::write_str(ss, "Geometry", m_geometry.to_string());
|
||||||
ss += "\n\t";
|
ss += "\n\t";
|
||||||
@ -240,8 +240,6 @@ void RawFile::parse_json_metadata() {
|
|||||||
m_type = DetectorType::Moench03;
|
m_type = DetectorType::Moench03;
|
||||||
}else if (m_type == DetectorType::Moench && m_rows == 400 && m_analog_samples == 5000) {
|
}else if (m_type == DetectorType::Moench && m_rows == 400 && m_analog_samples == 5000) {
|
||||||
m_type = DetectorType::Moench03_old;
|
m_type = DetectorType::Moench03_old;
|
||||||
}else{
|
|
||||||
throw std::runtime_error(LOCATION + "Could not determine Moench detector type");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace aare {
|
|||||||
* @param type DetectorType
|
* @param type DetectorType
|
||||||
* @return string representation of the DetectorType
|
* @return string representation of the DetectorType
|
||||||
*/
|
*/
|
||||||
template <> std::string toString(DetectorType arg) {
|
template <> std::string ToString(DetectorType arg) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case DetectorType::Jungfrau:
|
case DetectorType::Jungfrau:
|
||||||
return "Jungfrau";
|
return "Jungfrau";
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
TEST_CASE("Enum to string conversion") {
|
TEST_CASE("Enum to string conversion") {
|
||||||
// By the way I don't think the enum string conversions should be in the defs.hpp file
|
// 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
|
// 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") {
|
TEST_CASE("Cluster creation") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user