Comment utiliser la tomographie Qubits (mon produit diplômé)

How to use Qubits Tomography

I made Qubits Tomography as my graduate product, so I tell you how to use it. SRC is here. The theory of Qubit Tomography is written at my graduate thesis in Japanese. So if you understand it, I recommend you read reference papers. And I alse made Qutrit Tomography, which is three dimentional version of qubit. If you would like to use Qudit Tomography, please use this product. Additionally, if you can't understand these, please give it a thumbs up and comment!

As a result of this, you can get 3D graphics like this. mixed.png

How to use

At first, copy the file of "qubit_tomo.py" in current directory.
The structure of directory may be like this.

.
└project
    └qubit_tomo.py

In command prompt,

~\project>python qubit_tomo.py

enter "python qubit_tomo.py" or "python ./qubit_tomo.py".

------------------------------------------------------------
PLEASE ENTER NUMBER OF QUBITS
------------------------------------------------------------
>>

After that, like this lines are shown, please enter a number of Qubits you want to do.
In this time, I try to simulate for 4 qubits.
And the bases of measurement which I use is written in my graduate thesis.
If you want to use other bases, please rewrite bases in src directly.

 ------------------------------------------------------------
PLEASE ENTER NUMBER OF QUBITS
------------------------------------------------------------
>>
4
------------------------------------------------------------
PLEASE ENTER PATH OF EXPERIMENTAL DATA DIRECTORY

LIKE THIS >> .\datadirectory
------------------------------------------------------------
>> 

Next, please enter directory path which include experimental data files of '*.txt'.
If there are some experimental data files, this simulater can do all of them automatically.
But, while 3D graphics as a result is shown, simulater stop.
So please delete graphics to continue.
When experimental data files is like this, you can enter like this.

.
└project
    |
    ├testdata
    |  |
    |  └test.txt
    |
    └qubit_tomo.py


------------------------------------------------------------
PLEASE ENTER PATH OF EXPERIMENTAL DATA DIRECTORY

LIKE THIS >> .\datadirectory
------------------------------------------------------------
>>
./testdata

Next, please enter a name of result directory.
Any name can be acceptable if your machine allow.
If you enter nothing, the name of result directory is "default".
I try "test".

------------------------------------------------------------
PLEASE ENTER NAME OF RESULT DIRECTORY

THE RESULT DATA WILL SAVED AT
'.\result\qubit\iterative(or poisson)\{ YOUR ENTED DIRECTORY NAME }\{ EXPERIMENTAL DATA FILE NAME }_result.txt'

IF EMPTY, THE NAME OF RESULT DIRECTORY IS 'default'
------------------------------------------------------------
>>
test

After that, you need to select whether you make artificial experimental data sets or not.
When you enter only "yes", artificial experimental data sets is made and simulated.
These data sets is made following poisson distribution.

------------------------------------------------------------
PLEASE ENTER ANSWER WHETHER DO POISSON DISTRIBUTED SIMULATION
IF YOU DO, PLEASE ENTER 'yes'
IF YOU ENTER ANOTHER WORD OR EMPTY, YOUR ANSWER IS REGARED AS 'no'
------------------------------------------------------------
>>
yes
YOUR ANSWER IS: 'yes'
------------------------------------------------------------
PLEASE ENTER PATHS OF EXPERIMENTAL DATA

IF THERE ARE MULTIPLE DATA FILE YOU WANT TO TOMOGRAPHY,
ENTER ALL PATHS SEPARATED WITH SPACE.
LIKE THIS >> .\datadirectory\ex1.txt .\datadirectory\ex2.txt ...
------------------------------------------------------------
>>

If you enter "yes", you need to enter a file path of experimental data as model.
If you enter another word, your next question will be how many do parallel computing.
After "yes", for example,

YOUR ANSWER IS: 'yes'
------------------------------------------------------------
PLEASE ENTER PATHS OF EXPERIMENTAL DATA

IF THERE ARE MULTIPLE DATA FILE YOU WANT TO TOMOGRAPHY,
ENTER ALL PATHS SEPARATED WITH SPACE.
LIKE THIS >> .\datadirectory\ex1.txt .\datadirectory\ex2.txt ...
------------------------------------------------------------
>>
./testdata/test.txt

