Commit 03f0809c authored by Peter Jansweijer's avatar Peter Jansweijer

Repaired hard coded sample period for "wrong correlation"

parent f2d72f4a
......@@ -54,9 +54,9 @@ lib_path = os.path.join(lib_path,"..")
sys.path.insert(0,lib_path)
# import docopt
import lib.LeCroy8254 as DSO
#import lib.LeCroy8254 as DSO
#import lib.Keysight_DSO_S_254A as DSO
import lib.Keysight_DSO_S_254A as DSO
import lib.delay_determination as dd
......@@ -195,9 +195,9 @@ def dowork(filename,dirname):
estimated_max = numpy.argmax(cy) - correlation_zero
# print ("estimated max raw type: ",type(estimated_max))
# if emstimated_max is more + 3 ns: wrong correlation: add 2**7-1 gigabit periods
# if emstimated_max is more + 3 ns: wrong correlation: add 2**7-1 (=PRBS-7) gigabit periods (= 800 ps)
if estimated_max < -400/topt: # -12E-9 / sample_period:
estimated_max = estimated_max + 8128/topt # (2**7-1) * 0.8E-9 / sample_period
estimated_max = numpy.int64(estimated_max + ((2**7-1) * 0.8E-9)/(sample_period*topt)) # (2**7-1) * 0.8E-9 / sample_period
# print ("estimated max type: ",type(estimated_max),estimated_max)
delay1 = sample_period * dd.peak_position(cx, cy, x_estimate = estimated_max)
......@@ -239,7 +239,7 @@ def dowork(filename,dirname):
cor_fig = plt.figure("correlation")
ax = cor_fig.add_subplot(111)
ax.text(0.01,0.95,'correlation of ch: '+str(trace1)+' and '+str(trace2), transform=ax.transAxes)
ax.text(0.01,0.90,'delay at estimated max {0:d} = {1:.6g}'.format(estimated_max,delay1), transform=ax.transAxes)
ax.text(0.01,0.90,'delay at estimated max {0:f} = {1:.6g}'.format(estimated_max,delay1), transform=ax.transAxes)
ax.set_xlabel('sample')
ax.set_ylabel('correlation')
ax.plot(cx,cy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment