Skip to content

Commit

Permalink
bugfix on iteration and returning master file
Browse files Browse the repository at this point in the history
  • Loading branch information
erikfrojdh committed Nov 28, 2024
1 parent 0df8e4b commit 115dfc0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: aare
version: 2024.11.27.dev0 #TODO! how to not duplicate this?
version: 2024.11.28.dev0 #TODO! how to not duplicate this?


source:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "aare"
version = "2024.11.27.dev0"
version = "2024.11.28.dev0"


[tool.scikit-build]
Expand Down
2 changes: 1 addition & 1 deletion python/aare/RawFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def master(self):
Returns:
RawMasterFile: Master file.
"""
return super().master()
return super().master

def __len__(self) -> int:
"""Return the number of frames in the file.
Expand Down
6 changes: 3 additions & 3 deletions src/RawFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ size_t RawFile::bytes_per_pixel() const {
}

void RawFile::get_frame_into(size_t frame_index, std::byte *frame_buffer, DetectorHeader *header) {

if (frame_index > total_frames()) {
if (frame_index >= total_frames()) {
throw std::runtime_error(LOCATION + "Frame number out of range");
}
std::vector<size_t> frame_numbers(n_subfile_parts);
Expand Down Expand Up @@ -319,7 +318,8 @@ void RawFile::get_frame_into(size_t frame_index, std::byte *frame_buffer, Detect

if (m_module_pixel_0[part_idx].x!=0)
throw std::runtime_error(LOCATION + "Implementation error. x pos not 0.");


//TODO! Risk for out of range access
subfiles[subfile_id][part_idx]->seek(corrected_idx % m_master.max_frames_per_file());
subfiles[subfile_id][part_idx]->read_into(frame_buffer + offset, header);
if (header)
Expand Down

0 comments on commit 115dfc0

Please sign in to comment.