you are asked how many patterns do you make, so please enter a number you want.

------------------------------------------------------------
PLEASE ENTER ITERATION TIME OF EACH POISSON SIMULATION
------------------------------------------------------------
>>
5

Finally, you need to enter how many parallel computing you want.
And the maximum number of parallel that your computer can do is shown, so please refer it.
(※Attention: If you choose too many number of parallel, CPU can't work well. So I recommend about half of that number. And you must check your CPU working rate is proper.)

------------------------------------------------------------
HOW MANY TIMES DO YOU WANT TO PARALLELIZE?
IF THE NUMBER IS TOO LARGE, THE PARFORMANCE OF SIMULATION BECOME LOWER.
THE NUMBER OF LOGICAL PROCESSOR OF YOUR COMPUTER IS >>
6
RECOMENDED NUMBER IS LESS THAN THE ABOVE NUMBER.
------------------------------------------------------------
>>
2

All that is left is waiting for finishing simulating.
As mentioned above, whem 3D graphics is shown, simulater is stop.
So if you do not need to show this picture, please comment out of line 310 in src.

plotResult(numberOfQubits, estimatedDensityMatrix, baseNames)

Like this.

#plotResult(numberOfQubits, estimatedDensityMatrix, baseNames)

Result

The result is saved in result directory of which you enter the name.

.
└project
    |
    ├result
    |  |
    |  └qubit
    |      |
    |      ├iterative
    |      |  |
    |      |  └test
    |      |      |
    |      |      └result.txt
    |      |
    |      └poisson
    |          |
    |          └test
    |              |
    |              └result.txt
    |
    ├testdata
    |  |
    |  └test.txt
    |
    └qubit_tomo.py

In result.txt, the fidelity between result density matrix and ideal matrix which you prepared.
Ideal matrix is prepared in src directly.
So if you need, please fix your own.

Recommended Posts

Comment utiliser la tomographie Qubits (mon produit diplômé)
Comment utiliser la tomographie Qubits (faire des produits de recherche de fin d'études dans la bouddhéité)
Comment utiliser Python-shell
Remarques sur l'utilisation de tf.data
Comment utiliser virtualenv
Comment utiliser Seaboan
Comment utiliser la correspondance d'image
Comment utiliser le shogun
Comment utiliser Pandas 2
Comment utiliser Virtualenv
Comment utiliser numpy.vectorize
Comment utiliser pytest_report_header
Comment utiliser partiel
Comment utiliser Bio.Phylo
Comment utiliser SymPy
Comment utiliser x-means
Comment utiliser WikiExtractor.py
Comment utiliser IPython
Comment utiliser virtualenv
Comment utiliser Matplotlib
Comment utiliser iptables
Comment utiliser numpy
Comment utiliser TokyoTechFes2015
Comment utiliser venv
Comment utiliser le dictionnaire {}
Comment utiliser Pyenv
Comment utiliser la liste []
Comment utiliser python-kabusapi
Comment utiliser OptParse
Comment utiliser le retour
Comment utiliser pyenv-virtualenv
Comment utiliser imutils
Comment utiliser Qt Designer
Comment utiliser la recherche triée
[gensim] Comment utiliser Doc2Vec
python3: Comment utiliser la bouteille (2)
Comprendre comment utiliser django-filter
Comment utiliser le générateur
[Python] Comment utiliser la liste 1
Comment utiliser FastAPI ③ OpenAPI
Comment utiliser Python Argparse
Comment utiliser IPython Notebook
Comment utiliser Pandas Rolling
[Note] Comment utiliser virtualenv
Comment utiliser les dictionnaires redis-py
Python: comment utiliser pydub
[Python] Comment utiliser checkio
[Aller] Comment utiliser "... (3 périodes)"
Comment faire fonctionner GeoIp2 de Django
[Python] Comment utiliser input ()
Comment utiliser le décorateur
[Introduction] Comment utiliser open3d
Comment utiliser Python lambda
Comment utiliser Jupyter Notebook
[Python] Comment utiliser virtualenv
python3: Comment utiliser la bouteille (3)
python3: Comment utiliser la bouteille
Comment utiliser Google Colaboratory