I'm trying to run some simulations of my quantum circuits using qasm simulator. I first tried to import the noise data from a quantum device and then use that information on qasm. Here's part of my code:

provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_casablanca') 
noise_model = NoiseModel.from_backend(backend)
coupling_map = backend.configuration().coupling_map
basis_gates = noise_model.basis_gates
result = execute(circ, Aer.get_backend('qasm_simulator'),
                 coupling_map = coupling_map,
                 basis_gates = basis_gates,
                 noise_model = noise_model).result()

When I return type(result), it seems like the code is working, but I could not get any counts from here. It returns me QiskitError: 'No counts for experiment "0"' as I attempted counts = result.get_counts(0). I wonder am I really running the simulation? How can I get the counts? Thanks for the help!

  • 1
    $\begingroup$ Did you add any measurements to your circuit? If you didn't then that could be the problem. $\endgroup$
    – KAJ226
    Oct 28 at 2:53
  • 1
    $\begingroup$ @KAJ226 You're right. I didn't add the measurement. It works now. Thanks so much! $\endgroup$
    – ZR-
    Oct 28 at 3:03
  • $\begingroup$ --------No problem------ $\endgroup$
    – KAJ226
    Oct 28 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.