Issue description
I was playing around with chunks that map logical X to logical Z and noticed that then_reflow uses old Flow API when calling with_edits.
import stimflow as sf
import stim
lz = sf.PauliMap.from_zs([0]).with_obs_name('LZ')
lx = sf.PauliMap.from_xs([0]).with_obs_name('LX')
lz_aliased = lx.with_obs_name('LZ') # same obs_name as lz, so Flow validator passes
circuit = stim.Circuit('''
QUBIT_COORDS(0, 0) 0
H 0
''')
chunk = sf.Chunk(
circuit=circuit,
flows=[sf.Flow(start=lz, end=lz_aliased)],
)
reflow = sf.ChunkReflow(out2in={lx: [lz_aliased]})
# _then_reflow calls flow.with_edits(obs_name=None) with has no obs_name
try:
result = chunk.then(reflow)
except TypeError as e:
print('Bug:', e)
Additional question
Could you also clarify the use of obs_name?
A flow's start and end PauliMap need to have matching names
if isinstance(start, PauliMap) and isinstance(end, PauliMap) and start.obs_name != end.obs_name:
raise ValueError(f'{start.obs_name=} != {end.obs_name=}')
The examples in the repo use "LX" and "LZ". Following the example I have a hard time implementing a chunk with flows that maps "LX" to "LZ". I feel like an observable index plus basis indicator, e.g. (0, "LX") would work but the unit tests for C4 code use "LX0" and "LX1" so I tried to stick with the convention.
A short explanation or code snippet would help a lot to correct my mental model. Thanks a lot!
Issue description
I was playing around with chunks that map logical X to logical Z and noticed that
then_reflowuses old Flow API when callingwith_edits.Additional question
Could you also clarify the use of
obs_name?A flow's
startandendPauliMapneed to have matching namesThe examples in the repo use "LX" and "LZ". Following the example I have a hard time implementing a chunk with flows that maps "LX" to "LZ". I feel like an observable index plus basis indicator, e.g.
(0, "LX")would work but the unit tests for C4 code use "LX0" and "LX1" so I tried to stick with the convention.A short explanation or code snippet would help a lot to correct my mental model. Thanks a lot!