-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57edb34
commit 2f1f137
Showing
3 changed files
with
185 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import nd2 | ||
import numpy as np | ||
|
||
|
||
def test_rescue(single_nd2): | ||
# TODO: we could potentially put more of this logic into convenience functions | ||
# we can't do too much magic about guessing shape and dtype since some files | ||
# may not have that information intact | ||
with nd2.ND2File(single_nd2) as rdr: | ||
real_read = rdr.asarray() | ||
raw_frames = [ | ||
f.transpose((2, 0, 1, 3)).squeeze() | ||
for f in nd2.rescue_nd2( | ||
single_nd2, frame_shape=rdr._raw_frame_shape, dtype=rdr.dtype | ||
) | ||
] | ||
raw_read: np.ndarray = np.stack(raw_frames).reshape(rdr.shape) | ||
np.testing.assert_array_equal(real_read, raw_read) |