qiskit-community / qiskit-ignis

Ignis (deprecated) provides tools for quantum hardware verification, noise characterization, and error correction.
Apache License 2.0
168 stars 160 forks source link

Calculating quantum volume fails #479

Closed MedinaBandic closed 4 years ago

MedinaBandic commented 4 years ago

Informations

What is the current behavior?

Calculating quantum volume fails on qv_fitter.add_data(exp_results) with an error: ’AttributeError: Attribute header is not defined’.

Steps to reproduce the problem

I was following instructions in the documentation: https://qiskit.org/documentation/tutorials/noise/5_quantum_volume.html. The only difference was using different basis_gates = ['rx', 'ry', 'cz'] and adding my own coupling_map.

What is the expected behavior?

It should work. In the previous release, I didn't have this issue.

Suggested solutions

It is possible that qv fitter was not updated well in response to all other changes related to quantum volume that were part of this release. Either that or in execute part some attributes should not be like before (maybe some obligatory attribute is missing?)

ShellyGarion commented 4 years ago

It seems that the problem is not with the QV code itself, but with executing circuits using different basis gates: basis_gates = ['rx', 'ry', 'cz']. We are not sure how this code could have worked in the past. Did you manage to run it on an ibm-q device or on Aer's simulator?

Currently, the gates 'rx' and 'ry' are unsupported simulator gates. Aer's basis gates are:

`[
            'u1', 'u2', 'u3', 'cx', 'cz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg',
            't', 'tdg', 'swap', 'ccx', 'unitary', 'diagonal', 'initialize',
            'cu1', 'cu2', 'cu3', 'cswap', 'mcx', 'mcy', 'mcz',
            'mcu1', 'mcu2', 'mcu3', 'mcswap', 'multiplexer', 'kraus', 'roerror'
],`

If you would like to add another costumed unitary gate (like 'rx' and 'ry'), please follow the tutorial: https://qiskit.org/documentation/tutorials/simulators/4_custom_gate_noise.html

ajavadia commented 4 years ago

I'm also not sure what you mean when you say this worked in the past. AFAIK 'rx' and 'ry' were never supported natively by the simulator. So defining a custom gate/noise model like above is one way to do this, otherwise you could also follow this PR which is adding native support for 'rx' and 'ry' to the simulator https://github.com/Qiskit/qiskit-aer/pull/914

MedinaBandic commented 4 years ago

It meant more like that it used to work without those gates in previous releases. As I see that still works. I saw that the transpiler works for rx and ry gates now, so I thought they would work on the simulator as well. I will follow the tutorial you sent for adding those custom gates then.

ShellyGarion commented 4 years ago

Thanks for updating us. Please let us know if you have any further questions. You may also approach us in ignis slack channel: https://app.slack.com/client/T7RSPHKK2

MedinaBandic commented 4 years ago

With which email I have access to your slack channel? I think I contacted you with 2 emails, so I was not sure? I was unable to access it at the moment.

MedinaBandic commented 4 years ago

Overthere I just wanted to ask one additional question: if we don't use the basis_gates argument in execute for the simulator, then the unroll part to [u3,cnot] will be skipped? So if my circuit includes 'rx', 'ry' and 'cz' gates (with defined noise), will the simulation then use those gates and their noise?

ajavadia commented 4 years ago

Yes or you could just include your custom basis gates to be sure. You have to define the noise model though for your gates

On Sep 16, 2020, at 9:51 AM, Medina Bandić notifications@github.com wrote:

 Overthere I just wanted to ask one additional question: if we don't use the basis_gates argument in execute for the simulator, then the unroll part to [u3,cnot] will be skipped? So if my circuit includes 'rx', 'ry' and 'cz' gates (with defined noise), will the simulation then use those gates and their noise?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

MedinaBandic commented 4 years ago

I was thinking about including it, but then the transpiler would also unroll to u3 and cnot as well, and I was trying to avoid that.