Skip to content

Commit 0528f7d

Browse files
committed
[JTH] add logger intead of print in pca and rbf initialisations
1 parent c022bb3 commit 0528f7d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bluemath_tk/datamining/pca.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ def __init__(
132132
If n_components is not an integer when it is greater than or equal to 1.
133133
"""
134134

135+
super().__init__()
136+
self.set_logger_name(
137+
name=self.__class__.__name__, level="DEBUG" if debug else "INFO"
138+
)
139+
135140
initial_msg = f"""
136141
-------------------------------------------------------------------
137142
| Initializing PCA reduction model with the following parameters:
@@ -140,12 +145,7 @@ def __init__(
140145
| For more information, please refer to the documentation.
141146
-------------------------------------------------------------------
142147
"""
143-
print(initial_msg)
144-
145-
super().__init__()
146-
self.set_logger_name(
147-
name=self.__class__.__name__, level="DEBUG" if debug else "INFO"
148-
)
148+
self.logger.info(initial_msg)
149149

150150
if n_components <= 0:
151151
raise ValueError("Number of components must be greater than 0.")

bluemath_tk/interpolation/rbf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ def __init__(
210210
If the smooth is not a positive float.
211211
"""
212212

213+
super().__init__()
214+
self.set_logger_name(name=self.__class__.__name__)
215+
213216
initial_msg = f"""
214217
---------------------------------------------------------------------------------
215218
| Initializing RBF interpolation model with the following parameters:
@@ -223,10 +226,8 @@ def __init__(
223226
| Recommended lecture: https://link.springer.com/article/10.1023/A:1018975909870
224227
---------------------------------------------------------------------------------
225228
"""
226-
print(initial_msg)
229+
self.logger.info(initial_msg)
227230

228-
super().__init__()
229-
self.set_logger_name(name=self.__class__.__name__)
230231
if not isinstance(sigma_min, float) or sigma_min < 0:
231232
raise ValueError("sigma_min must be a positive float.")
232233
self._sigma_min = sigma_min

0 commit comments

Comments
 (0)