code: def simulate_w(self,
                     index: int,
                     half_turns: float,
                     axis_half_turns: float):
          
          args = self._shard_num_args({
              'index': index,
              'half_turns': half_turns,
              'axis_half_turns': axis_half_turns
          })
          if index >= self._num_shard_qubits:
              # W gate spans shards.
              self._pool.map(_clear_scratch, args)
              self._pool.map(_w_between_shards, args)
              self._pool.map(_copy_scratch_to_state, args)
          else:
              # W gate is within a shard.
              self._pool.map(_w_within_shard, args)
  
          # Normalize after every w.
          norm_squared = np.sum(self._pool.map(_norm_squared, args))
          args = self._shard_num_args({
              'norm_squared': norm_squared
          })
          self._pool.map(_renorm, args)
docs: Simulate a single qubit rotation gate about a X + b Y.
  
          The gate simulated is U = exp(-i pi/2 W half_turns)
              where W = cos(pi axis_half_turns) X + sin(pi axis_half_turns) Y
  
          Args:
            index: The qubit to act on.
            half_turns: The amount of the overall rotation, see the formula
                above.
            axis_half_turns: The angle between the pauli X and Y operators,
                see the formula above.