Skip to content

Commit

Permalink
fix numpy 1.22.4 bug (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed May 26, 2022
1 parent cbc3bef commit 0025e8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/nd2/nd2file.py
Expand Up @@ -365,8 +365,9 @@ def _dask_block(self, copy: bool, block_id: Tuple[int]) -> np.ndarray:
f"Cannot get chunk {block_id} for single frame image."
)
idx = 0
data = self._get_frame(cast(int, idx))[(np.newaxis,) * ncoords]
return data.copy() if copy else data
data = self._get_frame(cast(int, idx))
data = data.copy() if copy else data
return data[(np.newaxis,) * ncoords]
finally:
if was_closed:
self.close()
Expand Down Expand Up @@ -470,7 +471,7 @@ def _expand_coords(self, squeeze=True) -> dict:

coords: Dict[str, Sized] = {
AXIS.Y: np.arange(self.attributes.heightPx) * dy,
AXIS.X: np.arange(self.attributes.widthPx) * dx,
AXIS.X: np.arange(self.attributes.widthPx or 1) * dx,
AXIS.CHANNEL: self._channel_names,
AXIS.POSITION: ["XYPos:0"], # maybe overwritten below
}
Expand Down

0 comments on commit 0025e8b

Please sign in to comment.