We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
numpy>=1.17,<=1.18
Some tests are failing recently:
<img width="1035" alt="Screen Shot 2020-06-22 at 12 46 22 PM" src="https://user-images.githubusercontent.com/766693/85316568-f4934480-b48a-11ea-8fc1-5624c8d16d18.png">
<img width="1024" alt="Screen Shot 2020-06-22 at 12 46 46 PM" src="https://user-images.githubusercontent.com/766693/85316571-f5c47180-b48a-11ea-958b-c164b55250ca.png">

@mtreinish suggested that it could be numpy 0.19, released on June 20th. While investigating the issue, pinning the version.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `qiskit/pulse/pulse_lib/sample_pulse.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # This code is part of Qiskit.
4 #
5 # (C) Copyright IBM 2020.
6 #
7 # This code is licensed under the Apache License, Version 2.0. You may
8 # obtain a copy of this license in the LICENSE.txt file in the root directory
9 # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
10 #
11 # Any modifications or derivative works of this code must retain this
12 # copyright notice, and modified files need to carry a notice indicating
13 # that they have been altered from the originals.
14 
15 """A pulse that is described by complex-valued sample points."""
16 import warnings
17 from typing import Callable, Union, List, Optional
18 
19 import numpy as np
20 
21 from ..channels import PulseChannel
22 from ..exceptions import PulseError
23 from .pulse import Pulse
24 
25 
26 class SamplePulse(Pulse):
27     """A pulse specified completely by complex-valued samples; each sample is played for the
28     duration of the backend cycle-time, dt.
29     """
30 
31     def __init__(self, samples: Union[np.ndarray, List[complex]],
32                  name: Optional[str] = None,
33                  epsilon: float = 1e-7):
34         """Create new sample pulse command.
35 
36         Args:
37             samples: Complex array of the samples in the pulse envelope.
38             name: Unique name to identify the pulse.
39             epsilon: Pulse sample norm tolerance for clipping.
40                 If any sample's norm exceeds unity by less than or equal to epsilon
41                 it will be clipped to unit norm. If the sample
42                 norm is greater than 1+epsilon an error will be raised.
43         """
44         samples = np.asarray(samples, dtype=np.complex_)
45         self.epsilon = epsilon
46         self._samples = self._clip(samples, epsilon=epsilon)
47         super().__init__(duration=len(samples), name=name)
48 
49     @property
50     def samples(self) -> np.ndarray:
51         """Return sample values."""
52         return self._samples
53 
54     def _clip(self, samples: np.ndarray, epsilon: float = 1e-7) -> np.ndarray:
55         """If samples are within epsilon of unit norm, clip sample by reducing norm by (1-epsilon).
56 
57         If difference is greater than epsilon error is raised.
58 
59         Args:
60             samples: Complex array of the samples in the pulse envelope.
61             epsilon: Pulse sample norm tolerance for clipping.
62                 If any sample's norm exceeds unity by less than or equal to epsilon
63                 it will be clipped to unit norm. If the sample
64                 norm is greater than 1+epsilon an error will be raised.
65 
66         Returns:
67             Clipped pulse samples.
68 
69         Raises:
70             PulseError: If there exists a pulse sample with a norm greater than 1+epsilon.
71         """
72         samples_norm = np.abs(samples)
73         to_clip = (samples_norm > 1.) & (samples_norm <= 1. + epsilon)
74 
75         if np.any(to_clip):
76             # first try normalizing by the abs value
77             clip_where = np.argwhere(to_clip)
78             clip_angle = np.angle(samples[clip_where])
79             clipped_samples = np.exp(1j*clip_angle, dtype=np.complex_)
80 
81             # if norm still exceed one subtract epsilon
82             # required for some platforms
83             clipped_sample_norms = np.abs(clipped_samples)
84             to_clip_epsilon = clipped_sample_norms > 1.
85             if np.any(to_clip_epsilon):
86                 clip_where_epsilon = np.argwhere(to_clip_epsilon)
87                 clipped_samples_epsilon = np.exp(
88                     (1-epsilon)*1j*clip_angle[clip_where_epsilon], dtype=np.complex_)
89                 clipped_samples[clip_where_epsilon] = clipped_samples_epsilon
90 
91             # update samples with clipped values
92             samples[clip_where] = clipped_samples
93             samples_norm[clip_where] = np.abs(clipped_samples)
94 
95         if np.any(samples_norm > 1.):
96             raise PulseError('Pulse contains sample with norm greater than 1+epsilon.')
97 
98         return samples
99 
100     def draw(self, dt: float = 1,
101              style=None,
102              filename: Optional[str] = None,
103              interp_method: Optional[Callable] = None,
104              scale: float = 1, interactive: bool = False,
105              scaling: float = None):
106         """Plot the interpolated envelope of pulse.
107 
108         Args:
109             dt: Time interval of samples.
110             style (Optional[PulseStyle]): A style sheet to configure plot appearance.
111             filename: Name required to save pulse image.
112             interp_method: A function for interpolation.
113             scale: Relative visual scaling of waveform amplitudes.
114             interactive: When set true show the circuit in a new window.
115                          (This depends on the matplotlib backend being used.)
116             scaling: Deprecated, see `scale`,
117 
118         Returns:
119             matplotlib.figure: A matplotlib figure object of the pulse envelope
120         """
121         # pylint: disable=invalid-name, cyclic-import
122         if scaling is not None:
123             warnings.warn(
124                 'The parameter "scaling" is being replaced by "scale"',
125                 DeprecationWarning, 3)
126             scale = scaling
127 
128         from qiskit import visualization
129 
130         return visualization.pulse_drawer(self, dt=dt, style=style, filename=filename,
131                                           interp_method=interp_method, scale=scale,
132                                           interactive=interactive)
133 
134     def __eq__(self, other: Pulse) -> bool:
135         return super().__eq__(other) and self.samples.shape == other.samples.shape and \
136                np.allclose(self.samples, other.samples, rtol=0, atol=self.epsilon)
137 
138     def __hash__(self) -> int:
139         return hash(self.samples.tostring())
140 
141     def __repr__(self) -> str:
142         opt = np.get_printoptions()
143         np.set_printoptions(threshold=50)
144         np.set_printoptions(**opt)
145         return "{}({}{})".format(self.__class__.__name__, repr(self.samples),
146                                  ", name='{}'".format(self.name) if self.name is not None else "")
147 
148     def __call__(self, channel: PulseChannel):
149         warnings.warn("Calling `{}` with a channel is deprecated. Instantiate the new `Play` "
150                       "instruction directly with a pulse and a channel. In this case, please "
151                       "use: `Play(SamplePulse(samples), {})`."
152                       "".format(self.__class__.__name__, channel),
153                       DeprecationWarning)
154         return super().__call__(channel)
155
```
--- 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/qiskit/pulse/pulse_lib/sample_pulse.py b/qiskit/pulse/pulse_lib/sample_pulse.py
--- a/qiskit/pulse/pulse_lib/sample_pulse.py
+++ b/qiskit/pulse/pulse_lib/sample_pulse.py
@@ -84,8 +84,8 @@
             to_clip_epsilon = clipped_sample_norms > 1.
             if np.any(to_clip_epsilon):
                 clip_where_epsilon = np.argwhere(to_clip_epsilon)
