Refatoring the circuit processor and noise simulation


The main tasks of the last two weeks were refactoring the existing code and finding a way to simulate noise.

The original CircuiProcessor class is now the base class calling the open system solver and calculating the numerical evolution. On top of this, the subclasses determine how to find the driving pulses for a given quantum circuit. We aimed at bring other part of the code in qip under the same structure described in the previous post. so that the class structure looks like:

CircuitProcessor
├── ModelProcessor
│ ├── DispersivecQED
│ └── SpinChain
└── OptPulseProcessor

There are two main parts of the refactoring. First, cqed and spinchain were designed for specific models, each Hamiltonian operator and control pulse amplitude has a separate attribute in the class. To unify the representation, I used the property decorator in Python to link them to the two main attributes ctrls and amps, to be consistent with the parent class circuitprocessor. In this way, The old APIs that directly addressing each Hamiltonian remain available. The second is to adapt the code so that those model-based processors can also run a numerical simulation with noise. For the moment there is only the option with analytical calculation.


Meanwhile, we are also thinking about noise simulation. Our circuit processor simulates a quantum circuit closer to the real physical implementation that the usual approach. Therefore, noise can also be added at different levels: qubits relaxation (T1, T2), experiment instruments (laser frequency in cqed) and further decoherence (c_pos for the solver).
  • The use of arbitrary collapse operators as decoherence come naturally with the design of the new circuitprocessor, as they can be given as key word arguments to the solver. 
  • T1 and T2 relaxation time was added last week, so that the corresponding collapse operator is applied automatically when running the simulation. Below are two figures demonstrate the relaxation with T1=1 and T2=0.5. A more detailed demo is at  T1 and T2 decay
  • The noise in the experiment instruments, (e.g. a detuned frequency) is defined in the model based subclass and can be simulated by direct perturbing their values. (not yet implemented)

I'm also writing the documentation for the qip module. For now, there is only the documentation related to the parts that I have been working on.


Some other minor updates in the past two weeks are listed below:
  • Fixed some bugs in the documentation, took me a few evenings. The IPython extension for sphinx documentation seems to be quite difficult to debug.
  • Added user-defined gates to QubitCircuit. Now one can use Python function to define there own gates and the QubitCircuit is able to calculate the propagator. Demo here.
  • Fixed a bug in resolving qubit circuit to elementary gates. The previous version simply returns the input gate if no resolving method is defined. Since now custom defined gates are allowed in the qubit circuit, a proper exception handling is required.
Some unfinished work:
  • For the model-based circuit processor, like spinchain, the evolution can only be calculated analytically with exp(-iHt). The code needs to be adapted so that the solver can also be used to calculate the evolution numerically with noise. It should be quite straightforward, only some small issue needs to be resolved.
  • To accomplish the above task, the circuitprocessor has to be able to deal with time list that is not equidistant. For now, it is down by giving a Python function to mesolve, which is, unfortunately, not very efficient for a large system.
  • To simulate the noise in the experiment instruments, it will be helpful to separate the experiment setup parameters in the model based processor.

Comments

Popular posts from this blog

Final submission of the project

Summary GSoC 2019

Solving technical problems in using QuTiP solver for CircuitProcessor