Skip to content

Commit

Permalink
added check for mrc dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Dingel321 committed Feb 6, 2024
1 parent 29a6cc8 commit 4eeb9fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cryo_sbi/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,12 @@ def save_index_map(self, path: str):
assert (
self._index_map is not None
), "Index map not built. First call build_index_map()"
np.savez(path, path_index=self._path_index, file_index=self._file_index)
np.savez(
path,
path_index=self._path_index,
file_index=self._file_index,
paths=self.paths,
)

def load_index_map(self, path: str):
"""
Expand All @@ -384,6 +389,7 @@ def load_index_map(self, path: str):
path (str): Path to load the index map.
"""
index_map = np.load(path)
assert self.paths == index_map["paths"], "Paths do not match the index map."
self._path_index = index_map["path_index"]
self._file_index = index_map["file_index"]
self._index_map = True
Expand Down

0 comments on commit 4eeb9fc

Please sign in to comment.