Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove qubits from TomographyExperiment #107

Merged
merged 4 commits into from
May 1, 2019
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
12 changes: 6 additions & 6 deletions forest/benchmarking/direct_fidelity_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def generate_exhaustive_process_dfe_experiment(program: Program, qubits: list,
qubits=qubits,
in_states=[None, plusX, minusX, plusY, minusY, plusZ, minusZ],
benchmarker=benchmarker)),
program=program, qubits=qubits)
program=program)
return expr


Expand Down Expand Up @@ -184,7 +184,7 @@ def generate_exhaustive_state_dfe_experiment(program: Program, qubits: list,
qubits=qubits,
in_states=[None, plusZ],
benchmarker=benchmarker)),
program=program, qubits=qubits)
program=program)
return expr


Expand Down Expand Up @@ -253,7 +253,7 @@ def generate_monte_carlo_state_dfe_experiment(program: Program, qubits: List[int
_monte_carlo_dfe(program=program, qubits=qubits,
in_states=[None, plusZ],
n_terms=n_terms, benchmarker=benchmarker)),
program=program, qubits=qubits)
program=program)
return expr


Expand Down Expand Up @@ -288,7 +288,7 @@ def generate_monte_carlo_process_dfe_experiment(program: Program, qubits: List[i
_monte_carlo_dfe(program=program, qubits=qubits,
in_states=[None, plusX, minusX, plusY, minusY, plusZ, minusZ],
n_terms=n_terms, benchmarker=benchmarker)),
program=program, qubits=qubits)
program=program)
return expr


Expand Down Expand Up @@ -318,9 +318,9 @@ def acquire_dfe_data(qc: QuantumComputer, expr: TomographyExperiment, n_shots=10
program=expr.program,
out_pauli=[str(e[0].out_operator) for e in expr],
pauli_point_est=np.array([r.expectation for r in res]),
pauli_std_err=np.array([r.stddev for r in res]),
pauli_std_err=np.array([r.std_err for r in res]),
cal_point_est=np.array([r.calibration_expectation for r in res]),
cal_std_err=np.array([r.calibration_stddev for r in res]),
cal_std_err=np.array([r.calibration_std_err for r in res]),
dimension=2**len(expr.qubits),
qubits=expr.qubits)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines refer to expr.qubits.


Expand Down
2 changes: 1 addition & 1 deletion forest/benchmarking/randomized_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def run(qc: QuantumComputer, seq: List[Program], subgraph: List[List[int]], num_
_rs = list(measure_observables(qc, tomo_exp, num_trials))
# Inelegant shim from state tomo refactor. To clean up!
expectations=[r.expectation for r in _rs[1:]]
variances=[r.stddev ** 2 for r in _rs[1:]]
variances=[r.std_err ** 2 for r in _rs[1:]]
results.append((expectations, variances))
return results

Expand Down
2 changes: 1 addition & 1 deletion forest/benchmarking/tests/test_process_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def wfn_measure_observables(n_qubits, tomo_expt: TomographyExperiment):
yield ExperimentResult(
setting=setting,
expectation=wfn.reset().do_program(prog).expectation(setting.out_operator),
stddev=0.,
std_err=0.,
total_counts=1, # don't set to zero unless you want nans
)

Expand Down
8 changes: 4 additions & 4 deletions forest/benchmarking/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def generate_state_tomography_experiment(program: Program, qubits: List[int]):
:param qubits: The qubits to tomographize
"""
return PyQuilTomographyExperiment(settings=list(_state_tomo_settings(qubits)),
program=program, qubits=qubits)
program=program)


def _sic_process_tomo_settings(qubits: Sequence[int]):
Expand Down Expand Up @@ -144,7 +144,7 @@ def generate_process_tomography_experiment(program: Program, qubits: List[int],
else:
raise ValueError(f"Unknown basis {in_basis}")

return PyQuilTomographyExperiment(settings=list(func(qubits)), program=program, qubits=qubits)
return PyQuilTomographyExperiment(settings=list(func(qubits)), program=program)


@dataclass
Expand Down Expand Up @@ -181,7 +181,7 @@ def shim_pyquil_results_to_TomographyData(program, qubits, results: List[Experim
in_ops=[r.setting.in_operator for r in results[1:]],
out_ops=[r.setting.out_operator for r in results[1:]],
expectations=[r.expectation for r in results[1:]],
variances=[r.stddev ** 2 for r in results[1:]],
variances=[r.std_err ** 2 for r in results[1:]],
program=program,
number_qubits=len(qubits),
dimension=2 ** len(qubits),
Expand Down Expand Up @@ -858,7 +858,7 @@ def _resample_expectations_with_beta(results, prior_counts=1):
resampled_results += [ExperimentResult(
setting=result.setting,
expectation=resampled_expect,
stddev=result.stddev,
std_err=result.std_err,
total_counts=result.total_counts,
)]
return resampled_results
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pyquil>=2.4.0
pyquil>=2.7.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change must imply a major version bump. We need to either revert the change to pyquil and re-release, or re-label this release as 3.0.0.

numpy
networkx
pandas
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def find_forest_packages():
long_description_content_type="text/markdown",
long_description=open('README.md').read(),
install_requires=[
'pyquil>=2.4.0',
'pyquil>=2.7.0',
'numpy',
'networkx',
'pandas',
Expand Down