Skip to content

Commit

Permalink
raise in plot if slices results in a dataset which is not 2D
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Feb 6, 2025
1 parent 5ef26fe commit c81e2b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dkist/dataset/tiled_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ def plot(self, slice_index, share_zscale=False, figure=None, swap_tile_limits: L
figure = plt.gcf()

sliced_dataset = self.slice_tiles[slice_index]
if (nd_sliced := len(sliced_dataset.flat[0].shape)) != 2:
raise ValueError(
f"Applying slice '{slice_index}' to this dataset resulted in a {nd_sliced} "
"dimensional dataset, you should pass a slice which results in a 2D dataset for each tile."
)
dataset_ncols, dataset_nrows = sliced_dataset.shape
gridspec = GridSpec(nrows=dataset_nrows, ncols=dataset_ncols, figure=figure)
for col in range(dataset_ncols):
Expand Down

0 comments on commit c81e2b2

Please sign in to comment.