4
$\begingroup$

I have run a program on an IBM quantum experience machine which involves 5 qubits. Obviously when I measure the whole system I have 32 results but the machine only represents 20 in the histogram. In this situation the program tells you to download the results. The problem is that when I pick "Download PNG" or "Download SVG" it continues to show me a 20 results histogram. There is another option that is to pick "Download results" but it downloads two .json documents which I'm not sure I know how to change into a histogram.

$\endgroup$
5
$\begingroup$

By clicking on Downloand you get two .json files as you mentioned. The results are saved in the file with suffix results.

When you open the file in Notepad or any other text editor, you can find results in this form:

"results":[{"data":{"counts":{"0x0":28,"0x1":39,"0x10":35,"0x11":28,"0x12":25,"0x13":32,"0x14":22,"0x15":36,"0x16":42,"0x17":33,"0x18":35,"0x19":23,"0x1a":34,"0x1b":24,"0x1c":29,"0x1d":43,"0x1e":34,"0x1f":31,"0x2":37,"0x3":32,"0x4":31,"0x5":33,"0x6":39,"0x7":35,"0x8":37,"0x9":29,"0xa":29,"0xb":25,"0xc":30,"0xd":29,"0xe":40,"0xf":25}},

States which are described by binary numbers in the graph on the result page in IBM Q interface are here described by hexadecimal numbers and showed together with number of occurences, for example:

"0x13":32

This means that value $13_{16}=19_{10}=10011_2$ occured 32 times.

You can extract these data from .json file manually, change hexadecimal numbers to binary and plot a histogram. For example, you can do it in Excel - hexadecimal numbers can be converted to binary ones with function HEX2BIN and then you can use bar graph instead of histogram.

|improve this answer|||||
$\endgroup$
  • 3
    $\begingroup$ It's much easier to convert hexadecimal directly to binary rather than going through decimal. Each hexadecimal digit expands into four binary digits, e.g. 3 becomes 0011. $\endgroup$ – CJ Dennis Feb 27 at 22:56
  • $\begingroup$ @CJDennis: Yes, you are right. I have just shown an example and in Excel I used HEX2BIN function, of course. $\endgroup$ – Martin Vesely Feb 28 at 5:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.