-                clipped_samples_epsilon = np.exp(
-                    (1-epsilon)*1j*clip_angle[clip_where_epsilon], dtype=np.complex_)
+                clipped_samples_epsilon = (1-epsilon)*np.exp(
+                    1j*clip_angle[clip_where_epsilon], dtype=np.complex_)
                 clipped_samples[clip_where_epsilon] = clipped_samples_epsilon
 
             # update samples with clipped values

{"golden_diff": "diff --git a/qiskit/pulse/pulse_lib/sample_pulse.py b/qiskit/pulse/pulse_lib/sample_pulse.py\n--- a/qiskit/pulse/pulse_lib/sample_pulse.py\n+++ b/qiskit/pulse/pulse_lib/sample_pulse.py\n@@ -84,8 +84,8 @@\n             to_clip_epsilon = clipped_sample_norms > 1.\n             if np.any(to_clip_epsilon):\n                 clip_where_epsilon = np.argwhere(to_clip_epsilon)\n-                clipped_samples_epsilon = np.exp(\n-                    (1-epsilon)*1j*clip_angle[clip_where_epsilon], dtype=np.complex_)\n+                clipped_samples_epsilon = (1-epsilon)*np.exp(\n+                    1j*clip_angle[clip_where_epsilon], dtype=np.complex_)\n                 clipped_samples[clip_where_epsilon] = clipped_samples_epsilon\n \n             # update samples with clipped values\n", "issue": "numpy>=1.17,<=1.18\nSome tests are failing recently:\r\n<img width=\"1035\" alt=\"Screen Shot 2020-06-22 at 12 46 22 PM\" src=\"https://user-images.githubusercontent.com/766693/85316568-f4934480-b48a-11ea-8fc1-5624c8d16d18.png\">\r\n<img width=\"1024\" alt=\"Screen Shot 2020-06-22 at 12 46 46 PM\" src=\"https://user-images.githubusercontent.com/766693/85316571-f5c47180-b48a-11ea-958b-c164b55250ca.png\">\r\n\r\n@mtreinish suggested that it could be numpy 0.19, released on June 20th. While investigating the issue, pinning the version.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2020.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"A pulse that is described by complex-valued sample points.\"\"\"\nimport warnings\nfrom typing import Callable, Union, List, Optional\n\nimport numpy as np\n\nfrom ..channels import PulseChannel\nfrom ..exceptions import PulseError\nfrom .pulse import Pulse\n\n\nclass SamplePulse(Pulse):\n    \"\"\"A pulse specified completely by complex-valued samples; each sample is played for the\n    duration of the backend cycle-time, dt.\n    \"\"\"\n\n    def __init__(self, samples: Union[np.ndarray, List[complex]],\n                 name: Optional[str] = None,\n                 epsilon: float = 1e-7):\n        \"\"\"Create new sample pulse command.\n\n        Args:\n            samples: Complex array of the samples in the pulse envelope.\n            name: Unique name to identify the pulse.\n            epsilon: Pulse sample norm tolerance for clipping.\n                If any sample's norm exceeds unity by less than or equal to epsilon\n                it will be clipped to unit norm. If the sample\n                norm is greater than 1+epsilon an error will be raised.\n        \"\"\"\n        samples = np.asarray(samples, dtype=np.complex_)\n        self.epsilon = epsilon\n        self._samples = self._clip(samples, epsilon=epsilon)\n        super().__init__(duration=len(samples), name=name)\n\n    @property\n    def samples(self) -> np.ndarray:\n        \"\"\"Return sample values.\"\"\"\n        return self._samples\n\n    def _clip(self, samples: np.ndarray, epsilon: float = 1e-7) -> np.ndarray:\n        \"\"\"If samples are within epsilon of unit norm, clip sample by reducing norm by (1-epsilon).\n\n        If difference is greater than epsilon error is raised.\n\n        Args:\n            samples: Complex array of the samples in the pulse envelope.\n            epsilon: Pulse sample norm tolerance for clipping.\n                If any sample's norm exceeds unity by less than or equal to epsilon\n                it will be clipped to unit norm. If the sample\n                norm is greater than 1+epsilon an error will be raised.\n\n        Returns:\n            Clipped pulse samples.\n\n        Raises:\n            PulseError: If there exists a pulse sample with a norm greater than 1+epsilon.\n        \"\"\"\n        samples_norm = np.abs(samples)\n        to_clip = (samples_norm > 1.) & (samples_norm <= 1. + epsilon)\n\n        if np.any(to_clip):\n            # first try normalizing by the abs value\n            clip_where = np.argwhere(to_clip)\n            clip_angle = np.angle(samples[clip_where])\n            clipped_samples = np.exp(1j*clip_angle, dtype=np.complex_)\n\n            # if norm still exceed one subtract epsilon\n            # required for some platforms\n            clipped_sample_norms = np.abs(clipped_samples)\n            to_clip_epsilon = clipped_sample_norms > 1.\n            if np.any(to_clip_epsilon):\n                clip_where_epsilon = np.argwhere(to_clip_epsilon)\n                clipped_samples_epsilon = np.exp(\n                    (1-epsilon)*1j*clip_angle[clip_where_epsilon], dtype=np.complex_)\n                clipped_samples[clip_where_epsilon] = clipped_samples_epsilon\n\n            # update samples with clipped values\n            samples[clip_where] = clipped_samples\n            samples_norm[clip_where] = np.abs(clipped_samples)\n\n        if np.any(samples_norm > 1.):\n            raise PulseError('Pulse contains sample with norm greater than 1+epsilon.')\n\n        return samples\n\n    def draw(self, dt: float = 1,\n             style=None,\n             filename: Optional[str] = None,\n             interp_method: Optional[Callable] = None,\n             scale: float = 1, interactive: bool = False,\n             scaling: float = None):\n        \"\"\"Plot the interpolated envelope of pulse.\n\n        Args:\n            dt: Time interval of samples.\n            style (Optional[PulseStyle]): A style sheet to configure plot appearance.\n            filename: Name required to save pulse image.\n            interp_method: A function for interpolation.\n            scale: Relative visual scaling of waveform amplitudes.\n            interactive: When set true show the circuit in a new window.\n                         (This depends on the matplotlib backend being used.)\n            scaling: Deprecated, see `scale`,\n\n        Returns:\n            matplotlib.figure: A matplotlib figure object of the pulse envelope\n        \"\"\"\n        # pylint: disable=invalid-name, cyclic-import\n        if scaling is not None:\n            warnings.warn(\n                'The parameter \"scaling\" is being replaced by \"scale\"',\n                DeprecationWarning, 3)\n            scale = scaling\n\n        from qiskit import visualization\n\n        return visualization.pulse_drawer(self, dt=dt, style=style, filename=filename,\n                                          interp_method=interp_method, scale=scale,\n                                          interactive=interactive)\n\n    def __eq__(self, other: Pulse) -> bool:\n        return super().__eq__(other) and self.samples.shape == other.samples.shape and \\\n               np.allclose(self.samples, other.samples, rtol=0, atol=self.epsilon)\n\n    def __hash__(self) -> int:\n        return hash(self.samples.tostring())\n\n    def __repr__(self) -> str:\n        opt = np.get_printoptions()\n        np.set_printoptions(threshold=50)\n        np.set_printoptions(**opt)\n        return \"{}({}{})\".format(self.__class__.__name__, repr(self.samples),\n                                 \", name='{}'\".format(self.name) if self.name is not None else \"\")\n\n    def __call__(self, channel: PulseChannel):\n        warnings.warn(\"Calling `{}` with a channel is deprecated. Instantiate the new `Play` \"\n                      \"instruction directly with a pulse and a channel. In this case, please \"\n                      \"use: `Play(SamplePulse(samples), {})`.\"\n                      \"\".format(self.__class__.__name__, channel),\n                      DeprecationWarning)\n        return super().__call__(channel)\n", "path": "qiskit/pulse/pulse_lib/sample_pulse.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2020.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"A pulse that is described by complex-valued sample points.\"\"\"\nimport warnings\nfrom typing import Callable, Union, List, Optional\n\nimport numpy as np\n\nfrom ..channels import PulseChannel\nfrom ..exceptions import PulseError\nfrom .pulse import Pulse\n\n\nclass SamplePulse(Pulse):\n    \"\"\"A pulse specified completely by complex-valued samples; each sample is played for the\n    duration of the backend cycle-time, dt.\n    \"\"\"\n\n    def __init__(self, samples: Union[np.ndarray, List[complex]],\n                 name: Optional[str] = None,\n                 epsilon: float = 1e-7):\n        \"\"\"Create new sample pulse command.\n\n        Args:\n            samples: Complex array of the samples in the pulse envelope.\n            name: Unique name to identify the pulse.\n            epsilon: Pulse sample norm tolerance for clipping.\n                If any sample's norm exceeds unity by less than or equal to epsilon\n                it will be clipped to unit norm. If the sample\n                norm is greater than 1+epsilon an error will be raised.\n        \"\"\"\n        samples = np.asarray(samples, dtype=np.complex_)\n        self.epsilon = epsilon\n        self._samples = self._clip(samples, epsilon=epsilon)\n        super().__init__(duration=len(samples), name=name)\n\n    @property\n    def samples(self) -> np.ndarray:\n        \"\"\"Return sample values.\"\"\"\n        return self._samples\n\n    def _clip(self, samples: np.ndarray, epsilon: float = 1e-7) -> np.ndarray:\n        \"\"\"If samples are within epsilon of unit norm, clip sample by reducing norm by (1-epsilon).\n\n        If difference is greater than epsilon error is raised.\n\n        Args:\n            samples: Complex array of the samples in the pulse envelope.\n            epsilon: Pulse sample norm tolerance for clipping.\n                If any sample's norm exceeds unity by less than or equal to epsilon\n                it will be clipped to unit norm. If the sample\n                norm is greater than 1+epsilon an error will be raised.\n\n        Returns:\n            Clipped pulse samples.\n\n        Raises:\n            PulseError: If there exists a pulse sample with a norm greater than 1+epsilon.\n        \"\"\"\n        samples_norm = np.abs(samples)\n        to_clip = (samples_norm > 1.) & (samples_norm <= 1. + epsilon)\n\n        if np.any(to_clip):\n            # first try normalizing by the abs value\n            clip_where = np.argwhere(to_clip)\n            clip_angle = np.angle(samples[clip_where])\n            clipped_samples = np.exp(1j*clip_angle, dtype=np.complex_)\n\n            # if norm still exceed one subtract epsilon\n            # required for some platforms\n            clipped_sample_norms = np.abs(clipped_samples)\n            to_clip_epsilon = clipped_sample_norms > 1.\n            if np.any(to_clip_epsilon):\n                clip_where_epsilon = np.argwhere(to_clip_epsilon)\n                clipped_samples_epsilon = (1-epsilon)*np.exp(\n                    1j*clip_angle[clip_where_epsilon], dtype=np.complex_)\n                clipped_samples[clip_where_epsilon] = clipped_samples_epsilon\n\n            # update samples with clipped values\n            samples[clip_where] = clipped_samples\n            samples_norm[clip_where] = np.abs(clipped_samples)\n\n        if np.any(samples_norm > 1.):\n            raise PulseError('Pulse contains sample with norm greater than 1+epsilon.')\n\n        return samples\n\n    def draw(self, dt: float = 1,\n             style=None,\n             filename: Optional[str] = None,\n             interp_method: Optional[Callable] = None,\n             scale: float = 1, interactive: bool = False,\n             scaling: float = None):\n        \"\"\"Plot the interpolated envelope of pulse.\n\n        Args:\n            dt: Time interval of samples.\n            style (Optional[PulseStyle]): A style sheet to configure plot appearance.\n            filename: Name required to save pulse image.\n            interp_method: A function for interpolation.\n            scale: Relative visual scaling of waveform amplitudes.\n            interactive: When set true show the circuit in a new window.\n                         (This depends on the matplotlib backend being used.)\n            scaling: Deprecated, see `scale`,\n\n        Returns:\n            matplotlib.figure: A matplotlib figure object of the pulse envelope\n        \"\"\"\n        # pylint: disable=invalid-name, cyclic-import\n        if scaling is not None:\n            warnings.warn(\n                'The parameter \"scaling\" is being replaced by \"scale\"',\n                DeprecationWarning, 3)\n            scale = scaling\n\n        from qiskit import visualization\n\n        return visualization.pulse_drawer(self, dt=dt, style=style, filename=filename,\n                                          interp_method=interp_method, scale=scale,\n                                          interactive=interactive)\n\n    def __eq__(self, other: Pulse) -> bool:\n        return super().__eq__(other) and self.samples.shape == other.samples.shape and \\\n               np.allclose(self.samples, other.samples, rtol=0, atol=self.epsilon)\n\n    def __hash__(self) -> int:\n        return hash(self.samples.tostring())\n\n    def __repr__(self) -> str:\n        opt = np.get_printoptions()\n        np.set_printoptions(threshold=50)\n        np.set_printoptions(**opt)\n        return \"{}({}{})\".format(self.__class__.__name__, repr(self.samples),\n                                 \", name='{}'\".format(self.name) if self.name is not None else \"\")\n\n    def __call__(self, channel: PulseChannel):\n        warnings.warn(\"Calling `{}` with a channel is deprecated. Instantiate the new `Play` \"\n                      \"instruction directly with a pulse and a channel. In this case, please \"\n                      \"use: `Play(SamplePulse(samples), {})`.\"\n                      \"\".format(self.__class__.__name__, channel),\n                      DeprecationWarning)\n        return super().__call__(channel)\n", "path": "qiskit/pulse/pulse_lib/sample_pulse.py"}]}