pyquil
pyquil copied to clipboard
`device.gates_in_isa` does not handle all possible qubit types
Pre-Report Checklist
- [x] I am running the latest versions of pyQuil and the Forest SDK
- [x] I checked to make sure that this bug has not already been reported
Issue Description
pyquil.device.gates_in_isa
is not correctly reading the ISA of Aspen-9. From a quick read of:
https://github.com/rigetti/pyquil/blob/55670be8c30f5365433bae55de001c630319a999/pyquil/device/_isa.py#L233
It looks like this does not handle the qubit.type==None
, which is what is currently returned by Aspen-9
How to Reproduce
Code Snippet
import pyquil as pq
qc = pq.get_qc('Aspen-9')
isa = qc.device.get_isa()
pq.device.gates_in_isa(isa)
Error Output
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-ade0fcc7c65b> in <module>
5 qc = pq.get_qc('Aspen-9')
6 isa = qc.device.get_isa()
----> 7 pq.device.gates_in_isa(isa)
c:\<snip>\lib\site-packages\pyquil\device\_isa.py in gates_in_isa(isa)
257 gates.extend([Gate("_", "_", [unpack_qubit(q.id)])])
258 else: # pragma no coverage
--> 259 raise ValueError("Unknown qubit type: {}".format(q.type))
260
261 for e in isa.edges:
ValueError: Unknown qubit type: None
Environment Context
Operating System: Windows
Python Version (python -V
): 3.7.4