mirror of
https://github.com/vale981/stocproc
synced 2025-03-05 09:41:42 -05:00
make using relative diff optional for now
This commit is contained in:
parent
404d51d295
commit
52d642c957
2 changed files with 13 additions and 1 deletions
7
stocproc/config.py
Normal file
7
stocproc/config.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
import configparser
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read("stocproc.ini")
|
||||
|
||||
|
||||
USE_NORMALIZED_DIFF = config["FFT"].getboolean("use_normalized_diff", fallback=False)
|
|
@ -24,6 +24,7 @@ import warnings
|
|||
MAX_FLOAT = sys.float_info.max
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from .config import USE_NORMALIZED_DIFF
|
||||
|
||||
class FTReferenceError(Exception):
|
||||
pass
|
||||
|
@ -330,7 +331,11 @@ def _relDiff(xRef, x, norm=1):
|
|||
|
||||
|
||||
def _absDiff(xRef, x, norm=1):
|
||||
return np.max(np.abs(xRef - x)) / norm
|
||||
diff = np.max(np.abs(xRef - x))
|
||||
if USE_NORMALIZED_DIFF:
|
||||
return diff / norm
|
||||
else:
|
||||
return diff
|
||||
|
||||
|
||||
def _f_opt_for_SLSQP_minimizer(
|
||||
|
|
Loading…
Add table
Reference in a new issue