From 142d349cefcc8fea93ad27d8d827b53a0b65b846 Mon Sep 17 00:00:00 2001 From: Kai-Hsin Wu Date: Wed, 22 May 2024 13:51:00 -0400 Subject: [PATCH] fix bug in atom does not render when only one atom exists (#953) Co-authored-by: Kai-Hsin Wu --- src/bloqade/visualization/report_visualize.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bloqade/visualization/report_visualize.py b/src/bloqade/visualization/report_visualize.py index a964fe979..35c8bac2e 100644 --- a/src/bloqade/visualization/report_visualize.py +++ b/src/bloqade/visualization/report_visualize.py @@ -179,7 +179,7 @@ def plot_register_ryd_dense(geo, ryds): labels_vacant.append(idx) density_vacant.append(density) - if len(geo.sites) > 0: + if len(geo.sites) > 1: length_scale = np.inf for i, site_i in enumerate(geo.sites): for site_j in geo.sites[i + 1 :]: @@ -221,7 +221,7 @@ def plot_register_ryd_dense(geo, ryds): title="rydberg density", ) radius = get_radius(length_scale, x_min, x_max, y_min, y_max) - window_size = max(x_max - x_min, y_max - y_min) + window_size = max(x_max - x_min, y_max - y_min, 1) p.x_range = Range1d(x_min - length_scale, x_min + window_size + length_scale) p.y_range = Range1d(y_min - length_scale, y_min + window_size + length_scale) @@ -291,8 +291,9 @@ def plot_register_bits(geo): xs.append(x) bits.append(0) labels.append(idx) + print(x_min, x_max, y_min, y_max) - if len(geo.sites) > 0: + if len(geo.sites) > 1: length_scale = np.inf for i, site_i in enumerate(geo.sites): for site_j in geo.sites[i + 1 :]: @@ -328,7 +329,7 @@ def plot_register_bits(geo): # interpolate between a scale for small lattices # and a scale for larger lattices radius = get_radius(length_scale, x_min, x_max, y_min, y_max) - window_size = max(x_max - x_min, y_max - y_min) + window_size = max(x_max - x_min, y_max - y_min, 1) p.x_range = Range1d(x_min - length_scale, x_min + window_size + length_scale) p.y_range = Range1d(y_min - length_scale, y_min + window_size + length_scale)