Skip to content

Commit

Permalink
Merge branch 'main' into developer
Browse files Browse the repository at this point in the history
  • Loading branch information
erikfrojdh authored Nov 12, 2024
2 parents db936b6 + 349e3af commit 17917ac
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ AARE
pyVarClusterFinder


.. toctree::
:caption: Python API
:maxdepth: 1

pyFile
pyCtbRawFile
pyRawMasterFile
pyVarClusterFinder


.. toctree::
:caption: C++ API
:maxdepth: 1
Expand Down
3 changes: 2 additions & 1 deletion include/aare/RawFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class RawFile : public FileInterface {
void read_into(std::byte *image_buf, DetectorHeader *header);
void read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *header);


size_t frame_number(size_t frame_index) override;
size_t bytes_per_frame() override;
size_t pixels_per_frame() override;
Expand All @@ -74,13 +75,13 @@ class RawFile : public FileInterface {
size_t rows() const override;
size_t cols() const override;
size_t bitdepth() const override;

xy geometry();
size_t n_mod() const;

RawMasterFile master() const;



DetectorType detector_type() const override;

private:
Expand Down
1 change: 1 addition & 0 deletions include/aare/RawMasterFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct ROI{
size_t width() const { return xmax - xmin; }
}__attribute__((packed));


/**
* @brief Class for parsing a master file either in our .json format or the old
* .raw format
Expand Down
3 changes: 3 additions & 0 deletions python/examples/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def get_Mh02_frames(fname):
# # cols = 1024-roi.xmin
# # sf = RawSubFile(base / raw, DetectorType.Jungfrau, rows, cols, 16)

from aare import RawFile



from aare import RawFile, File
Expand All @@ -87,6 +89,7 @@ def get_Mh02_frames(fname):
# fname = Path(base / 'jungfrau/jungfrau_single_master_0.json')
# fname = base / 'Stacked/241024_JF10_m450_m367_KnifeEdge_TestBesom_9keV_750umFilter_PedestalStart_ZPos_-6_master_0.json'


f = RawFile(fname)
h,img = f.read_frame()
print(f'{h["frameNumber"]}')
3 changes: 2 additions & 1 deletion python/src/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void define_file_io_bindings(py::module &m) {
});



py::class_<ScanParameters>(m, "ScanParameters")
.def(py::init<const std::string &>())
.def(py::init<const ScanParameters &>())
Expand Down Expand Up @@ -199,6 +199,7 @@ void define_file_io_bindings(py::module &m) {




py::class_<RawSubFile>(m, "RawSubFile")
.def(py::init<const std::filesystem::path &, DetectorType, size_t,
size_t, size_t>())
Expand Down
4 changes: 3 additions & 1 deletion src/RawFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void RawFile::read_into(std::byte *image_buf) {


void RawFile::read_into(std::byte *image_buf, DetectorHeader *header) {

return get_frame_into(m_current_frame++, image_buf, header);
};

Expand All @@ -61,6 +62,7 @@ void RawFile::read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *h
if(header)
header+=n_mod();
}

};

size_t RawFile::n_mod() const { return n_subfile_parts; }
Expand Down Expand Up @@ -128,7 +130,6 @@ DetectorHeader RawFile::read_header(const std::filesystem::path &fname) {
return h;
}


int RawFile::find_number_of_subfiles() {
int n_files = 0;
// f0,f1...fn How many files is the data split into?
Expand Down Expand Up @@ -219,6 +220,7 @@ void RawFile::update_geometry_with_roi() {
} else {
if ((roi.ymin > m.y) && (roi.ymin < m.y + m.height)) {
m.height -= roi.ymin - m.y;

}
if (roi.ymax < m.y + m.height) {
m.height -= m.y + original_height - roi.ymax;
Expand Down

0 comments on commit 17917ac

Please sign in to comment.