Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions cirq-core/cirq/study/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import pandas as pd

from cirq import value, ops
from cirq._compat import deprecated, proper_repr, _warn_or_error
from cirq._compat import proper_repr
from cirq.study import resolver

if TYPE_CHECKING:
Expand Down Expand Up @@ -85,15 +85,6 @@ def _key_to_str(key: TMeasurementKey) -> str:
class Result(abc.ABC):
"""The results of multiple executions of a circuit with fixed parameters."""

def __new__(cls, *args, **kwargs):
if cls is Result:
_warn_or_error(
"Result constructor is deprecated and will be removed in cirq v0.15. "
"Use the ResultDict constructor instead, or another concrete subclass."
)
return ResultDict(*args, **kwargs)
return super().__new__(cls)

@property
@abc.abstractmethod
def params(self) -> 'cirq.ParamResolver':
Expand Down Expand Up @@ -153,29 +144,6 @@ def dataframe_from_measurements(measurements: Mapping[str, np.ndarray]) -> pd.Da
dtype = object if any(bs.shape[1] > 63 for _, bs in measurements.items()) else np.int64
return pd.DataFrame(converted_dict, dtype=dtype)

@staticmethod
@deprecated(
deadline="v0.15",
fix="The static method from_single_parameter_set is deprecated. "
"Use the ResultDict constructor instead.",
)
def from_single_parameter_set(
*, # Forces keyword args.
params: resolver.ParamResolver,
measurements: Mapping[str, np.ndarray],
) -> 'cirq.Result':
"""Packages runs of a single parameterized circuit into a Result.

Args:
params: A ParamResolver of settings used for this result.
measurements: A dictionary from measurement gate key to measurement
results. The value for each key is a 2-D array of booleans,
with the first index running over the repetitions, and the
second index running over the qubits for the corresponding
measurements.
"""
return ResultDict(params=params, measurements=measurements)

@property
def repetitions(self) -> int:
if not self.records:
Expand Down
14 changes: 0 additions & 14 deletions cirq-core/cirq/study/result_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,6 @@ def test_repr():
cirq.testing.assert_equivalent_repr(v)


def test_result_constructor_deprecation():
with cirq.testing.assert_deprecated("Use the ResultDict constructor", deadline="v0.15"):
result = cirq.Result(params=cirq.ParamResolver({}), measurements={})
assert result.repetitions == 0


def test_from_single_parameter_set_deprecation():
with cirq.testing.assert_deprecated("Use the ResultDict constructor", deadline="v0.15"):
result = cirq.Result.from_single_parameter_set(
params=cirq.ParamResolver({}), measurements={}
)
assert result.repetitions == 0


def test_construct_from_measurements():
r = cirq.ResultDict(
params=None,
Expand Down