Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Sep 4, 2024
1 parent 0aa76b4 commit 299dbe5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions sources/zarr/large_image_source_zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def _scanZarrArray(self, group, arr, results):
arrays, then total pixels, then channels. 'is_ome' is a boolean.
'series' is a list of the found groups and arrays that match the
best criteria. 'axes', 'axes_values', 'axes_units', and 'channels'
are from the best array. 'associated' is a list of all groups and
arrays that might be associated images. These have to be culled
are from the best array. 'associated' is a list of all groups and
arrays that might be associated images. These have to be culled
for the actual groups used in the series.
"""
attrs = group.attrs.asdict() if group is not None else {}
Expand All @@ -245,11 +245,11 @@ def _scanZarrArray(self, group, arr, results):
axes = {axis['name']: idx for idx, axis in enumerate(
attrs['multiscales'][0]['axes'])}
axes_values = {
axis['name']: axis.get('values')
axis['name']: axis.get('values')
for axis in attrs['multiscales'][0]['axes']
}
axes_units = {
axis['name']: axis.get('unit')
axis['name']: axis.get('unit')
for axis in attrs['multiscales'][0]['axes']
}
if isinstance(attrs['omero'].get('channels'), list):
Expand Down Expand Up @@ -374,7 +374,7 @@ def _readFrameValues(self, found, baseArray):
slicing[axis_index] = i
frame_values[tuple(slicing)] = value
elif isinstance(values, dict):
# non-uniform values are written as dicts
# non-uniform values are written as dicts
# mapping values to index permutations
for value, frame_specs in values.items():
if isinstance(value, str):
Expand All @@ -387,7 +387,7 @@ def _readFrameValues(self, found, baseArray):
slicing[self.frameAxes.index(a)] = i
frame_values[tuple(slicing)] = value
self._frameValues = frame_values

def _validateZarr(self):
"""
Validate that we can read tiles from the zarr parent group in
Expand Down Expand Up @@ -796,13 +796,13 @@ def _getAxisInternalMetadata(self, axis_name):
elif axis_name in ['s', 'c']:
axis_metadata['type'] = 'channel'
if self.frameAxes is not None:
frame_axis_index = self.frameAxes.index(axis_name) if axis_name in self.frameAxes else None
if frame_axis_index is not None and self.frameValues is not None:
all_frame_values = self.frameValues[..., frame_axis_index]
axis_index = self.frameAxes.index(axis_name) if axis_name in self.frameAxes else None
if axis_index is not None and self.frameValues is not None:
all_frame_values = self.frameValues[..., axis_index]
split = np.split(
all_frame_values,
all_frame_values.shape[frame_axis_index],
axis=frame_axis_index,
all_frame_values.shape[axis_index],
axis=axis_index,
)
uniform = all(len(np.unique(a)) == 1 for a in split)
if uniform:
Expand All @@ -820,7 +820,7 @@ def _getAxisInternalMetadata(self, axis_name):
if unit is not None:
axis_metadata['unit'] = unit
return axis_metadata

def _writeInternalMetadata(self):
self._checkEditable()
with self._threadLock and self._processLock:
Expand Down
4 changes: 2 additions & 2 deletions test/test_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def testFrameValues(use_add_tile_args, tmp_path):
}
frame_values_shape = [
*[len(v['values']) for v in axis_spec.values()],
len(axis_spec)
len(axis_spec),
]
frame_values = np.empty(frame_values_shape, dtype=object)

Expand Down Expand Up @@ -705,7 +705,7 @@ def testFrameValues(use_add_tile_args, tmp_path):
IndexC=c,
ValueC=c_value,
Channel=f'Band {c + 1}',
)
),
)
frame += 1
index += 1
Expand Down

0 comments on commit 299dbe5

Please sign in to comment.