A python library to help perform tomography on a quantum state.
Links
For those who do not want to write python code to perform tomography on their data, you can use the following command in the package directory:
Quantum-Tomography -i C:\Full\Path\To\pythoneval.txt
This will read the data in the txt file provided and print the output ot the console. Examples and syntax for a conf file is provided at the bottom of this readme. If you would like to save your data you can provide the save location like in the following example:
Quantum-Tomography -i C:\Full\Path\To\pythoneval.txt -s C:\Full\Path\To\output\Folder
There are several other arguments that are optional like save option. Here is the full list of arguments:
For those running tomography on multiple quantum states it may be easier to use the python package directly for a more hands free process.
import QuantumTomography as qKLib
t = qKLib.Tomography()
This can be done in multiple ways. The first and the easiest is to pass the full path to importConf Function. Examples and syntax for a conf file is provided at the bottom of this readme.
t.importConf('Path/To/conf.txt')
Specific Config settings can also be set directly
t['DoAccidentalCorrection'] = 1
A list values for config is provided at the bottom of this readme and also in the TomoClass.py file.
This can also be done in multiple ways. The first is using the importData Function. Examples and syntax for a data file is provided at the bottom of this readme and also in the TomoClass.py file..
[rho, intens, fval] = t.importData('Path/To/data.txt')
Data settings can also be passed into the main tomography function
tomo_input = np.array([[1,0,500,1,0],[1,0,0,0,1],[1,0,250,0.7071,0.7071],[1,0,250,0.7071,-0.7071],[1,0,250,0.7071,0.7071j],[1,0,250,0.7071,-0.7071j]])
intensity = np.array([1,1,1,1,1,1])
[rho, intens, fval] = t.state_tomography(tomo_input, intensity)
Steps 2 and 3 can be done in one single step by passing in a eval file.
[rho, intensity, fval] = t.importEval('Path/To/pythoneval.txt')
For running multiple states with the same settings it is recommended to run the tomographying using the python eval method since the the configurations is being unnecessarily being reset every time. Examples and syntax for a eval file is provided at the bottom of this readme.
We provide many functions to help describe the state. Properties of the state can be calculated with methods found in the TomoFunctions files. Some examples of these are proveded
fid = qKLib.fidelity(rho,expectedState)
entangle = qKLib.entanglement(rho)
entropy = qKLib.entropy(rho)
This file states the configurations of the tomography. The syntax of the txt file is python. You write the conf settings just like you would set a python dictionary. These are the following values you can set in a conf file.
conf['NQubits'] = 2
conf['NDetectors'] = 1
conf['Crosstalk'] = [[0.9842,0.0049,0.0049,0],[0.0079,0.9871,0,0.0050],[0.0079,0,0.9871,0.0050],[0.001,0.0079,0.0079,0.9901]]
conf['UseDerivative'] = 0
conf['Bellstate'] = 1
conf['DoErrorEstimation'] = 3
conf['DoDriftCorrection'] = 'no'
conf['Window'] = 0
conf['Efficiency'] = [0.9998,1.0146,0.9195,0.9265]
This file states the data of the measurements. Both tomo_input the intensity must be specified. The syntax of the txt file is python. You write the data settings just like you would set a python matrix. This is the following layout of the tomo_input matrix
tomo_input
This example is for 2 qubits using 1 detector.
tomo_input = np.array([[1,0,0,3708,1,0,1,0],[1,0,0,77,1,0,0,1],[1,0,0,1791,1,0,0.7071,0.7071],[1,0,0,2048,1,0,0.7071,0.7071j],[1,0,0,51,0,1,1,0],[1,0,0,3642,0,1,0,1],[1,0,0,2096,0,1,0.7071,0.7071],[1,0,0,1926,0,1,0.7071,0.7071j],[1,0,0,1766,0.7071,0.7071,1,0],[1,0,0,1914,0.7071,0.7071,0,1],[1,0,0,1713,0.7071,0.7071,0.7071,0.7071],[1,0,0,3729,0.7071,0.7071,0.7071,0.7071j],[1,0,0,2017,0.7071,0.7071j,1,0],[1,0,0,1709,0.7071,0.7071j,0,1],[1,0,0,3686,0.7071,0.7071j,0.7071,0.7071],[1,0,0,2404,0.7071,0.7071j,0.7071,0.7071j]])
intensity = np.array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])
This text file contains all the information for a tomography. It is essentially a conf file and a data file combined into one file.
tomo_input = np.array([[1,0,0,3708,1,0,1,0],[1,0,0,77,1,0,0,1],[1,0,0,1791,1,0,0.7071,0.7071],[1,0,0,2048,1,0,0.7071,0.7071j],[1,0,0,51,0,1,1,0],[1,0,0,3642,0,1,0,1],[1,0,0,2096,0,1,0.7071,0.7071],[1,0,0,1926,0,1,0.7071,0.7071j],[1,0,0,1766,0.7071,0.7071,1,0],[1,0,0,1914,0.7071,0.7071,0,1],[1,0,0,1713,0.7071,0.7071,0.7071,0.7071],[1,0,0,3729,0.7071,0.7071,0.7071,0.7071j],[1,0,0,2017,0.7071,0.7071j,1,0],[1,0,0,1709,0.7071,0.7071j,0,1],[1,0,0,3686,0.7071,0.7071j,0.7071,0.7071],[1,0,0,2404,0.7071,0.7071j,0.7071,0.7071j]])
intensity = np.array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])
conf['NQubits'] = 2
conf['NDetectors'] = 1
conf['Crosstalk'] = [[0.9842,0.0049,0.0049,0],[0.0079,0.9871,0,0.0050],[0.0079,0,0.9871,0.0050],[0.001,0.0079,0.0079,0.9901]]
conf['UseDerivative'] = 0
conf['Bellstate'] = 0
conf['DoErrorEstimation'] = 1
conf['DoDriftCorrection'] = 'no'
conf['Window'] = 0
conf['Efficiency'] = [0.9998,1.0146,0.9195,0.9265]