Skip to content

Commit

Permalink
fix bug in atom does not render when only one atom exists (#953)
Browse files Browse the repository at this point in the history
Co-authored-by: Kai-Hsin Wu <[email protected]>
  • Loading branch information
kaihsin and Kai-Hsin Wu authored May 22, 2024
1 parent 61ffe80 commit 142d349
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/bloqade/visualization/report_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :]:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 :]:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 142d349

Please sign in to comment.