Skip to content

Commit 4c66c5b

Browse files
authored
Remove unnecessary logging. (#1124)
* Remove unnecessary logging. * Update changelog. * Update Changelog.md * Remove parametrize from test_convert_with_all_params * Adapt rules of filterwarnings.
1 parent f6808db commit 4c66c5b

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
1818
- Added an implementation of padded_with_margins for NDBoundingBox class. [#1120](https://github.com/scalableminds/webknossos-libs/pull/1120)
1919

2020
### Changed
21+
- Removed additional logging messages during image conversion. [#1124](https://github.com/scalableminds/webknossos-libs/pull/1124)
2122

2223
### Fixed
2324
- Fixed an issue where cube jobs upsampling, downsampling and compress failed when performed on more than 3 dimensions. [#1095](https://github.com/scalableminds/webknossos-libs/pull/1095)

webknossos/tests/test_cli.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,13 @@ def test_convert() -> None:
202202
assert (wkw_path / PROPERTIES_FILE_NAME).exists()
203203

204204

205-
@pytest.mark.parametrize(
206-
"origin_path",
207-
[TESTDATA_DIR / "tiff", TESTDATA_DIR / "tiff_with_different_shapes"],
208-
)
209-
def test_convert_with_all_params(origin_path: Path) -> None:
205+
def test_convert_with_all_params() -> None:
210206
"""Tests the functionality of convert subcommand."""
211207

212208
with tmp_cwd():
209+
origin_path = TESTDATA_DIR / "tiff_with_different_shapes"
213210
wkw_path = Path(f"wkw_from_{origin_path.name}")
214-
with pytest.warns(UserWarning):
211+
with pytest.warns(UserWarning, match="Some images are larger than expected,"):
215212
result = runner.invoke(
216213
app,
217214
[

webknossos/webknossos/dataset/_utils/buffered_slice_writer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ def _flush_buffer(self) -> None:
137137
buffer_depth,
138138
).moveaxis(-1, self.dimension)
139139
for chunk_bbox in bbox.chunk(chunk_size):
140-
info(f"Writing chunk {chunk_bbox}.")
140+
if self._use_logging:
141+
info(f"Writing chunk {chunk_bbox}.")
141142

142143
data = np.zeros(
143144
(channel_count, *chunk_bbox.size),

webknossos/webknossos/dataset/dataset.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,20 @@ def from_images(
628628
)
629629

630630
if isinstance(map_filepath_to_layer_name, Dataset.ConversionLayerMapping):
631-
map_filepath_to_layer_name = map_filepath_to_layer_name._to_callable(
632-
input_upath, input_files=input_files, use_bioformats=use_bioformats
633-
)
631+
with warnings.catch_warnings():
632+
warnings.filterwarnings(
633+
"ignore",
634+
category=UserWarning,
635+
module="pims",
636+
)
637+
warnings.filterwarnings(
638+
"once",
639+
category=UserWarning,
640+
module="pims_images",
641+
)
642+
map_filepath_to_layer_name = map_filepath_to_layer_name._to_callable(
643+
input_upath, input_files=input_files, use_bioformats=use_bioformats
644+
)
634645

635646
ds = cls(output_path, voxel_size=voxel_size, name=name)
636647

@@ -666,7 +677,12 @@ def from_images(
666677
warnings.filterwarnings(
667678
"ignore",
668679
category=UserWarning,
669-
message="Not all pims readers could be imported",
680+
module="pims_images",
681+
)
682+
warnings.filterwarnings(
683+
"ignore",
684+
category=UserWarning,
685+
module="pims",
670686
)
671687
for layer_name, filepaths in filepaths_per_layer.items():
672688
filepaths.sort(key=z_slices_sort_key)

0 commit comments

Comments
 (0)