cirq-core 1.4.0.dev20240308194844__py3-none-any.whl → 1.4.0.dev20240313064729__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cirq-core might be problematic. Click here for more details.
- cirq/_version.py +1 -1
- cirq/experiments/t1_decay_experiment.py +14 -7
- cirq/experiments/t1_decay_experiment_test.py +14 -26
- {cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/METADATA +1 -1
- {cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/RECORD +8 -8
- {cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/WHEEL +1 -1
- {cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/LICENSE +0 -0
- {cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.4.0.
|
|
1
|
+
__version__ = "1.4.0.dev20240313064729"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from typing import Any, Optional, TYPE_CHECKING
|
|
15
|
+
from typing import Any, Optional, Sequence, TYPE_CHECKING, cast
|
|
16
16
|
|
|
17
17
|
import warnings
|
|
18
18
|
import pandas as pd
|
|
@@ -77,7 +77,12 @@ def t1_decay(
|
|
|
77
77
|
|
|
78
78
|
var = sympy.Symbol('delay_ns')
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
if min_delay_nanos == 0:
|
|
81
|
+
min_delay_nanos = 0.4
|
|
82
|
+
sweep_vals_ns = np.unique(
|
|
83
|
+
np.round(np.logspace(np.log10(min_delay_nanos), np.log10(max_delay_nanos), num_points))
|
|
84
|
+
)
|
|
85
|
+
sweep = study.Points(var, cast(Sequence[float], sweep_vals_ns))
|
|
81
86
|
|
|
82
87
|
circuit = circuits.Circuit(
|
|
83
88
|
ops.X(qubit), ops.wait(qubit, nanos=var), ops.measure(qubit, key='output')
|
|
@@ -118,8 +123,8 @@ class T1DecayResult:
|
|
|
118
123
|
def constant(self) -> float:
|
|
119
124
|
"""The t1 decay constant."""
|
|
120
125
|
|
|
121
|
-
def exp_decay(x, t1):
|
|
122
|
-
return np.exp(-x / t1)
|
|
126
|
+
def exp_decay(x, t1, a, b):
|
|
127
|
+
return a * np.exp(-x / t1) + b
|
|
123
128
|
|
|
124
129
|
xs = self._data['delay_ns']
|
|
125
130
|
ts = self._data['true_count']
|
|
@@ -132,8 +137,8 @@ class T1DecayResult:
|
|
|
132
137
|
|
|
133
138
|
# Fit to exponential decay to find the t1 constant
|
|
134
139
|
try:
|
|
135
|
-
popt, _ = optimize.curve_fit(exp_decay, xs, probs, p0=[t1_guess])
|
|
136
|
-
t1 = popt[0]
|
|
140
|
+
self.popt, _ = optimize.curve_fit(exp_decay, xs, probs, p0=[t1_guess, 1.0, 0.0])
|
|
141
|
+
t1 = self.popt[0]
|
|
137
142
|
return t1
|
|
138
143
|
except RuntimeError:
|
|
139
144
|
warnings.warn("Optimal parameters could not be found for curve fit", RuntimeWarning)
|
|
@@ -166,7 +171,9 @@ class T1DecayResult:
|
|
|
166
171
|
ax.plot(xs, ts / (fs + ts), 'ro-', **plot_kwargs)
|
|
167
172
|
|
|
168
173
|
if include_fit and not np.isnan(self.constant):
|
|
169
|
-
|
|
174
|
+
t1 = self.constant
|
|
175
|
+
t1, a, b = self.popt
|
|
176
|
+
ax.plot(xs, a * np.exp(-xs / t1) + b, label='curve fit')
|
|
170
177
|
plt.legend()
|
|
171
178
|
|
|
172
179
|
ax.set_xlabel(r"Delay between initialization and measurement (nanoseconds)")
|
|
@@ -53,7 +53,7 @@ def test_plot_does_not_raise_error():
|
|
|
53
53
|
repetitions=10,
|
|
54
54
|
max_delay=cirq.Duration(nanos=500),
|
|
55
55
|
)
|
|
56
|
-
results.plot()
|
|
56
|
+
results.plot(include_fit=True)
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def test_result_eq():
|
|
@@ -61,7 +61,7 @@ def test_result_eq():
|
|
|
61
61
|
eq.make_equality_group(
|
|
62
62
|
lambda: cirq.experiments.T1DecayResult(
|
|
63
63
|
data=pd.DataFrame(
|
|
64
|
-
columns=['delay_ns', 'false_count', 'true_count'], index=[0], data=[[100
|
|
64
|
+
columns=['delay_ns', 'false_count', 'true_count'], index=[0], data=[[100, 2, 8]]
|
|
65
65
|
)
|
|
66
66
|
)
|
|
67
67
|
)
|
|
@@ -103,7 +103,7 @@ def test_sudden_decay_results():
|
|
|
103
103
|
data=pd.DataFrame(
|
|
104
104
|
columns=['delay_ns', 'false_count', 'true_count'],
|
|
105
105
|
index=range(4),
|
|
106
|
-
data=[[100.0, 0, 10], [
|
|
106
|
+
data=[[100.0, 0, 10], [215.0, 0, 10], [464.0, 0, 10], [1000.0, 10, 0]],
|
|
107
107
|
)
|
|
108
108
|
)
|
|
109
109
|
|
|
@@ -117,13 +117,14 @@ def test_all_on_results():
|
|
|
117
117
|
min_delay=cirq.Duration(nanos=100),
|
|
118
118
|
max_delay=cirq.Duration(micros=1),
|
|
119
119
|
)
|
|
120
|
-
|
|
120
|
+
desired = cirq.experiments.T1DecayResult(
|
|
121
121
|
data=pd.DataFrame(
|
|
122
122
|
columns=['delay_ns', 'false_count', 'true_count'],
|
|
123
123
|
index=range(4),
|
|
124
|
-
data=[[100.0, 0, 10], [
|
|
124
|
+
data=[[100.0, 0, 10], [215.0, 0, 10], [464.0, 0, 10], [1000.0, 0, 10]],
|
|
125
125
|
)
|
|
126
126
|
)
|
|
127
|
+
assert results == desired, f'{results.data=} {desired.data=}'
|
|
127
128
|
|
|
128
129
|
|
|
129
130
|
def test_all_off_results():
|
|
@@ -135,13 +136,14 @@ def test_all_off_results():
|
|
|
135
136
|
min_delay=cirq.Duration(nanos=100),
|
|
136
137
|
max_delay=cirq.Duration(micros=1),
|
|
137
138
|
)
|
|
138
|
-
|
|
139
|
+
desired = cirq.experiments.T1DecayResult(
|
|
139
140
|
data=pd.DataFrame(
|
|
140
141
|
columns=['delay_ns', 'false_count', 'true_count'],
|
|
141
142
|
index=range(4),
|
|
142
|
-
data=[[100.0, 10, 0], [
|
|
143
|
+
data=[[100.0, 10, 0], [215.0, 10, 0], [464.0, 10, 0], [1000.0, 10, 0]],
|
|
143
144
|
)
|
|
144
145
|
)
|
|
146
|
+
assert results == desired, f'{results.data=} {desired.data=}'
|
|
145
147
|
|
|
146
148
|
|
|
147
149
|
@pytest.mark.usefixtures('closefigures')
|
|
@@ -150,28 +152,14 @@ def test_curve_fit_plot_works():
|
|
|
150
152
|
data=pd.DataFrame(
|
|
151
153
|
columns=['delay_ns', 'false_count', 'true_count'],
|
|
152
154
|
index=range(4),
|
|
153
|
-
data=[[100.0, 6, 4], [
|
|
155
|
+
data=[[100.0, 6, 4], [215.0, 10, 0], [464.0, 10, 0], [1000.0, 10, 0]],
|
|
154
156
|
)
|
|
155
157
|
)
|
|
156
158
|
|
|
157
159
|
good_fit.plot(include_fit=True)
|
|
158
160
|
|
|
159
161
|
|
|
160
|
-
@pytest.mark.
|
|
161
|
-
def test_curve_fit_plot_warning():
|
|
162
|
-
bad_fit = cirq.experiments.T1DecayResult(
|
|
163
|
-
data=pd.DataFrame(
|
|
164
|
-
columns=['delay_ns', 'false_count', 'true_count'],
|
|
165
|
-
index=range(4),
|
|
166
|
-
data=[[100.0, 10, 0], [400.0, 10, 0], [700.0, 10, 0], [1000.0, 10, 0]],
|
|
167
|
-
)
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
with pytest.warns(RuntimeWarning, match='Optimal parameters could not be found for curve fit'):
|
|
171
|
-
bad_fit.plot(include_fit=True)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
@pytest.mark.parametrize('t1', [200, 500, 700])
|
|
162
|
+
@pytest.mark.parametrize('t1', [200.0, 500.0, 700.0])
|
|
175
163
|
def test_noise_model_continous(t1):
|
|
176
164
|
class GradualDecay(cirq.NoiseModel):
|
|
177
165
|
def __init__(self, t1: float):
|
|
@@ -196,10 +184,10 @@ def test_noise_model_continous(t1):
|
|
|
196
184
|
results = cirq.experiments.t1_decay(
|
|
197
185
|
sampler=cirq.DensityMatrixSimulator(noise=GradualDecay(t1)),
|
|
198
186
|
qubit=cirq.GridQubit(0, 0),
|
|
199
|
-
num_points=
|
|
187
|
+
num_points=10,
|
|
200
188
|
repetitions=10,
|
|
201
|
-
min_delay=cirq.Duration(nanos=
|
|
202
|
-
max_delay=cirq.Duration(micros=
|
|
189
|
+
min_delay=cirq.Duration(nanos=1),
|
|
190
|
+
max_delay=cirq.Duration(micros=10),
|
|
203
191
|
)
|
|
204
192
|
|
|
205
193
|
assert np.isclose(results.constant, t1, 50)
|
{cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev20240313064729
|
|
4
4
|
Summary: A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
|
|
5
5
|
Home-page: http://github.com/quantumlib/cirq
|
|
6
6
|
Author: The Cirq Developers
|
{cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/RECORD
RENAMED
|
@@ -4,7 +4,7 @@ cirq/_compat_test.py,sha256=Qq3ZcfgD-Nb81cEppQdJqhAyrVqXKtfXZYGXT0p-Wh0,34718
|
|
|
4
4
|
cirq/_doc.py,sha256=yDyWUD_2JDS0gShfGRb-rdqRt9-WeL7DhkqX7np0Nko,2879
|
|
5
5
|
cirq/_import.py,sha256=p9gMHJscbtDDkfHOaulvd3Aer0pwUF5AXpL89XR8dNw,8402
|
|
6
6
|
cirq/_import_test.py,sha256=6K_v0riZJXOXUphHNkGA8MY-JcmGlezFaGmvrNhm3OQ,1015
|
|
7
|
-
cirq/_version.py,sha256=
|
|
7
|
+
cirq/_version.py,sha256=6IUfWeRydXNMKqYkglpYceCKb5DvYqlS59E5IfQzUic,40
|
|
8
8
|
cirq/_version_test.py,sha256=yYS6xm5-nuBRQJa9R3n41WdvFtVyY7Lb5Q8bea3VgBI,133
|
|
9
9
|
cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=S0HaPOCUIck-vNSQlS6KxnQtle6w-2dGuSxkUbJQY9Y,13168
|
|
@@ -192,8 +192,8 @@ cirq/experiments/readout_confusion_matrix.py,sha256=gsRjGJTDcxRPtY7G63t-nYoJ1BcB
|
|
|
192
192
|
cirq/experiments/readout_confusion_matrix_test.py,sha256=R4UoGklVJ2owqeDTRVP4M9gYynzVYgw-Y76VLcoIJtY,6766
|
|
193
193
|
cirq/experiments/single_qubit_readout_calibration.py,sha256=UerUTo0itB2K68VKfggkKIQfVva4FVbFXqvtydKTsIg,14535
|
|
194
194
|
cirq/experiments/single_qubit_readout_calibration_test.py,sha256=_002QXj2rIFHkH3vw9iTVMh45vCPuCI_fTqOUK8uMe4,7718
|
|
195
|
-
cirq/experiments/t1_decay_experiment.py,sha256=
|
|
196
|
-
cirq/experiments/t1_decay_experiment_test.py,sha256=
|
|
195
|
+
cirq/experiments/t1_decay_experiment.py,sha256=ealdmc_RTE__z1YUcaDEncDzQOaiT0K6IRWB7lNtPfs,7087
|
|
196
|
+
cirq/experiments/t1_decay_experiment_test.py,sha256=Pgbm-37JiCdw9iQg2OaXVvs72xGWV2629CgsTQlLQnw,9139
|
|
197
197
|
cirq/experiments/t2_decay_experiment.py,sha256=lTgZ9yJ7Fk9_ozUCHysQn1qKrMQwTpsgEv-QnvsEif0,19158
|
|
198
198
|
cirq/experiments/t2_decay_experiment_test.py,sha256=DFR0BGn0Id4qNPfqIExj70TEAqf7Vrc8eK91Wj0YKTc,15031
|
|
199
199
|
cirq/experiments/two_qubit_xeb.py,sha256=wdLxBi3LrAlPF-SQV9Tf66k31XC2cVHNPhpR-VLvCao,17762
|
|
@@ -1152,8 +1152,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
|
|
|
1152
1152
|
cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
|
|
1153
1153
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1154
1154
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1155
|
-
cirq_core-1.4.0.
|
|
1156
|
-
cirq_core-1.4.0.
|
|
1157
|
-
cirq_core-1.4.0.
|
|
1158
|
-
cirq_core-1.4.0.
|
|
1159
|
-
cirq_core-1.4.0.
|
|
1155
|
+
cirq_core-1.4.0.dev20240313064729.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1156
|
+
cirq_core-1.4.0.dev20240313064729.dist-info/METADATA,sha256=aZZs6VyU4VWMaAL5rnnPMr4p6ToEwGN6qqXyFwH-aB0,2110
|
|
1157
|
+
cirq_core-1.4.0.dev20240313064729.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
1158
|
+
cirq_core-1.4.0.dev20240313064729.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1159
|
+
cirq_core-1.4.0.dev20240313064729.dist-info/RECORD,,
|
{cirq_core-1.4.0.dev20240308194844.dist-info → cirq_core-1.4.0.dev20240313064729.dist-info}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|