We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Handedness between ISwapPowGate and FSim is different.
The ISwapPowGate and FSim gate rotate in different directions on the |01>, |10> subspace.  This feels a bit odd to me. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cirq/ops/fsim_gate.py`
Content:
```
1 # Copyright 2019 The Cirq Developers
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """Defines the fermionic simulation gate family.
15 
16 This is the family of two-qubit gates that preserve excitations (number of ON
17 qubits), ignoring single-qubit gates and global phase. For example, when using
18 the second quantized representation of electrons to simulate chemistry, this is
19 a natural gateset because each ON qubit corresponds to an electron and in the
20 context of chemistry the electron count is conserved over time. This property
21 applies more generally to fermions, thus the name of the gate.
22 """
23 
24 import cmath
25 import math
26 from typing import Optional
27 
28 import numpy as np
29 
30 import cirq
31 from cirq import protocols, value
32 from cirq._compat import proper_repr
33 from cirq.ops import gate_features
34 
35 
36 @value.value_equality(approximate=True)
37 class FSimGate(gate_features.TwoQubitGate,
38                gate_features.InterchangeableQubitsGate):
39     """Fermionic simulation gate family.
40 
41     Contains all two qubit interactions that preserve excitations, up to
42     single-qubit rotations and global phase.
43 
44     The unitary matrix of this gate is:
45 
46         [[1, 0, 0, 0],
47          [0, a, b, 0],
48          [0, b, a, 0],
49          [0, 0, 0, c]]
50 
51     where:
52 
53         a = cos(theta)
54         b = -i·sin(theta)
55         c = exp(-i·phi)
56     """
57 
58     def __init__(self, theta: float, phi: float):
59         """
60         Args:
61             theta: The strength of the XX+YY interaction, in radians.
62             phi: CPhase angle in radians. Determines how much the |11⟩ state is
63                 phased.
64         """
65         self.theta = theta
66         self.phi = phi
67 
68     def _value_equality_values_(self):
69         return self.theta, self.phi
70 
71     def _is_parameterized_(self):
72         return cirq.is_parameterized(self.theta) or cirq.is_parameterized(
73             self.phi)
74 
75     def _unitary_(self) -> Optional[np.ndarray]:
76         if cirq.is_parameterized(self):
77             return None
78         a = math.cos(self.theta)
79         b = -1j * math.sin(self.theta)
80         c = cmath.exp(-1j * self.phi)
81         return np.array([
82             [1, 0, 0, 0],
83             [0, a, b, 0],
84             [0, b, a, 0],
85             [0, 0, 0, c],
86         ])
87 
88     def _pauli_expansion_(self) -> value.LinearDict[str]:
89         if protocols.is_parameterized(self):
90             return NotImplemented
91         a = math.cos(self.theta)
92         b = -1j * math.sin(self.theta)
93         c = cmath.exp(-1j * self.phi)
94         return value.LinearDict({
95             'II': (1 + c) / 4 + a / 2,
96             'IZ': (1 - c) / 4,
97             'ZI': (1 - c) / 4,
98             'ZZ': (1 + c) / 4 - a / 2,
99             'XX': b / 2,
100             'YY': b / 2,
101         })
102 
103     def _resolve_parameters_(self, param_resolver: 'cirq.ParamResolver'
104                             ) -> 'cirq.FSimGate':
105         return FSimGate(
106             protocols.resolve_parameters(self.theta, param_resolver),
107             protocols.resolve_parameters(self.phi, param_resolver))
108 
109     def _apply_unitary_(self,
110                         args: 'cirq.ApplyUnitaryArgs') -> Optional[np.ndarray]:
111         if cirq.is_parameterized(self):
112             return None
113         if self.theta != 0:
114             inner_matrix = protocols.unitary(cirq.Rx(2 * self.theta))
115             oi = args.subspace_index(0b01)
116             io = args.subspace_index(0b10)
117             out = cirq.apply_matrix_to_slices(args.target_tensor,
118                                               inner_matrix,
119                                               slices=[oi, io],
120                                               out=args.available_buffer)
121         else:
122             out = args.target_tensor
123         if self.phi != 0:
124             ii = args.subspace_index(0b11)
125             out[ii] *= cmath.exp(-1j * self.phi)
126         return out
127 
128     def _decompose_(self, qubits) -> 'cirq.OP_TREE':
129         a, b = qubits
130         xx = cirq.XXPowGate(exponent=self.theta / np.pi, global_shift=-0.5)
131         yy = cirq.YYPowGate(exponent=self.theta / np.pi, global_shift=-0.5)
132         yield xx(a, b)
133         yield yy(a, b)
134         yield cirq.CZ(a, b)**(-self.phi / np.pi)
135 
136     def _circuit_diagram_info_(self, args: 'cirq.CircuitDiagramInfoArgs'):
137         t = _format_rads(args, self.theta)
138         p = _format_rads(args, self.phi)
139         return 'fsim({}, {})'.format(t, p), '#2'
140 
141     def __pow__(self, power):
142         return FSimGate(cirq.mul(self.theta, power), cirq.mul(self.phi, power))
143 
144     def __repr__(self):
145         return 'cirq.FSimGate(theta={}, phi={})'.format(proper_repr(self.theta),
146                                                         proper_repr(self.phi))
147 
148 
149 def _format_rads(args: 'cirq.CircuitDiagramInfoArgs', radians: float) -> str:
150     if cirq.is_parameterized(radians):
151         return str(radians)
152     unit = 'π' if args.use_unicode_characters else 'pi'
153     if radians == np.pi:
154         return unit
155     if radians == 0:
156         return '0'
157     if radians == -np.pi:
158         return '-' + unit
159     if args.precision is not None:
160         quantity = '{{:.{}}}'.format(args.precision).format(radians / np.pi)
161         return quantity + unit
162     return repr(radians)
163
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cirq/ops/fsim_gate.py b/cirq/ops/fsim_gate.py
--- a/cirq/ops/fsim_gate.py
+++ b/cirq/ops/fsim_gate.py
@@ -53,14 +53,23 @@
         a = cos(theta)
         b = -i·sin(theta)
         c = exp(-i·phi)
