Skip to content

Commit

Permalink
Slight generalisation to make the tests pass and hopefully catch any
Browse files Browse the repository at this point in the history
weird data
  • Loading branch information
SolarDrew committed Aug 23, 2024
1 parent f7e96bb commit bcf1d8d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dkist/dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ def dataset_info_str(ds):
instr = ds.inventory.get("instrumentName", "")
if instr:
instr += " "
nframes = ds.inventory.get("frameCount", "")
nframes = ds.inventory.get("frameCount", "an unknown number")
dsID = ds.inventory.get("datasetId", "(no DatasetID)")

if is_tiled:
s = f"This {dstype} {ds.inventory['datasetId']} consists of an array of {tile_shape} Dataset objects\n\nEach "
s = f"This {dstype} {dsID} consists of an array of {tile_shape} Dataset objects\n\nEach "
else:
s = "This "

s += f"{instr}Dataset {ds.inventory['datasetId']} has {wcs.pixel_n_dim} pixel and {wcs.world_n_dim} world dimensions and consists of {nframes} frames\n"
s += f"{instr}Dataset {dsID} has {wcs.pixel_n_dim} pixel and {wcs.world_n_dim} world dimensions and consists of {nframes} frames\n"
if ds.files:
s += f"Files are stored in {ds.files.basepath}\n\n"
s += f"The data are represented by a {type(ds.data)} object:\n{ds.data}\n\n"
Expand Down Expand Up @@ -120,7 +121,10 @@ def _get_pp_matrix(wcs):
header = np.vstack([[s.center(width) for s in wrapped[l]] for l, _ in enumerate(labels)]).T

mstr = np.insert(mstr, 0, header, axis=0)
world = ["", "WORLD DIMENSIONS", *list(wcs.world_axis_names)]
world = ["WORLD DIMENSIONS", *list(wcs.world_axis_names)]
nrows = maxlines + len(wcs.world_axis_names)
while len(world) < nrows:
world.insert(0, "")
mstr = np.insert(mstr, 0, world, axis=1)
widths = [np.max([len(a) for a in col]) for col in mstr.T]
mstr = np.insert(mstr, 2, ["-"*wid for wid in widths], axis=0)
Expand Down

0 comments on commit bcf1d8d

Please sign in to comment.