Skip to content

Commit 6fc550e

Browse files
committed
final logging fixes
1 parent 3b5ef6a commit 6fc550e

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

pynumdiff/augmented_data/__augmented_data__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22
import time
33
import copy
44
import math
5-
import warnings
65
import scipy
6+
import logging
7+
8+
logging.basicConfig(
9+
level=logging.INFO,
10+
format="%(asctime)s [%(levelname)s] %(message)s",
11+
handlers=[
12+
logging.FileHandler("debug.log"),
13+
logging.StreamHandler()
14+
]
15+
)
716

817
# included modules
918
from pynumdiff.finite_difference import first_order as finite_difference
@@ -17,12 +26,11 @@
1726
try:
1827
import pydmd.dmdc
1928
except:
20-
warnings.warn('Could not import pydmd. Install pydmd (florisvb fork: https://github.com/florisvb/PyDMD) to use dmd derivatives.')
29+
logging.info('Import Error.\nCould not import pydmd. Install pydmd (florisvb fork: https://github.com/florisvb/PyDMD) to use dmd derivatives.\n')
2130
try:
2231
import cvxpy
2332
except:
24-
warnings.warn('Could not import cvxpy. Install cvxpy (http://www.cvxpy.org/install/index.html) to use linearmodel and nonlinearmodel. \
25-
Recommended solver: MOSEK, free academic license available: https://www.mosek.com/products/academic-licenses/')
33+
logging.info('Import Error.\nCould not import cvxpy. Install cvxpy (http://www.cvxpy.org/install/index.html) to use linearmodel and nonlinearmodel.\nRecommended solver: MOSEK, free academic license available: https://www.mosek.com/products/academic-licenses/\n')
2634

2735
####################################################################################################################################################
2836
# Helper functions

pynumdiff/total_variation_regularization/__total_variation_regularization__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
try:
1919
import cvxpy
2020
except:
21-
logging.info('Import Error.\nCould not import cvxpy.\nTo use convex total variation regularized derivatives,\n install cvxpy (http://www.cvxpy.org/install/index.html)\n\
22-
Recommended solver: MOSEK, free academic license available: https://www.mosek.com/products/academic-licenses/\nDespite this error, you can still use the iterative method.\n')
21+
logging.info('Import Error.\nCould not import cvxpy.\nTo use convex total variation regularized derivatives, install cvxpy (http://www.cvxpy.org/install/index.html)\n\
22+
Recommended solver: MOSEK, free academic license available: https://www.mosek.com/products/academic-licenses/\nDespite this error, you can still use the iterative TVR method.\n')
2323

2424
from pynumdiff.total_variation_regularization import __chartrand_tvregdiff__ as __chartrand_tvregdiff__
2525
import pynumdiff.smooth_finite_difference

0 commit comments

Comments
 (0)