mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-18 16:58:40 +01:00
changed RoMode to be consistent with slsdet
This commit is contained in:
@@ -135,7 +135,7 @@ class RawMasterFile {
|
||||
size_t n_modules() const;
|
||||
uint8_t quad() const;
|
||||
|
||||
ReadingMode get_reading_mode() const;
|
||||
ReadoutMode get_reading_mode() const;
|
||||
|
||||
std::optional<size_t> analog_samples() const;
|
||||
std::optional<size_t> digital_samples() const;
|
||||
|
||||
@@ -188,13 +188,13 @@ struct ROI {
|
||||
}
|
||||
};
|
||||
|
||||
enum ReadingMode : uint8_t {
|
||||
Analog = 0,
|
||||
Digital = 1,
|
||||
AnalogAndDigital = 2,
|
||||
Transceiver = 3,
|
||||
DigitalAndTransceiver = 4,
|
||||
Unknown = 5
|
||||
enum ReadoutMode : uint8_t {
|
||||
ANALOG_ONLY = 0,
|
||||
DIGITAL_ONLY = 1,
|
||||
ANALOG_AND_DIGITAL = 2,
|
||||
TRANSCEIVER_ONLY = 3,
|
||||
DIGITAL_AND_TRANSCEIVER = 4,
|
||||
UNKNOWN = 5
|
||||
};
|
||||
|
||||
using dynamic_shape = std::vector<ssize_t>;
|
||||
|
||||
@@ -5,7 +5,7 @@ from . import _aare
|
||||
|
||||
from ._aare import File, RawMasterFile, RawSubFile, JungfrauDataFile
|
||||
from ._aare import Pedestal_d, Pedestal_f, ClusterFinder_Cluster3x3i, VarClusterFinder
|
||||
from ._aare import DetectorType, ReadingMode
|
||||
from ._aare import DetectorType, ReadoutMode
|
||||
from ._aare import hitmap
|
||||
from ._aare import ROI
|
||||
from ._aare import corner
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
import numpy as np
|
||||
from . import _aare
|
||||
from aare import ReadingMode
|
||||
from aare import ReadoutMode
|
||||
|
||||
class AdcSar04Transform64to16:
|
||||
def __call__(self, data):
|
||||
@@ -71,15 +71,15 @@ class Matterhorn10Transform:
|
||||
self.dynamic_range = dynamic_range
|
||||
self.num_counters = num_counters
|
||||
|
||||
def compatibility(self, readingmode : ReadingMode):
|
||||
def compatibility(self, readingmode : ReadoutMode):
|
||||
"""
|
||||
checks if Matterhorn10Transform is compatible with given parameters
|
||||
|
||||
:param readingmode: Reading mode set
|
||||
:type readingmode: ReadingMode
|
||||
:type readingmode: ReadoutMode
|
||||
:raises ValueError: if not compatible
|
||||
"""
|
||||
if(readingmode != ReadingMode.Transceiver):
|
||||
if(readingmode != ReadoutMode.TRANSCEIVER_ONLY):
|
||||
raise ValueError(f"Incompatible Transformation. Matterhorn10Transform only requires transceiver samples. However reading mode is {readingmode}.")
|
||||
|
||||
pass
|
||||
|
||||
@@ -24,13 +24,13 @@ using namespace ::aare;
|
||||
|
||||
void define_raw_master_file_bindings(py::module &m) {
|
||||
|
||||
py::enum_<ReadingMode>(m, "ReadingMode")
|
||||
.value("Analog", ReadingMode::Analog)
|
||||
.value("Digital", ReadingMode::Digital)
|
||||
.value("AnalogAndDigital", ReadingMode::AnalogAndDigital)
|
||||
.value("Transceiver", ReadingMode::Transceiver)
|
||||
.value("DigitalAndTransceiver", ReadingMode::DigitalAndTransceiver)
|
||||
.value("Unknown", ReadingMode::Unknown)
|
||||
py::enum_<ReadoutMode>(m, "ReadoutMode")
|
||||
.value("ANALOG_ONLY", ReadoutMode::ANALOG_ONLY)
|
||||
.value("DIGITAL_ONLY", ReadoutMode::DIGITAL_ONLY)
|
||||
.value("ANALOG_AND_DIGITAL", ReadoutMode::ANALOG_AND_DIGITAL)
|
||||
.value("TRANSCEIVER_ONLY", ReadoutMode::TRANSCEIVER_ONLY)
|
||||
.value("DIGITAL_AND_TRANSCEIVER", ReadoutMode::DIGITAL_AND_TRANSCEIVER)
|
||||
.value("UNKNOWN", ReadoutMode::UNKNOWN)
|
||||
.export_values();
|
||||
|
||||
py::class_<RawMasterFile>(m, "RawMasterFile")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
import pytest
|
||||
from aare import RawMasterFile, ReadingMode, DetectorType
|
||||
from aare import RawMasterFile, ReadoutMode, DetectorType
|
||||
|
||||
|
||||
@pytest.mark.withdata
|
||||
@@ -10,5 +10,5 @@ def test_read_rawfile_quad_eiger_and_compare_to_numpy(test_data_path):
|
||||
file_name = test_data_path/'raw/jungfrau/jungfrau_single_master_0.json'
|
||||
|
||||
f = RawMasterFile(file_name)
|
||||
assert(f.reading_mode == ReadingMode.Unknown)
|
||||
assert(f.reading_mode == ReadoutMode.UNKNOWN)
|
||||
assert(f.detector_type == DetectorType.Jungfrau)
|
||||
@@ -195,27 +195,27 @@ ScanParameters RawMasterFile::scan_parameters() const {
|
||||
|
||||
std::optional<ROI> RawMasterFile::roi() const { return m_roi; }
|
||||
|
||||
ReadingMode RawMasterFile::get_reading_mode() const {
|
||||
ReadoutMode RawMasterFile::get_reading_mode() const {
|
||||
|
||||
if (m_type != DetectorType::ChipTestBoard &&
|
||||
m_type != DetectorType::Xilinx_ChipTestBoard) {
|
||||
LOG(TLogLevel::logINFO)
|
||||
<< "reading mode is only available for CTB detectors.";
|
||||
return ReadingMode::Unknown;
|
||||
return ReadoutMode::UNKNOWN;
|
||||
}
|
||||
|
||||
if (m_analog_flag && m_digital_flag) {
|
||||
return ReadingMode::AnalogAndDigital;
|
||||
return ReadoutMode::ANALOG_AND_DIGITAL;
|
||||
} else if (m_analog_flag) {
|
||||
return ReadingMode::Analog;
|
||||
return ReadoutMode::ANALOG_ONLY;
|
||||
} else if (m_digital_flag && m_transceiver_flag) {
|
||||
return ReadingMode::DigitalAndTransceiver;
|
||||
return ReadoutMode::DIGITAL_AND_TRANSCEIVER;
|
||||
} else if (m_digital_flag) {
|
||||
return ReadingMode::Digital;
|
||||
return ReadoutMode::DIGITAL_ONLY;
|
||||
} else if (m_transceiver_flag) {
|
||||
return ReadingMode::Transceiver;
|
||||
return ReadoutMode::TRANSCEIVER_ONLY;
|
||||
} else {
|
||||
return ReadingMode::Unknown;
|
||||
return ReadoutMode::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ TEST_CASE("Parse a master file in .json format", "[.integration]") {
|
||||
REQUIRE_FALSE(f.analog_samples());
|
||||
REQUIRE_FALSE(f.digital_samples());
|
||||
|
||||
REQUIRE(f.get_reading_mode() == ReadingMode::Unknown);
|
||||
REQUIRE(f.get_reading_mode() == ReadoutMode::UNKNOWN);
|
||||
}
|
||||
|
||||
TEST_CASE("Parse a master file in old .raw format",
|
||||
@@ -213,7 +213,7 @@ TEST_CASE("Parse a master file in .raw format", "[.integration]") {
|
||||
// Frames in File : 100
|
||||
REQUIRE(f.frames_in_file() == 100);
|
||||
|
||||
REQUIRE(f.get_reading_mode() == ReadingMode::Unknown);
|
||||
REQUIRE(f.get_reading_mode() == ReadoutMode::ANALOG_AND_DIGITAL);
|
||||
|
||||
// #Frame Header
|
||||
// Frame Number : 8 bytes
|
||||
@@ -564,7 +564,7 @@ TEST_CASE("Parse a CTB file from stream") {
|
||||
REQUIRE(f.digital_samples() == std::nullopt); // Digital Flag is 0
|
||||
REQUIRE(f.transceiver_samples() == 1152);
|
||||
REQUIRE(f.frames_in_file() == 40);
|
||||
REQUIRE(f.get_reading_mode() == ReadingMode::Transceiver);
|
||||
REQUIRE(f.get_reading_mode() == ReadoutMode::TRANSCEIVER_ONLY);
|
||||
}
|
||||
|
||||
TEST_CASE("Parse v8.0 MYTHEN3 from stream") {
|
||||
|
||||
Reference in New Issue
Block a user