iccmr-quantum / OSC-Qasm

A simple OSC Python interface for executing Qasm code.
MIT License
11 stars 1 forks source link

Throw an error when using qubits out of range for fake backends #17

Closed omarcostahamido closed 2 years ago

omarcostahamido commented 2 years ago

this relates to #15 . I think I can create this error myself by checking the properties of the fakebackends with this:

for backend in ('FakeAlmaden', 'FakeArmonk', 'FakeAthens', 'FakeBelem', 'FakeBoeblingen', 'FakeBogota', 'FakeBrooklyn', 'FakeBurlington', 'FakeCambridge', 'FakeCambridgeAlternativeBasis', 'FakeCasablanca', 'FakeEssex', 'FakeGuadalupe', 'FakeJakarta', 'FakeJohannesburg', 'FakeLagos', 'FakeLima', 'FakeLondon', 'FakeManhattan', 'FakeManila', 'FakeMelbourne', 'FakeMontreal', 'FakeMumbai', 'FakeOurense', 'FakeParis', 'FakePoughkeepsie', 'FakeQuito', 'FakeRochester', 'FakeRome', 'FakeRueschlikon', 'FakeSantiago', 'FakeSingapore', 'FakeSydney', 'FakeTenerife', 'FakeTokyo', 'FakeToronto', 'FakeValencia', 'FakeVigo', 'FakeYorktown'):
...     backend+="()"
...     backend=eval(backend)
...     with open( (backend.dirname + "/" + backend.conf_filename), 'r') as f:
...             data = json.load(f) 
...             data['n_qubits']

with the exception of melbourne which is configured differently...

omarcostahamido commented 2 years ago

last 3 lines of the code above should be replaced by: FakeTenerife().configuration().n_qubits as I realized in #18