iqsharp icon indicating copy to clipboard operation
iqsharp copied to clipboard

DumpMachine with a python host program

Open geduardo opened this issue 4 years ago • 1 comments

Originally opened by @jsvandyke86 here

Hello,

I'm going through this tutorial ("Qubit-level programming") using a python host program, and it seems like DumpMachine() is not quite working as expected. Rather than the output given on the tutorial webpage, it seems to be producing a dictionary (or something like that) which contains multiple different representations of desired information (plain text, html, etc.). I'm not quite sure how to turn this into human-readable format. Thanks for the help! Here is the output that I get:

{'text/plain': '|0⟩\t0.35355339059327384 + 0𝑖\n|1⟩\t0.35355339059327384 + 0𝑖\n|2⟩\t0.35355339059327384 + 0𝑖\n|3⟩\t0.35355339059327384 + 0𝑖\n|4⟩\t0.35355339059327384 + 0𝑖\n|5⟩\t0.35355339059327384 + 0𝑖\n|6⟩\t0.35355339059327384 + 0𝑖\n|7⟩\t0.35355339059327384 + 0𝑖', 'text/html': '\r\n

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Qubit IDs0, 1, 2
Basis state (little endian)AmplitudeMeas. Pr.Phase
$\left|0\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|1\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|2\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|3\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|4\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|5\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|6\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
$\left|7\right\rangle$$0.3536 + 0.0000 i$\r\n <progress\r\n max="100"\r\n value="12.500000000000005"\r\n style="width: 100%;"\r\n > \r\n \r\n

\r\n

\r\n
\r\n ↑\r\n
', 'application/json': '{"div_id":"dump-machine-div-11bdd1e6-30a4-4d2f-b488-0198f29c36fa","qubit_ids":[0,1,2],"n_qubits":3,"amplitudes":[{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0},{"Real":0.35355339059327384,"Imaginary":0.0,"Magnitude":0.35355339059327384,"Phase":0.0}]}'}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

geduardo avatar Mar 09 '21 18:03 geduardo

I think this may have been fixed as the result of improving some of our display data handling recently. @anjbur, let's try and see if we can reproduce this; if not, I'm happy to recommend closing the issue as Resolved-Done. Thanks!

cgranade avatar Jul 22 '21 18:07 cgranade