str_to_pauli_term

forest.benchmarking.utils.str_to_pauli_term(pauli_str: str, qubit_labels=None)

Convert a string into a PauliTerm.

>>> str_to_pauli_term('XY', [])
Parameters:
  • pauli_str (str) – The input string, made of of ‘I’, ‘X’, ‘Y’ or ‘Z’
  • qubit_labels – The integer labels for the qubits in the string If None, default to the range of the length of pauli_str.
Returns:

the corresponding PauliTerm

Return type:

pyquil.paulis.PauliTerm