Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest changes #100

Merged
merged 93 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
b1b020a
WIP
erikfrojdh Oct 25, 2024
54dd88f
added documentation
erikfrojdh Oct 25, 2024
5d643dc
added cluster finder
erikfrojdh Oct 25, 2024
a4fb217
Files and structure for python interface
erikfrojdh Oct 28, 2024
abb1d20
WIP
erikfrojdh Oct 28, 2024
7f9151f
WIP
erikfrojdh Oct 28, 2024
8a435cb
WIP
erikfrojdh Oct 28, 2024
1a16d45
WIP
erikfrojdh Oct 28, 2024
c509e29
building with scikit build
erikfrojdh Oct 29, 2024
8a10bcb
workflow
erikfrojdh Oct 29, 2024
9f29f17
updated path
erikfrojdh Oct 29, 2024
082d793
WIP
erikfrojdh Oct 29, 2024
b4fe044
WIP
erikfrojdh Oct 29, 2024
eb855fb
updated workflow
erikfrojdh Oct 29, 2024
a8afa04
updated workflow
erikfrojdh Oct 29, 2024
c3a5d22
added anaconda-client
erikfrojdh Oct 29, 2024
4cc6aa9
updated workflows
erikfrojdh Oct 30, 2024
dea5aaf
slight mod
erikfrojdh Oct 30, 2024
b037aeb
update
erikfrojdh Oct 30, 2024
b37f484
cmake defaults
erikfrojdh Oct 30, 2024
af4f000
fetch content for json
erikfrojdh Oct 30, 2024
be019b9
updated readme
erikfrojdh Oct 30, 2024
f754e0f
file reading
erikfrojdh Oct 30, 2024
5035c20
added action for docs
erikfrojdh Oct 30, 2024
29a4250
WIP
erikfrojdh Oct 30, 2024
1f539a2
forgot json
erikfrojdh Oct 30, 2024
9b33ad0
pybind
erikfrojdh Oct 30, 2024
1cbded0
doxygen
erikfrojdh Oct 30, 2024
da5ba03
WIP
erikfrojdh Oct 30, 2024
801adcc
updated path for docs
erikfrojdh Oct 30, 2024
8b43011
modified action
erikfrojdh Oct 30, 2024
acdcaac
fmt
erikfrojdh Oct 30, 2024
504e8b4
updated doxyfile
erikfrojdh Oct 30, 2024
41fbddb
pinned sphinx version
erikfrojdh Oct 30, 2024
6b8f247
added deploy
erikfrojdh Oct 30, 2024
738934f
added github token
erikfrojdh Oct 30, 2024
1b61155
another try
erikfrojdh Oct 30, 2024
dde92b9
xml back in
erikfrojdh Oct 30, 2024
a466887
added variable cluster finder
erikfrojdh Oct 30, 2024
6505f37
added type bindings
erikfrojdh Oct 30, 2024
9b733fd
WIP
erikfrojdh Oct 30, 2024
79d924c
docs and version bump
erikfrojdh Oct 30, 2024
13ac6b0
added missing numpy dependency
erikfrojdh Oct 30, 2024
b7e6962
added numpy as dep
erikfrojdh Oct 30, 2024
92d9c28
numpy in conda env for docs
erikfrojdh Oct 30, 2024
19c6a40
improved docs and added PixelMap
erikfrojdh Oct 31, 2024
cee0d71
added check to prevent segfault on missing subfile
erikfrojdh Oct 31, 2024
ec61132
WIP
erikfrojdh Oct 31, 2024
ae1166b
WIP
erikfrojdh Oct 31, 2024
563c39c
decoding of old Moench03
erikfrojdh Oct 31, 2024
49da039
working on 05
erikfrojdh Oct 31, 2024
b8a4498
WIP
erikfrojdh Oct 31, 2024
80a3941
added CtbRawFile
erikfrojdh Nov 5, 2024
d98b452
optional
erikfrojdh Nov 5, 2024
7f244e2
extra methods in CtbRawFile
erikfrojdh Nov 5, 2024
2efb763
func to prop
erikfrojdh Nov 5, 2024
654c1db
WIP
erikfrojdh Nov 5, 2024
25812cb
RawFile is now using RawMasterFile
erikfrojdh Nov 6, 2024
1cc7690
discard partial
erikfrojdh Nov 6, 2024
4bb8487
added moench03 back
erikfrojdh Nov 6, 2024
5b2809d
working Moench03 detector type
erikfrojdh Nov 6, 2024
cbfd1f0
ClusterFinder
erikfrojdh Nov 6, 2024
b2e5c71
MH02 1-4 counters
erikfrojdh Nov 6, 2024
9c220bf
added simple decoding of scan parameters
erikfrojdh Nov 7, 2024
d5fb823
added numpy variants
erikfrojdh Nov 7, 2024
b172c7a
starting work on ROI
erikfrojdh Nov 7, 2024
ecf1b2a
WIP
erikfrojdh Nov 11, 2024
5f21759
removed prints, bumped version
erikfrojdh Nov 11, 2024
a0b6c4c
Merge branch 'main' into developer
erikfrojdh Nov 11, 2024
2ee1a55
WIP
erikfrojdh Nov 12, 2024
db936b6
improved documentation
erikfrojdh Nov 12, 2024
17917ac
Merge branch 'main' into developer
erikfrojdh Nov 12, 2024
13b2cb4
docs and reorder
erikfrojdh Nov 14, 2024
cb94d07
Merge branch 'developer' of github.com:slsdetectorgroup/aare into dev…
erikfrojdh Nov 14, 2024
dc889da
removed subfile from cmake
erikfrojdh Nov 14, 2024
7ffd732
ported reading clusters (#95)
erikfrojdh Nov 14, 2024
dcedb4f
added missing header
erikfrojdh Nov 14, 2024
5cde7a9
WIP
erikfrojdh Nov 14, 2024
0d05827
WIP
erikfrojdh Nov 14, 2024
e77b615
Added expression templates (#98)
erikfrojdh Nov 15, 2024
17f8d28
frame reading for cluster file
erikfrojdh Nov 15, 2024
632c2ee
bumped version
erikfrojdh Nov 15, 2024
62a14dd
Merge branch 'main' into developer
erikfrojdh Nov 15, 2024
9d4459e
linking json with PUBLIC to avoid errors
erikfrojdh Nov 18, 2024
0882887
Merge branch 'developer' of github.com:slsdetectorgroup/aare into dev…
erikfrojdh Nov 18, 2024
13394c3
cmake targets
erikfrojdh Nov 18, 2024
9ab61ca
deps in pkg
erikfrojdh Nov 18, 2024
35c6706
docs
erikfrojdh Nov 18, 2024
37d3dfc
WIP
erikfrojdh Nov 18, 2024
30d05f9
detecting need to link with stdfs
erikfrojdh Nov 18, 2024
75f83e5
detecting need to link with stdfs
erikfrojdh Nov 18, 2024
8ea4372
fix
erikfrojdh Nov 18, 2024
47e867f
Merge branch 'main' into developer
erikfrojdh Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
extra methods in CtbRawFile
erikfrojdh committed Nov 5, 2024
commit 7f244e22a2acc2bebc0323907a1c37a29c484b07
1 change: 1 addition & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ set(SPHINX_SOURCE_FILES
src/Dtype.rst
src/ClusterFinder.rst
src/Pedestal.rst
src/RawMasterFile.rst
src/VarClusterFinder.rst
src/pyVarClusterFinder.rst
src/pyFile.rst
8 changes: 8 additions & 0 deletions docs/src/RawMasterFile.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RawMasterFile
===============


.. doxygenclass:: aare::RawMasterFile
:members:
:undoc-members:
:private-members:
1 change: 1 addition & 0 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ AARE
Dtype
ClusterFinder
Pedestal
RawMasterFile
VarClusterFinder

.. toctree::
5 changes: 3 additions & 2 deletions include/aare/CtbRawFile.hpp
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@

namespace aare{


class CtbRawFile{
RawMasterFile m_master;
std::ifstream m_file;
@@ -24,8 +25,8 @@ class CtbRawFile{

// in the specific class we can expose more functionality

size_t image_size_in_bytes() const { return m_master.image_size_in_bytes(); }

size_t image_size_in_bytes() const;
size_t frames_in_file() const;
private:
void find_subfiles();
size_t sub_file_index(size_t frame_index) const {
59 changes: 25 additions & 34 deletions include/aare/RawMasterFile.hpp
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ class RawFileNameComponents {
fmt::format("{}_master_{}{}", m_base_name, m_file_index, m_ext);
}

std::filesystem::path data_fname(size_t mod_id, size_t file_id) {
std::filesystem::path data_fname(size_t mod_id, size_t file_id) const{
return m_base_path / fmt::format("{}_d{}_f{}_{}.raw", m_base_name,
mod_id, file_id, m_file_index);
}
@@ -34,6 +34,10 @@ class RawFileNameComponents {
int file_index() const { return m_file_index; }
};


/**
* @brief Class for parsing a master file either in our .json format or the old .raw format
*/
class RawMasterFile {
RawFileNameComponents m_fnc;
std::string m_version;
@@ -55,39 +59,26 @@ class RawMasterFile {
std::optional<size_t> m_digital_samples;

public:
RawMasterFile(const std::filesystem::path &fpath) : m_fnc(fpath) {
if (!std::filesystem::exists(fpath)) {
throw std::runtime_error(LOCATION + " File does not exist");
}
if (m_fnc.ext() == ".json") {
parse_json(fpath);
} else if (m_fnc.ext() == ".raw") {
parse_raw(fpath);
} else {
throw std::runtime_error(LOCATION + "Unsupported file type");
}
}

const std::string &version() const { return m_version; }
const DetectorType &detector_type() const { return m_type; }
const TimingMode &timing_mode() const { return m_timing_mode; }
size_t image_size_in_bytes() const { return m_image_size_in_bytes; }
size_t frames_in_file() const { return m_frames_in_file; }
size_t pixels_y() const { return m_pixels_y; }
size_t pixels_x() const { return m_pixels_x; }
size_t max_frames_per_file() const { return m_max_frames_per_file; }
size_t bitdepth() const { return m_bitdepth; }
size_t frame_padding() const { return m_frame_padding; }
const FrameDiscardPolicy &frame_discard_policy() const {
return m_frame_discard_policy;
}

std::optional<size_t> analog_samples() const { return m_analog_samples; }
std::optional<size_t> digital_samples() const { return m_digital_samples; }

std::filesystem::path data_fname(size_t mod_id, size_t file_id) {
return m_fnc.data_fname(mod_id, file_id);
}
RawMasterFile(const std::filesystem::path &fpath);

std::filesystem::path data_fname(size_t mod_id, size_t file_id) const;

const std::string &version() const; //!< For example "7.2"
const DetectorType &detector_type() const;
const TimingMode &timing_mode() const;
size_t image_size_in_bytes() const;
size_t frames_in_file() const;
size_t pixels_y() const;
size_t pixels_x() const;
size_t max_frames_per_file() const;
size_t bitdepth() const;
size_t frame_padding() const;
const FrameDiscardPolicy &frame_discard_policy() const;

std::optional<size_t> analog_samples() const;
std::optional<size_t> digital_samples() const;



private:
void parse_json(const std::filesystem::path &fpath);
79 changes: 76 additions & 3 deletions python/aare/CtbRawFile.py
Original file line number Diff line number Diff line change
@@ -3,19 +3,35 @@
import numpy as np

class CtbRawFile(_aare.CtbRawFile):
"""File reader for the CTB raw file format.

Args:
fname (pathlib.Path | str): Path to the file to be read.
transform (function): Function to apply to the data after reading it.
The function should take a numpy array of type uint8 and return one
or several numpy arrays.
"""
def __init__(self, fname, transform = None):
super().__init__(fname)
self.transform = transform


def read_frame(self, frame_index = None):
"""Read one frame from the file.
def read_frame(self, frame_index: int | None = None ) -> tuple:
"""Read one frame from the file and then advance the file pointer.

.. note::

Uses the position of the file pointer :py:meth:`~CtbRawFile.tell` to determine
which frame to read unless frame_index is specified.

Args:
frame_index (int): If not None, seek to this frame before reading.

Returns:
tuple: header, data

Raises:
RuntimeError: If the file is at the end.
"""
if frame_index is not None:
self.seek(frame_index)
@@ -32,7 +48,23 @@ def read_frame(self, frame_index = None):
else:
return header, res

def read_n(self, n_frames):
def read_n(self, n_frames:int) -> tuple:
"""Read several frames from the file.

.. note::

Uses the position of the file pointer :py:meth:`~CtbRawFile.tell` to determine
where to start reading from.

Args:
n_frames (int): Number of frames to read.

Returns:
tuple: header, data

Raises:
RuntimeError: If EOF is reached.
"""
# Do the first read to figure out what we have
tmp_header, tmp_data = self.read_frame()

@@ -51,6 +83,47 @@ def read_n(self, n_frames):
return header, data


def seek(self, frame_index:int) -> None:
"""Seek to a specific frame in the file.

Args:
frame_index (int): Frame position in file to seek to.
"""
super().seek(frame_index)

def tell() -> int:
"""Return the current frame position in the file.

Returns:
int: Frame position in file.
"""
return super().tell()


def image_size_in_bytes(self) -> int:
"""Return the size of the image in bytes.

Returns:
int: Size of image in bytes.
"""
return super().image_size_in_bytes()

def __len__(self) -> int:
"""Return the number of frames in the file.

Returns:
int: Number of frames in file.
"""
return super().frames_in_file()

def frames_in_file(self) -> int:
"""Return the number of frames in the file.

Returns:
int: Number of frames in file.
"""
return super().frames_in_file()

def __enter__(self):
return self

4 changes: 3 additions & 1 deletion python/src/file.hpp
Original file line number Diff line number Diff line change
@@ -46,7 +46,9 @@ void define_file_io_bindings(py::module &m) {
return py::make_tuple(header, image);
})
.def("seek", &CtbRawFile::seek)
.def("tell", &CtbRawFile::tell);
.def("tell", &CtbRawFile::tell)
.def("image_size_in_bytes", &CtbRawFile::image_size_in_bytes)
.def("frames_in_file", &CtbRawFile::frames_in_file);

py::class_<File>(m, "File")
.def(py::init([](const std::filesystem::path &fname) {
48 changes: 24 additions & 24 deletions src/CtbRawFile.cpp
Original file line number Diff line number Diff line change
@@ -4,9 +4,6 @@
namespace aare {

CtbRawFile::CtbRawFile(const std::filesystem::path &fname) : m_master(fname) {



if (m_master.detector_type() != DetectorType::ChipTestBoard) {
throw std::runtime_error(LOCATION + "Not a Ctb file");
}
@@ -17,7 +14,24 @@ CtbRawFile::CtbRawFile(const std::filesystem::path &fname) : m_master(fname) {
m_file.open(m_master.data_fname(0, 0), std::ios::binary);
}

size_t CtbRawFile::tell() const { return m_current_frame; }
void CtbRawFile::read_into(std::byte *image_buf, DetectorHeader* header) {
if(m_current_frame >= m_master.frames_in_file()){
throw std::runtime_error(LOCATION + "End of file reached");
}

if(m_current_frame != 0 && m_current_frame % m_master.max_frames_per_file() == 0){
open_data_file(m_current_subfile+1);
}

if(header){
m_file.read(reinterpret_cast<char *>(header), sizeof(DetectorHeader));
}else{
m_file.seekg(sizeof(DetectorHeader), std::ios::cur);
}

m_file.read(reinterpret_cast<char *>(image_buf), m_master.image_size_in_bytes());
m_current_frame++;
}

void CtbRawFile::seek(size_t frame_number) {
if (auto index = sub_file_index(frame_number); index != m_current_subfile) {
@@ -28,6 +42,12 @@ void CtbRawFile::seek(size_t frame_number) {
m_current_frame = frame_number;
}

size_t CtbRawFile::tell() const { return m_current_frame; }

size_t CtbRawFile::image_size_in_bytes() const { return m_master.image_size_in_bytes(); }

size_t CtbRawFile::frames_in_file() const { return m_master.frames_in_file(); }

void CtbRawFile::find_subfiles() {
// we can semi safely assume that there is only one module for CTB
while (std::filesystem::exists(m_master.data_fname(0, m_num_subfiles)))
@@ -47,26 +67,6 @@ void CtbRawFile::open_data_file(size_t subfile_index) {
}
}

void CtbRawFile::read_into(std::byte *image_buf, DetectorHeader* header) {
if(m_current_frame >= m_master.frames_in_file()){
throw std::runtime_error(LOCATION + "End of file reached");
}

if(m_current_frame != 0 && m_current_frame % m_master.max_frames_per_file() == 0){
open_data_file(m_current_subfile+1);
}

if(header){
m_file.read(reinterpret_cast<char *>(header), sizeof(DetectorHeader));
}else{
m_file.seekg(sizeof(DetectorHeader), std::ios::cur);
}

m_file.read(reinterpret_cast<char *>(image_buf), m_master.image_size_in_bytes());
m_current_frame++;



}

} // namespace aare
198 changes: 122 additions & 76 deletions src/RawMasterFile.cpp
Original file line number Diff line number Diff line change
@@ -2,100 +2,146 @@

namespace aare {


RawFileNameComponents::RawFileNameComponents(const std::filesystem::path &fname) {
RawFileNameComponents::RawFileNameComponents(
const std::filesystem::path &fname) {
m_base_path = fname.parent_path();
m_base_name = fname.stem();
m_ext = fname.extension();

//parse file index
// parse file index
try {
auto pos = m_base_name.rfind('_');
m_file_index = std::stoi(m_base_name.substr(pos + 1));
} catch (const std::invalid_argument &e) {
throw std::runtime_error(LOCATION + "Could not parse file index");
}

//remove master from base name
// remove master from base name
auto pos = m_base_name.find("_master_");
if (pos != std::string::npos) {
m_base_name.erase(pos);
}else{
throw std::runtime_error(LOCATION + "Could not find _master_ in file name");
} else {
throw std::runtime_error(LOCATION +
"Could not find _master_ in file name");
}
}

RawMasterFile::RawMasterFile(const std::filesystem::path &fpath)
: m_fnc(fpath) {
if (!std::filesystem::exists(fpath)) {
throw std::runtime_error(LOCATION + " File does not exist");
}
if (m_fnc.ext() == ".json") {
parse_json(fpath);
} else if (m_fnc.ext() == ".raw") {
parse_raw(fpath);
} else {
throw std::runtime_error(LOCATION + "Unsupported file type");
}
}

std::filesystem::path RawMasterFile::data_fname(size_t mod_id,
size_t file_id) const {
return m_fnc.data_fname(mod_id, file_id);
}

const std::string &RawMasterFile::version() const { return m_version; }
const DetectorType &RawMasterFile::detector_type() const { return m_type; }
const TimingMode &RawMasterFile::timing_mode() const { return m_timing_mode; }
size_t RawMasterFile::image_size_in_bytes() const {
return m_image_size_in_bytes;
}
size_t RawMasterFile::frames_in_file() const { return m_frames_in_file; }
size_t RawMasterFile::pixels_y() const { return m_pixels_y; }
size_t RawMasterFile::pixels_x() const { return m_pixels_x; }
size_t RawMasterFile::max_frames_per_file() const {
return m_max_frames_per_file;
}
size_t RawMasterFile::bitdepth() const { return m_bitdepth; }
size_t RawMasterFile::frame_padding() const { return m_frame_padding; }
const FrameDiscardPolicy &RawMasterFile::frame_discard_policy() const {
return m_frame_discard_policy;
}

// optional values, these may or may not be present in the master file
// and are therefore modeled as std::optional
std::optional<size_t> RawMasterFile::analog_samples() const {
return m_analog_samples;
}
std::optional<size_t> RawMasterFile::digital_samples() const {
return m_digital_samples;
}

void RawMasterFile::parse_json(const std::filesystem::path &fpath) {
std::ifstream ifs(fpath);
json j;
ifs >> j;
double v = j["Version"];
m_version = fmt::format("{:.1f}", v);

m_type = StringTo<DetectorType>(j["Detector Type"].get<std::string>());
m_timing_mode =
StringTo<TimingMode>(j["Timing Mode"].get<std::string>());

m_image_size_in_bytes = j["Image Size in bytes"];
m_frames_in_file = j["Frames in File"];
m_pixels_y = j["Pixels"]["y"];
m_pixels_x = j["Pixels"]["x"];

m_max_frames_per_file = j["Max Frames Per File"];

//Not all detectors write the bitdepth but in case
//its not there it is 16
try {
m_bitdepth = j.at("Dynamic Range");
} catch (const json::out_of_range &e) {
m_bitdepth = 16;
}

m_frame_padding = j["Frame Padding"];
m_frame_discard_policy = StringTo<FrameDiscardPolicy>(
j["Frame Discard Policy"].get<std::string>());

try {
m_analog_samples = j.at("Analog Samples");
}catch (const json::out_of_range &e) {
// m_analog_samples = 0;
}
// try{
// std::string adc_mask = j.at("ADC Mask");
// m_adc_mask = std::stoul(adc_mask, nullptr, 16);
// }catch (const json::out_of_range &e) {
// m_adc_mask = 0;
// }

try {
m_digital_samples = j.at("Digital Samples");
}catch (const json::out_of_range &e) {
// m_digital_samples = 0;
}

// //Update detector type for Moench
// //TODO! How does this work with old .raw master files?
// if (m_type == DetectorType::Moench && m_analog_samples == 0 &&
// m_subfile_rows == 400) {
// m_type = DetectorType::Moench03;
// }else if (m_type == DetectorType::Moench && m_subfile_rows == 400 &&
// m_analog_samples == 5000) {
// m_type = DetectorType::Moench03_old;
// }

// //Here we know we have a ChipTestBoard file update the geometry?
// //TODO! Carry on information about digtial, and transceivers
// if (m_type == DetectorType::ChipTestBoard) {
// subfile_rows = 1;
// subfile_cols = m_analog_samples*__builtin_popcount(m_adc_mask);
// }

// // only Eiger had quad
// if (m_type == DetectorType::Eiger) {
// quad = (j["Quad"] == 1);
// }

// m_geometry = {j["Geometry"]["y"], j["Geometry"]["x"]};
std::ifstream ifs(fpath);
json j;
ifs >> j;
double v = j["Version"];
m_version = fmt::format("{:.1f}", v);

m_type = StringTo<DetectorType>(j["Detector Type"].get<std::string>());
m_timing_mode = StringTo<TimingMode>(j["Timing Mode"].get<std::string>());

m_image_size_in_bytes = j["Image Size in bytes"];
m_frames_in_file = j["Frames in File"];
m_pixels_y = j["Pixels"]["y"];
m_pixels_x = j["Pixels"]["x"];

m_max_frames_per_file = j["Max Frames Per File"];

// Not all detectors write the bitdepth but in case
// its not there it is 16
try {
m_bitdepth = j.at("Dynamic Range");
} catch (const json::out_of_range &e) {
m_bitdepth = 16;
}

m_frame_padding = j["Frame Padding"];
m_frame_discard_policy = StringTo<FrameDiscardPolicy>(
j["Frame Discard Policy"].get<std::string>());

try {
m_analog_samples = j.at("Analog Samples");
} catch (const json::out_of_range &e) {
// m_analog_samples = 0;
}
// try{
// std::string adc_mask = j.at("ADC Mask");
// m_adc_mask = std::stoul(adc_mask, nullptr, 16);
// }catch (const json::out_of_range &e) {
// m_adc_mask = 0;
// }

try {
m_digital_samples = j.at("Digital Samples");
} catch (const json::out_of_range &e) {
// m_digital_samples = 0;
}

// //Update detector type for Moench
// //TODO! How does this work with old .raw master files?
// if (m_type == DetectorType::Moench && m_analog_samples == 0 &&
// m_subfile_rows == 400) {
// m_type = DetectorType::Moench03;
// }else if (m_type == DetectorType::Moench && m_subfile_rows == 400 &&
// m_analog_samples == 5000) {
// m_type = DetectorType::Moench03_old;
// }

// //Here we know we have a ChipTestBoard file update the geometry?
// //TODO! Carry on information about digtial, and transceivers
// if (m_type == DetectorType::ChipTestBoard) {
// subfile_rows = 1;
// subfile_cols = m_analog_samples*__builtin_popcount(m_adc_mask);
// }

// // only Eiger had quad
// if (m_type == DetectorType::Eiger) {
// quad = (j["Quad"] == 1);
// }

// m_geometry = {j["Geometry"]["y"], j["Geometry"]["x"]};
}
void RawMasterFile::parse_raw(const std::filesystem::path &fpath) {
throw std::runtime_error("Not implemented");