This is the main tomography object that the library is built around.
The goal is to only have one tomography object and edit the
configuration settings as you go.
The constructor initalizes the conf settings and error functions with the default values below:
self.conf = {'NQubits': 2,
'NDetectors': 1,
'Crosstalk': np.array([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]),
'Bellstate': 0,
'DoDriftCorrection': 0,
'DoAccidentalCorrection' : 1,
'DoErrorEstimation': 0,
'Window': 0,
'Efficiency': 0,
'RhoStart': [],
'IntensityMap': [[1]],
'Beta': 0}
self.err_functions = ['concurrence','tangle','entropy','linear_entropy','negativity','purity']
The configuration settings of the tomography.
An array of properties that you want to be calculated when getProperties is called.
The array contains strings of the function names for the desired properties with no parentheses. Default will contain all the properties.
Filters the data into separate arrays.
Paramaters: |
|
Returns: |
|
Returns the properties of the given density matrix.
Using bounds will not change the conf settings. The properties are determined by err_functions
Paramaters: |
|
Returns: |
|
Returns an array of standard measurments in pure state form for the given number of qubits.
Paramaters: |
|
Returns an array of counts for all the measurments.
Returns an array of measurements in pure state form for all the measurments.
Returns the number of qubits for the current configurations.
Returns the number of coincidences per measurement for the current configurations.
Returns the number of detectors per qubit for the current configurations.
Returns the total number of detectors for the given data.
Returns the number of singles per measurement for the current configurations.
Returns an array of singles for all the measurments.
Returns an array of times for all the measurments.
Returns a standard template for tomo_input for the given number of qubits.
Paramaters: |
|
Import a text file containing the configuration settings.
Details for the configuration file can be found in the reference for Conf File.
Paramaters: |
|
Import a text file containing the tomography data and run tomography.
Details for the data file can be found in the reference for Data File.
Paramaters: |
|
Import a eval file containing the tomography data and the configuration setting, then run tomography.
Details for the eval file can be found in the reference for Eval File.
Paramaters: |
|
Relative pump power (arb. units) during measurement for the last tomography run.
The final value of the internal optimization function for the last tomography run.
The predicted intensity of the state for the last tomography run.
The predicted density matrix of the last tomography run.
Uses linear techniques to find a starting state for maximum likelihood estimation.
Paramaters: |
|
Returns: |
|
Calculates the most likely state given the data.
This function uses a least squares method to find the final predicted state.
Paramaters: |
|
Returns: |
|
Calculates the diffrence between the current predicted state data and the actual data.
Paramaters: |
|
Returns: |
|
Calculates the diffrence between the current predicted state data and the actual data using hedged maximum likelihood.
Paramaters: |
|
Returns: |
|
The generated monte carlo states.
Value is 0 if no states have been generated yet.
Sets a specific self.conf setting
Paramaters: |
|
Desc: Main function that runs tomography.
This function first parses the data, then finds an approximate starting state. It then uses maximum likelihood to find the final predicted state.
Paramaters: |
|
Returns: |
|
The raw input data of the last tomography run.
Returns the optimal measurment settings for the CHSH bell inequality.
Using bounds will not change the conf settings.
Paramaters: |
|
Returns: |
|
Uses monte carlo simulation to create random states similar to the estimated state.
The states are also saved under Tomography.mont_carl_states
Paramaters: |
|
Returns: |
|
Calculates the concurrence of the input state.
An entanglement monotone defined for a mixed state of two qubits. Where 1 corresponds to a completly entangled state.
Defined as max (0,λ1-λ2-λ3-λ4) where λi are the eigenvalues, in decreasing order.
Read more about concurrence: concurrence on wikipedia
Paramaters: |
|
Returns: |
|
Converts a density matrix into a list of t values
Paramaters: |
|
Returns: |
|
Converts a density matrix into a lower t matrix.
Paramaters: |
|
Returns: |
|
Calculates the Von Neumann entropy of the input state.
Defined as -Σ λi*ln(λi) Where λi are the eigenvalues.
Read more about entropy: entropy on wikipedia
Paramaters: |
|
Returns: |
|
Calculates the fidelity between the two input states.
Defined as trace(sqrtm(sqrtm(P) * Q * sqrtm(P)))^2. Where P & Q the density matrices of the two states and sqrtm is the matrix square root.
Read more about fidelity: fidelity on wikipedia
Paramaters: |
|
Returns: |
|
Calculates the linear entropy of the input state.
Mixture measurement ranging from 0 to 1/(2^numQubits). Where 0 corresponds to a completly pure state and 1/(2^numQubits) corresponds to a completely mixed state.
Defined as 1-tr(rho^2). Read more about linear entropy: linear entropy on wikipedia
Paramaters: |
|
Returns: |
|
Calculates the negativity of the input state.
Defined as Σ |λi| Where λi are the negative eigenvalues of the partial transpose of the matrix.
Read more about negativity: negativity on wikipedia
Paramaters: |
|
Returns: |
|
Performs the operations on the input State.
Paramaters: |
|
Returns: |
|
Calculates the purity of the input state.
Mixture measurement ranging from 0 to 1/(2^numQubits). Where 1/(2^numQubits) corresponds to a completely mixed state and 1 corresponds to a completly pure state.
Defined as tr(rho^2)
Read more about purity: purity on wikipedia
Paramaters: |
|
Returns: |
|
Converts a list of t values to an lower t matrix.
Paramaters: |
|
Returns: |
|
Converts a list of t values to a density matrix.
Paramaters: |
|
Returns: |
|
Calculates the tangle of the input state.
Entanglement Measure ranging from (0,1) where 1 corresponds to a completly entangled state.
Defined as the square of concurrence.
Paramaters: |
|
Returns: |
|
Converts a pure state into a density matrix.
Paramaters: |
|
Returns: |
|
Prints the properties of the last tomography to the console.
Using bounds will not change the conf settings. The calculated properties are determined by self.err_functions.
Paramaters: |
|
Returns: |
|
Creates matlab plots of the density matrix.
Paramaters: |
|
Creates and saves matlab plots of the density matrix.
Paramaters: |
|
Creates an HTML table based on the given matrix.
Paramaters: |
|
Returns: |
|
Creates an HTML table based on the given property values.
Paramaters: |
|
Returns: |
|
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 configuration settings:
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.
This example is for 2 qubits using 1 detector.
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]
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])
In case you have any further questions about the Python code, you should direct them to Scott Turro.