Skip to content

Commit 4db2370

Browse files
committed
Switch prints with logging
1 parent 9d8feb7 commit 4db2370

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

topofileformats/jpk.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
import numpy as np
77
import tifffile
88

9+
from topofileformats.logging import logger
10+
11+
logger.enable(__package__)
12+
913

1014
def _jpk_pixel_to_nm_scaling(tiff_page: tifffile.tifffile.TiffPage) -> float:
1115
"""
@@ -48,13 +52,13 @@ def load_jpk(file_path: Path | str, channel: str) -> tuple[np.ndarray, float]:
4852
tuple[npt.NDArray, float]
4953
A tuple containing the image and its pixel to nanometre scaling value.
5054
"""
51-
print(f"Loading image from : {file_path}")
55+
logger.info(f"Loading image from : {file_path}")
5256
file_path = Path(file_path)
5357
filename = file_path.stem
5458
try:
5559
tif = tifffile.TiffFile(file_path)
5660
except FileNotFoundError:
57-
print(f"[{filename}] File not found : {file_path}")
61+
logger.error(f"[{filename}] File not found : {file_path}")
5862
raise
5963
# Obtain channel list for all channels in file
6064
channel_list = {}
@@ -68,7 +72,7 @@ def load_jpk(file_path: Path | str, channel: str) -> tuple[np.ndarray, float]:
6872
try:
6973
channel_idx = channel_list[channel]
7074
except KeyError:
71-
print(f"{channel} not in channel list: {channel_list}")
75+
logger.error(f"{channel} not in channel list: {channel_list}")
7276
raise
7377

7478
# Get image and if applicable, scale it

0 commit comments

Comments
 (0)