pub fn emit_bloq_stim_with_stim_noise(
program: &Bloq,
noise: &impl NoiseModel,
) -> Result<String, StimNoiseError>Expand description
Emit program as Stim text with noise applied to each node’s chunk
separately.
Distinct from BloqStimOptions::with_noise, which materializes a
bloq_circuit::NoiseModel into each node’s instantiated circuit before
emission. This one runs stim’s own noise models over the emitted text,
and it does so per chunk for a reason: a node’s leading and trailing MPP
boundaries are ideal, noiseless operations (proxy ports, boundary
observables), and stim’s noisy_circuit_skipping_mpp_boundaries only
recognizes them at the ends of the circuit it is handed. Noising the whole
program in one call would bury each node’s boundaries in the middle and
noise them, and it would spread idle depolarization across qubits belonging
to patches that are merely coexisting in time.
Chunks are reassembled afterwards, so cross-chunk rec[-k] targets resolve
exactly as they do in emit_bloq_stim.
§Errors
StimNoiseError::Emission if the program does not emit, and
StimNoiseError::Node if stim rejects a chunk.
§Examples
let noise = UniformDepolarizing::new(1e-3)?;
let text = emit_bloq_stim_with_stim_noise(program, &noise)?;