Skip to content

Commit

Permalink
Fix named level retrieval from multiscaleimage (#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronwolen authored Oct 3, 2024
1 parent c2a34e5 commit 45a77b7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apis/python/src/tiledbsoma/_multiscale_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,20 @@ def coordinate_space(self, value: CoordinateSpace) -> None:
self._coord_space = value

def get_transform_from_level(self, level: Union[int, str]) -> ScaleTransform:
"""Returns the transformation from user requested level to image reference
"""Returns the transformation from user requested level to the image reference
level.
Lifecycle:
Experimental.
"""
if isinstance(level, str):
level_props = None
for val in self._levels:
if val.name == level:
level_props = val
else:
raise KeyError(f"No level with name '{level}'")
break
else:
raise KeyError("No level with name '{level}'")
else:
level_props = self._levels[level]
ref_level_props = self._schema.reference_level_properties
Expand Down Expand Up @@ -551,11 +553,13 @@ def get_transform_to_level(self, level: Union[int, str]) -> ScaleTransform:
Experimental.
"""
if isinstance(level, str):
level_props = None
for val in self._levels:
if val.name == level:
level_props = val
else:
raise KeyError(f"No level with name '{level}'")
break
else:
raise KeyError("No level with name '{level}'")
else:
level_props = self._levels[level]
ref_level_props = self._schema.reference_level_properties
Expand Down

0 comments on commit 45a77b7

Please sign in to comment.