Skip to content

Commit 492d7f5

Browse files
committed
Copyright addition, add type hints
1 parent db09995 commit 492d7f5

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

recirq/time_crystals/dtcsimulation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 Google
1+
# Copyright 2022 Google
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Sequence, Tuple, List
15+
from typing import Sequence, Tuple, List, Iterator
1616

1717
import cirq
1818
import functools
@@ -167,7 +167,7 @@ def simulate_dtc_circuit_list_sweep(
167167
circuit_list: Sequence[cirq.Circuit],
168168
param_resolvers: Sequence[cirq.ParamResolver],
169169
qubit_order: Sequence[cirq.Qid],
170-
):
170+
) -> Iterator[np.ndarray]:
171171
"""Simulate a dtc circuit list over a sweep of param_resolvers
172172
173173
Args:
@@ -245,7 +245,7 @@ def get_polarizations(
245245
return polarizations
246246

247247

248-
def signal_ratio(zeta_1: np.ndarray, zeta_2: np.ndarray):
248+
def signal_ratio(zeta_1: np.ndarray, zeta_2: np.ndarray) -> np.ndarray:
249249
"""Calculate signal ratio between two signals
250250
251251
Args:
@@ -266,7 +266,7 @@ def simulate_for_polarizations(
266266
circuit_list: Sequence[cirq.Circuit],
267267
autocorrelate: bool = True,
268268
take_abs: bool = False,
269-
):
269+
) -> np.ndarray:
270270
"""Simulate and get polarizations for a single DTCExperiment and circuit list
271271
272272
Args:
@@ -324,7 +324,7 @@ def run_comparison_experiment(
324324
autocorrelate: bool = True,
325325
take_abs: bool = False,
326326
**kwargs,
327-
):
327+
) -> Iterator[np.ndarray]:
328328
"""Run comparison experiment
329329
330330
Args:

recirq/time_crystals/dtcsimulation_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Google
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+
115
import recirq.time_crystals as time_crystals
216
import numpy as np
317
import itertools

0 commit comments

Comments
 (0)