We're celebrating World Quantum Day 2022! Join us

cirq.transformers.drop_terminal_measurements

Removes terminal measurements from a circuit.

This transformer is helpful when trying to capture the final state vector of a circuit with many terminal measurements, as simulating the circuit with those measurements in place would otherwise collapse the final state.

circuit The circuit to transform. It will not be modified.
context cirq.TransformerContext storing common configurable options for transformers. The default has deep=True, as "terminal measurements" is ill-defined without inspecting subcircuits; passing a context with deep=False will return an error.

A copy of the circuit, with identity or X gates in place of terminal measurements.

ValueError if the circuit contains non-terminal measurements, or if the provided context hasdeep=False.