MiamiQuantumFest / qiskitFallFest

1 stars 2 forks source link

B1 | Incorrect Variable name and wrong method #5

Open AlanThinks opened 2 weeks ago

AlanThinks commented 2 weeks ago

In the notebook B1 | First Steps into... , in the last code cell

  1. counts_sample=results_sampler[0].data.meas.get_counts() There is no variable results_sampler

    • PROBABLE FIX: change results_counts[0] to result[0], or simply result depending on the object being returned
  2. It still won't work because it's calling the wrong method on the wrong type of object SamplerPubResult and/or DataBin, not sure.

    • I don't know the fix, need to read documentation further.

    result.data returns a DataBin object, which does not have a meas or get_counts method

Ref:

  1. https://docs.quantum.ibm.com/api/qiskit/qiskit.primitives.SamplerPubResult#samplerpubresult
  2. https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/qiskit_ibm_runtime.SamplerV2
  3. https://quantumcomputing.stackexchange.com/questions/38780/how-to-run-the-qiskit-sampler-after-storing-measurement-results-on-classical-qub
AlanThinks commented 2 weeks ago

@MiamiQuantumFest

iconbaypark2900 commented 2 weeks ago

install needed for visualization: %pip install qiskit[visualization] matplotlib

Get and plot the results: result = job.result() counts_sampler = result[0].data.c.get_counts()