def __init__(
        self,
        dense_pauli_string: dps.DensePauliString,
        *,
        exponent_neg: cirq.TParamVal = 1,
        exponent_pos: cirq.TParamVal = 0,
    ) -> None:
        """Initializes the PauliStringPhasorGate.

        Args:
            dense_pauli_string: The DensePauliString defining the positive and
                negative eigenspaces that will be independently phased.
            exponent_neg: How much to phase vectors in the negative eigenspace,
                in the form of the t in (-1)**t = exp(i pi t).
            exponent_pos: How much to phase vectors in the positive eigenspace,
                in the form of the t in (-1)**t = exp(i pi t).

        Raises:
            ValueError: If coefficient is not 1 or -1.
        """
        if dense_pauli_string.coefficient == -1:
            dense_pauli_string = -dense_pauli_string
            exponent_pos, exponent_neg = exponent_neg, exponent_pos

        if dense_pauli_string.coefficient != 1:
            raise ValueError(
                "Given DensePauliString doesn't have +1 and -1 eigenvalues. "
                "dense_pauli_string.coefficient must be 1 or -1."
            )

        self._dense_pauli_string = dense_pauli_string
        self._exponent_neg = value.canonicalize_half_turns(exponent_neg)
        self._exponent_pos = value.canonicalize_half_turns(exponent_pos)
Initializes the PauliStringPhasorGate.

        Args:
            dense_pauli_string: The DensePauliString defining the positive and
                negative eigenspaces that will be independently phased.
            exponent_neg: How much to phase vectors in the negative eigenspace,
                in the form of the t in (-1)**t = exp(i pi t).
            exponent_pos: How much to phase vectors in the positive eigenspace,
                in the form of the t in (-1)**t = exp(i pi t).

        Raises:
            ValueError: If coefficient is not 1 or -1.
        
cirq-core/cirq/ops/pauli_string_phasor.py