Skip to content

Commit 4c91a4e

Browse files
authored
Fix uninitialized var case in LaSsynth (#984)
Initialize the `s_bound` variable if `lasre` does not have correlation surface information. The use case is when we only want to make use of the lasre solution format for visualization, etc.
1 parent 901b630 commit 4c91a4e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

glue/lattice_surgery/lassynth/translators/gltf_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,7 @@ def gltf_generator(lasre: Mapping[str, Any],
24712471
ExistJ = lasre["ExistJ"]
24722472
ColorJ = lasre["ColorJ"]
24732473
ExistK = lasre["ExistK"]
2474+
s_bound = None
24742475
if "CorrIJ" in lasre:
24752476
CorrIJ = lasre["CorrIJ"]
24762477
CorrIK = lasre["CorrIK"]
@@ -2493,7 +2494,7 @@ def gltf_generator(lasre: Mapping[str, Any],
24932494
t_injections = (lasre["optional"]["t_injections"]
24942495
if "t_injections" in lasre["optional"] else [])
24952496

2496-
if s < -1 or (s_bound > 0 and s not in range(-1, s_bound)):
2497+
if s < -1 or (s_bound is not None and s_bound > 0 and s not in range(-1, s_bound)):
24972498
raise ValueError(f"No such stabilizer index {s}.")
24982499

24992500
for i in range(i_bound):

0 commit comments

Comments
 (0)