+
+    Note the difference in sign conventions between FSimGate and the
+    ISWAP and CZPowGate:
+
+        FSimGate(θ, φ) = ISWAP**(-2θ/π) CZPowGate(exponent=-φ/π)
     """
 
     def __init__(self, theta: float, phi: float):
         """
         Args:
-            theta: The strength of the XX+YY interaction, in radians.
-            phi: CPhase angle in radians. Determines how much the |11⟩ state is
-                phased.
+            theta: Swap angle on the span(|01⟩, |10⟩) subspace, in radians.
+                Determined by the strength and duration of the XX+YY
+                interaction. Note: uses opposite sign convention to the
+                iSWAP gate.
+            phi: Controlled phase angle, in radians. Determines how much the
+                |11⟩ state is phased. Note: uses opposite sign convention to
+                the CZPowGate.
         """
         self.theta = theta
         self.phi = phi

{"golden_diff": "diff --git a/cirq/ops/fsim_gate.py b/cirq/ops/fsim_gate.py\n--- a/cirq/ops/fsim_gate.py\n+++ b/cirq/ops/fsim_gate.py\n@@ -53,14 +53,23 @@\n         a = cos(theta)\n         b = -i\u00b7sin(theta)\n         c = exp(-i\u00b7phi)\n+\n+    Note the difference in sign conventions between FSimGate and the\n+    ISWAP and CZPowGate:\n+\n+        FSimGate(\u03b8, \u03c6) = ISWAP**(-2\u03b8/\u03c0) CZPowGate(exponent=-\u03c6/\u03c0)\n     \"\"\"\n \n     def __init__(self, theta: float, phi: float):\n         \"\"\"\n         Args:\n-            theta: The strength of the XX+YY interaction, in radians.\n-            phi: CPhase angle in radians. Determines how much the |11\u27e9 state is\n-                phased.\n+            theta: Swap angle on the span(|01\u27e9, |10\u27e9) subspace, in radians.\n+                Determined by the strength and duration of the XX+YY\n+                interaction. Note: uses opposite sign convention to the\n+                iSWAP gate.\n+            phi: Controlled phase angle, in radians. Determines how much the\n+                |11\u27e9 state is phased. Note: uses opposite sign convention to\n+                the CZPowGate.\n         \"\"\"\n         self.theta = theta\n         self.phi = phi\n", "issue": "Handedness between ISwapPowGate and FSim is different.\nThe ISwapPowGate and FSim gate rotate in different directions on the |01>, |10> subspace.  This feels a bit odd to me. \n", "before_files": [{"content": "# Copyright 2019 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Defines the fermionic simulation gate family.\n\nThis is the family of two-qubit gates that preserve excitations (number of ON\nqubits), ignoring single-qubit gates and global phase. For example, when using\nthe second quantized representation of electrons to simulate chemistry, this is\na natural gateset because each ON qubit corresponds to an electron and in the\ncontext of chemistry the electron count is conserved over time. This property\napplies more generally to fermions, thus the name of the gate.\n\"\"\"\n\nimport cmath\nimport math\nfrom typing import Optional\n\nimport numpy as np\n\nimport cirq\nfrom cirq import protocols, value\nfrom cirq._compat import proper_repr\nfrom cirq.ops import gate_features\n\n\n@value.value_equality(approximate=True)\nclass FSimGate(gate_features.TwoQubitGate,\n               gate_features.InterchangeableQubitsGate):\n    \"\"\"Fermionic simulation gate family.\n\n    Contains all two qubit interactions that preserve excitations, up to\n    single-qubit rotations and global phase.\n\n    The unitary matrix of this gate is:\n\n        [[1, 0, 0, 0],\n         [0, a, b, 0],\n         [0, b, a, 0],\n         [0, 0, 0, c]]\n\n    where:\n\n        a = cos(theta)\n        b = -i\u00b7sin(theta)\n        c = exp(-i\u00b7phi)\n    \"\"\"\n\n    def __init__(self, theta: float, phi: float):\n        \"\"\"\n        Args:\n            theta: The strength of the XX+YY interaction, in radians.\n            phi: CPhase angle in radians. Determines how much the |11\u27e9 state is\n                phased.\n        \"\"\"\n        self.theta = theta\n        self.phi = phi\n\n    def _value_equality_values_(self):\n        return self.theta, self.phi\n\n    def _is_parameterized_(self):\n        return cirq.is_parameterized(self.theta) or cirq.is_parameterized(\n            self.phi)\n\n    def _unitary_(self) -> Optional[np.ndarray]:\n        if cirq.is_parameterized(self):\n            return None\n        a = math.cos(self.theta)\n        b = -1j * math.sin(self.theta)\n        c = cmath.exp(-1j * self.phi)\n        return np.array([\n            [1, 0, 0, 0],\n            [0, a, b, 0],\n            [0, b, a, 0],\n            [0, 0, 0, c],\n        ])\n\n    def _pauli_expansion_(self) -> value.LinearDict[str]:\n        if protocols.is_parameterized(self):\n            return NotImplemented\n        a = math.cos(self.theta)\n        b = -1j * math.sin(self.theta)\n        c = cmath.exp(-1j * self.phi)\n        return value.LinearDict({\n            'II': (1 + c) / 4 + a / 2,\n            'IZ': (1 - c) / 4,\n            'ZI': (1 - c) / 4,\n            'ZZ': (1 + c) / 4 - a / 2,\n            'XX': b / 2,\n            'YY': b / 2,\n        })\n\n    def _resolve_parameters_(self, param_resolver: 'cirq.ParamResolver'\n                            ) -> 'cirq.FSimGate':\n        return FSimGate(\n            protocols.resolve_parameters(self.theta, param_resolver),\n            protocols.resolve_parameters(self.phi, param_resolver))\n\n    def _apply_unitary_(self,\n                        args: 'cirq.ApplyUnitaryArgs') -> Optional[np.ndarray]:\n        if cirq.is_parameterized(self):\n            return None\n        if self.theta != 0:\n            inner_matrix = protocols.unitary(cirq.Rx(2 * self.theta))\n            oi = args.subspace_index(0b01)\n            io = args.subspace_index(0b10)\n            out = cirq.apply_matrix_to_slices(args.target_tensor,\n                                              inner_matrix,\n                                              slices=[oi, io],\n                                              out=args.available_buffer)\n        else:\n            out = args.target_tensor\n        if self.phi != 0:\n            ii = args.subspace_index(0b11)\n            out[ii] *= cmath.exp(-1j * self.phi)\n        return out\n\n    def _decompose_(self, qubits) -> 'cirq.OP_TREE':\n        a, b = qubits\n        xx = cirq.XXPowGate(exponent=self.theta / np.pi, global_shift=-0.5)\n        yy = cirq.YYPowGate(exponent=self.theta / np.pi, global_shift=-0.5)\n        yield xx(a, b)\n        yield yy(a, b)\n        yield cirq.CZ(a, b)**(-self.phi / np.pi)\n\n    def _circuit_diagram_info_(self, args: 'cirq.CircuitDiagramInfoArgs'):\n        t = _format_rads(args, self.theta)\n        p = _format_rads(args, self.phi)\n        return 'fsim({}, {})'.format(t, p), '#2'\n\n    def __pow__(self, power):\n        return FSimGate(cirq.mul(self.theta, power), cirq.mul(self.phi, power))\n\n    def __repr__(self):\n        return 'cirq.FSimGate(theta={}, phi={})'.format(proper_repr(self.theta),\n                                                        proper_repr(self.phi))\n\n\ndef _format_rads(args: 'cirq.CircuitDiagramInfoArgs', radians: float) -> str:\n    if cirq.is_parameterized(radians):\n        return str(radians)\n    unit = '\u03c0' if args.use_unicode_characters else 'pi'\n    if radians == np.pi:\n        return unit\n    if radians == 0:\n        return '0'\n    if radians == -np.pi:\n        return '-' + unit\n    if args.precision is not None:\n        quantity = '{{:.{}}}'.format(args.precision).format(radians / np.pi)\n        return quantity + unit\n    return repr(radians)\n", "path": "cirq/ops/fsim_gate.py"}], "after_files": [{"content": "# Copyright 2019 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Defines the fermionic simulation gate family.\n\nThis is the family of two-qubit gates that preserve excitations (number of ON\nqubits), ignoring single-qubit gates and global phase. For example, when using\nthe second quantized representation of electrons to simulate chemistry, this is\na natural gateset because each ON qubit corresponds to an electron and in the\ncontext of chemistry the electron count is conserved over time. This property\napplies more generally to fermions, thus the name of the gate.\n\"\"\"\n\nimport cmath\nimport math\nfrom typing import Optional\n\nimport numpy as np\n\nimport cirq\nfrom cirq import protocols, value\nfrom cirq._compat import proper_repr\nfrom cirq.ops import gate_features\n\n\n@value.value_equality(approximate=True)\nclass FSimGate(gate_features.TwoQubitGate,\n               gate_features.InterchangeableQubitsGate):\n    \"\"\"Fermionic simulation gate family.\n\n    Contains all two qubit interactions that preserve excitations, up to\n    single-qubit rotations and global phase.\n\n    The unitary matrix of this gate is:\n\n        [[1, 0, 0, 0],\n         [0, a, b, 0],\n         [0, b, a, 0],\n         [0, 0, 0, c]]\n\n    where:\n\n        a = cos(theta)\n        b = -i\u00b7sin(theta)\n        c = exp(-i\u00b7phi)\n\n    Note the difference in sign conventions between FSimGate and the\n    ISWAP and CZPowGate:\n\n        FSimGate(\u03b8, \u03c6) = ISWAP**(-2\u03b8/\u03c0) CZPowGate(exponent=-\u03c6/\u03c0)\n    \"\"\"\n\n    def __init__(self, theta: float, phi: float):\n        \"\"\"\n        Args:\n            theta: Swap angle on the span(|01\u27e9, |10\u27e9) subspace, in radians.\n                Determined by the strength and duration of the XX+YY\n                interaction. Note: uses opposite sign convention to the\n                iSWAP gate.\n            phi: Controlled phase angle, in radians. Determines how much the\n                |11\u27e9 state is phased. Note: uses opposite sign convention to\n                the CZPowGate.\n        \"\"\"\n        self.theta = theta\n        self.phi = phi\n\n    def _value_equality_values_(self):\n        return self.theta, self.phi\n\n    def _is_parameterized_(self):\n        return cirq.is_parameterized(self.theta) or cirq.is_parameterized(\n            self.phi)\n\n    def _unitary_(self) -> Optional[np.ndarray]:\n        if cirq.is_parameterized(self):\n            return None\n        a = math.cos(self.theta)\n        b = -1j * math.sin(self.theta)\n        c = cmath.exp(-1j * self.phi)\n        return np.array([\n            [1, 0, 0, 0],\n            [0, a, b, 0],\n            [0, b, a, 0],\n            [0, 0, 0, c],\n        ])\n\n    def _pauli_expansion_(self) -> value.LinearDict[str]:\n        if protocols.is_parameterized(self):\n            return NotImplemented\n        a = math.cos(self.theta)\n        b = -1j * math.sin(self.theta)\n        c = cmath.exp(-1j * self.phi)\n        return value.LinearDict({\n            'II': (1 + c) / 4 + a / 2,\n            'IZ': (1 - c) / 4,\n            'ZI': (1 - c) / 4,\n            'ZZ': (1 + c) / 4 - a / 2,\n            'XX': b / 2,\n            'YY': b / 2,\n        })\n\n    def _resolve_parameters_(self, param_resolver: 'cirq.ParamResolver'\n                            ) -> 'cirq.FSimGate':\n        return FSimGate(\n            protocols.resolve_parameters(self.theta, param_resolver),\n            protocols.resolve_parameters(self.phi, param_resolver))\n\n    def _apply_unitary_(self,\n                        args: 'cirq.ApplyUnitaryArgs') -> Optional[np.ndarray]:\n        if cirq.is_parameterized(self):\n            return None\n        if self.theta != 0:\n            inner_matrix = protocols.unitary(cirq.Rx(2 * self.theta))\n            oi = args.subspace_index(0b01)\n            io = args.subspace_index(0b10)\n            out = cirq.apply_matrix_to_slices(args.target_tensor,\n                                              inner_matrix,\n                                              slices=[oi, io],\n                                              out=args.available_buffer)\n        else:\n            out = args.target_tensor\n        if self.phi != 0:\n            ii = args.subspace_index(0b11)\n            out[ii] *= cmath.exp(-1j * self.phi)\n        return out\n\n    def _decompose_(self, qubits) -> 'cirq.OP_TREE':\n        a, b = qubits\n        xx = cirq.XXPowGate(exponent=self.theta / np.pi, global_shift=-0.5)\n        yy = cirq.YYPowGate(exponent=self.theta / np.pi, global_shift=-0.5)\n        yield xx(a, b)\n        yield yy(a, b)\n        yield cirq.CZ(a, b)**(-self.phi / np.pi)\n\n    def _circuit_diagram_info_(self, args: 'cirq.CircuitDiagramInfoArgs'):\n        t = _format_rads(args, self.theta)\n        p = _format_rads(args, self.phi)\n        return 'fsim({}, {})'.format(t, p), '#2'\n\n    def __pow__(self, power):\n        return FSimGate(cirq.mul(self.theta, power), cirq.mul(self.phi, power))\n\n    def __repr__(self):\n        return 'cirq.FSimGate(theta={}, phi={})'.format(proper_repr(self.theta),\n                                                        proper_repr(self.phi))\n\n\ndef _format_rads(args: 'cirq.CircuitDiagramInfoArgs', radians: float) -> str:\n    if cirq.is_parameterized(radians):\n        return str(radians)\n    unit = '\u03c0' if args.use_unicode_characters else 'pi'\n    if radians == np.pi:\n        return unit\n    if radians == 0:\n        return '0'\n    if radians == -np.pi:\n        return '-' + unit\n    if args.precision is not None:\n        quantity = '{{:.{}}}'.format(args.precision).format(radians / np.pi)\n        return quantity + unit\n    return repr(radians)\n", "path": "cirq/ops/fsim_gate.py"}]}