Skip to content

Commit

Permalink
Fixed missing post-DFE eye and faulty bathtub extrapolation.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Banas committed Jun 21, 2024
1 parent 4f48510 commit 261e435
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
18 changes: 11 additions & 7 deletions src/pybert/models/bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,18 +852,22 @@ def update_results(self):
xs = linspace(-ui * 1.0e12, ui * 1.0e12, width)
height = 1000
tiny_noise = normal(scale=1e-3, size=len(chnl_out[ignore_samps:])) # to make channel eye easier to view.
y_max = 1.1 * max(abs(array(self.chnl_out)))
y_max = 1.1 * max(abs(array(self.chnl_out[ignore_samps:])))
eye_chnl = calc_eye(ui, samps_per_ui, height, self.chnl_out[ignore_samps:] + tiny_noise, y_max)
y_max = 1.1 * max(abs(array(self.rx_in)))
y_max = 1.1 * max(abs(array(self.rx_in[ignore_samps:])))
eye_tx = calc_eye(ui, samps_per_ui, height, self.rx_in[ignore_samps:], y_max)
y_max = 1.1 * max(abs(array(self.ctle_out)))
y_max = 1.1 * max(abs(array(self.ctle_out[ignore_samps:])))
eye_ctle = calc_eye(ui, samps_per_ui, height, self.ctle_out[ignore_samps:], y_max)
y_max = 1.1 * max(abs(array(self.dfe_out[ignore_samps:])))
i = 0
while clock_times[i] <= ignore_until:
len_clock_times = len(clock_times)
while i < len_clock_times and clock_times[i] < ignore_until:
i += 1
assert i < len(clock_times), "ERROR: Insufficient coverage in 'clock_times' vector."
y_max = 1.1 * max(abs(array(self.dfe_out)))
eye_dfe = calc_eye(ui, samps_per_ui, height, self.dfe_out[ignore_samps:], y_max, clock_times[i:])
if i >= len(clock_times):
self.log("ERROR: Insufficient coverage in 'clock_times' vector.")
eye_dfe = calc_eye(ui, samps_per_ui, height, self.dfe_out[ignore_samps:], y_max)
else:
eye_dfe = calc_eye(ui, samps_per_ui, height, self.dfe_out[ignore_samps:], y_max, array(clock_times[i:]) - ignore_until)
self.plotdata.set_data("eye_index", xs)
self.plotdata.set_data("eye_chnl", eye_chnl)
self.plotdata.set_data("eye_tx", eye_tx)
Expand Down
10 changes: 2 additions & 8 deletions src/pybert/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def calc_eye(ui, samps_per_ui, height, ys, y_max, clock_times=None): # pylint:

# Generate the "heat" picture array.
img_array = zeros([height, width])
if clock_times:
if clock_times is not None:
for clock_time in clock_times:
start_time = clock_time - ui
start_ix = int(start_time / tsamp)
Expand Down Expand Up @@ -1542,13 +1542,7 @@ def make_bathtub(centers, jit_pdf, min_val=0, rj=0, extrap=False): # pylint: di
"""
half_len = len(jit_pdf) // 2
dt = centers[1] - centers[0] # Bins assumed to be uniformly spaced!
try:
jit_pdf_center_of_mass = int(mean([k * pk for (k, pk) in enumerate(jit_pdf)]))
except Exception as err: # pylint: disable=broad-exception-caught
print(f"Error finding jitter PDF center of mass: {err}", flush=True)
jit_pdf_center_of_mass = half_len
_jit_pdf = roll(jit_pdf, half_len - jit_pdf_center_of_mass)
zero_locs = where(fftshift(_jit_pdf) == 0)[0]
zero_locs = where(fftshift(jit_pdf) == 0)[0]
ext_first = 0
ext_last = len(jit_pdf)
if (extrap and len(zero_locs)):
Expand Down

0 comments on commit 261e435

Please sign in to comment.