2
$\begingroup$

I recently transitioned from using the IBMQ composer and am using qiskit in the IBM lab. To start, I wanted to learn how to reproduce the computational basis states, probabilities and phase angles as seen in the IBM composer. I've learned how to generate the computational basis states and probabilities with the code below but I can't find any function for generating the phase angles.

stat_vec = Statevector.from_instruction(circuit)
stat_vec.probabilities_dict()

The above returns the computational basis states and their probabilities as seen in the composer.

I looked through the StateVector class docs and the Result class docs but I didn't find a function that returns the phase angle for each computational basis state. Am I missing something?

I do know how to use draw("qsphere") to visually look at the phase angles but I want to return the phase angles in a data structure. Since I can visualize the phase angles, I feel like I'm overlooking something in the docs about returning the phase angles in something like an array or list.

$\endgroup$
1
  • 2
    $\begingroup$ I am not sure if there is such a function within Qiskit but why not just use the return values of the statevector to determine the phase angles? $\endgroup$
    – KAJ226
    Nov 27 '21 at 4:31

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.