rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.4k stars 342 forks source link

UserWarning: SIMPLE-WARNING: Chip specification contained fidelity 1.0d0 > 1. #1004

Open braised-babbage opened 5 years ago

braised-babbage commented 5 years ago

Issue Description

Several tests get this warning. It is not apparent why, considering the specs_dict in conftest.py does not contain any fidelities greater than 1.

How to Reproduce

To pick one example:

(pyquil) erik-macbook:pyquil erik$ pytest pyquil/tests/test_quantum_computer.py::test_qc
===================================== test session starts ======================================
platform darwin -- Python 3.7.4, pytest-5.1.2, py-1.8.0, pluggy-0.13.0
rootdir: /Users/erik/src/pyquil
plugins: requests-mock-1.7.0, timeout-1.3.3, rerunfailures-7.0
collected 1 item

pyquil/tests/test_quantum_computer.py .                                                  [100%]

======================================= warnings summary =======================================
pyquil/tests/test_quantum_computer.py::test_qc
  /Users/erik/miniconda3/envs/pyquil/lib/python3.7/site-packages/rpcq/_client.py:177: UserWarning: SIMPLE-WARNING: Chip specification contained fidelity 1.0d0 > 1. Truncating to 0.99999d0.
    warn(f"{warning.kind}: {warning.body}")

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================ 1 passed, 1 warnings in 0.10s =================================
notmgsk commented 5 years ago

Are the tests pulling data from https://forest-server.qcs.rigetti.com?

notmgsk commented 5 years ago

It looks like if a gate fidelity is not present, then it is assigned PERFECT_FIDELITY = 1.0 https://github.com/rigetti/pyquil/blob/master/pyquil/device.py#L565

braised-babbage commented 5 years ago

Ah, so this is a quilc thing...

(defconstant +near-perfect-fidelity+ 0.99999d0
  "Even perfect operations are typically limited in their physical realization by, say, the granularity of control electronics. (For instance, waveform IQ values might be stored as complex fixnums of some specified depth.) This constant is a mnemonic for \"supposedly perfect\" and captures some of the loss incurred by these imperfections.")
notmgsk commented 5 years ago

Ah, so this is a quilc thing...

(defconstant +near-perfect-fidelity+ 0.99999d0
  "Even perfect operations are typically limited in their physical realization by, say, the granularity of control electronics. (For instance, waveform IQ values might be stored as complex fixnums of some specified depth.) This constant is a mnemonic for \"supposedly perfect\" and captures some of the loss incurred by these imperfections.")

As I understand it (almost verbatim from @ecpeterson), this is because the compiler will for