summaryrefslogtreecommitdiffstats
path: root/dpd/src/subsample_align.py
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-08-21 20:23:17 +0200
committerandreas128 <Andreas>2017-08-21 20:23:17 +0200
commitd7521876d7cb221860b0975b2a25eedca00206b7 (patch)
treed32d46ba6baca93b59b53846a3f0335f6df5d508 /dpd/src/subsample_align.py
parent0c0d145866043c16c3dc73615f35bbac12140b93 (diff)
downloaddabmod-d7521876d7cb221860b0975b2a25eedca00206b7.tar.gz
dabmod-d7521876d7cb221860b0975b2a25eedca00206b7.tar.bz2
dabmod-d7521876d7cb221860b0975b2a25eedca00206b7.zip
Add logging directory creation for all log files
Diffstat (limited to 'dpd/src/subsample_align.py')
-rwxr-xr-xdpd/src/subsample_align.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/dpd/src/subsample_align.py b/dpd/src/subsample_align.py
index 0dc78c1..0a51593 100755
--- a/dpd/src/subsample_align.py
+++ b/dpd/src/subsample_align.py
@@ -1,8 +1,11 @@
+import datetime
+import os
+import logging
+logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename)
+
import numpy as np
from scipy import signal, optimize
-import sys
import matplotlib.pyplot as plt
-import datetime
def gen_omega(length):
if (length % 2) == 1:
@@ -59,15 +62,13 @@ def subsample_align(sig, ref_sig):
if optim_result.success:
best_tau = optim_result.x
- #print("Found subsample delay = {}".format(best_tau))
-
if 1:
corr = np.vectorize(correlate_for_delay)
ixs = np.linspace(-1, 1, 100)
taus = corr(ixs)
dt = datetime.datetime.now().isoformat()
- tau_path = ("/tmp/" + dt + "_tau.pdf")
+ tau_path = (logging_path + "/" + dt + "_tau.pdf")
plt.plot(ixs, taus)
plt.title("Subsample correlation, minimum is best: {}".format(best_tau))
plt.savefig(tau_path)