Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion rsciio/ripple/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def read_raw(rpl_info, filename, chunks="auto"):
elif record_by == "dont-care": # stack of images
shape = (height, width)

# "squeeze" shape
shape = tuple(s for s in shape if s > 1)

data = memmap_distributed(
filename,
offset=offset,
Expand All @@ -258,7 +261,7 @@ def read_raw(rpl_info, filename, chunks="auto"):
chunks=chunks,
)

return data.squeeze()
return data


@distributed_keyword_deprecation
Expand Down
12 changes: 11 additions & 1 deletion rsciio/tests/test_ripple.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,19 @@ def test_load_chunks(tmp_path):
assert tuple([c[0] for c in s2.data.chunks]) == chunks


def test_load_chunks_1D(tmp_path):
s = _create_signal(shape=(20,), dim=1, dtype="uint16")
fname = tmp_path / "test_chunks_1D.rpl"
s.save(fname)

chunks = (10,)
s2 = hs.load(fname, lazy=True, chunks=chunks)
assert tuple([c[0] for c in s2.data.chunks]) == chunks


def test_load_not_lazy(tmp_path):
s = _create_signal(shape=(20, 30, 40), dim=1, dtype="uint16")
fname = tmp_path / "test_chunks.rpl"
fname = tmp_path / "test_chunks_not_lazy.rpl"
s.save(fname)

chunks = (10, 15, 40)
Expand Down
Loading