qat.purr.backends.realtime_chip_simulator module

class ControlType(value)

Bases: Enum

An enumeration.

MEASURE = 'measure'
RESET = 'reset'
class CouplingType(value)

Bases: Enum

An enumeration.

CrossKerr = 1
Exchange = 2
class MeasurementStatistics(state, level=0, probability=1, qubits_measured=None, result=None)

Bases: object

build_tree(H0, c_ops, simulation_sections, qubit_states, reset_operators, options=None, branch_number=-1)

Simulate the dynamics of initial condition using the section of the Hamiltonian specified by the level. Perform a measurement on the specified qubits in the Hamiltonian section and for each result calculate the probability of it occuring and the resultant state. For each result perform a new simulation with the next Hamiltonian section to create a branching structure of all possible outcomes for a given initial condition and Hamiltonian sections dictionary. Continue until all Hamiltonian sections have been simulated.

extract_branch_trajectory(operators, branch, step=1, plot_end=False)
extract_outcome_probabilities()
get_branch_nodes()
class OperatorInfo(operator, name, qubit_id=None)

Bases: object

name: str
operator: Qobj
qubit_id: int = None
class RTCSCoupling(id_, device_one, device_two, frequency, coupling_type, *args, **kwargs)

Bases: QuantumComponent, Calibratable

Resonators/Qubits are coupled in a very particular way in this model. This object holds information about those couplings.

targets()
class RTCSQubit(index, resonator, physical_channel, frequency, *args, N=3, anharmonicity=None, decay_rate=0.0, absorb_rate=0.0, dephase_rate=0.0, rotating_frame_frequency=0.0, **kwargs)

Bases: Qubit

Subclass to allow simulation-specific modelling of a qubit.

property N
property rotating_frame_frequency
class RTCSResonator(index, physical_channel, frequency, width, id_=None, *args, **kwargs)

Bases: Resonator

class RealtimeChipSimEngine(model=None, auto_plot=False, sim_qubit_dt=2.5e-11)

Bases: QuantumExecutionEngine

Simulation that is built to be as close to our hardware as possible to allow for developers, quantum engineers and the fabrication team to be able to run simulations and be confident that the results are close to reality.

build_simulator_resets(position_map)

Qubit resets are handled in a unqiue way for the simulator so require their own function.

get_branches()

Return the branch ids along with the measurements associated with them.

Example:

{branch_id: [branch_probability, {qubit: [resets_and_measurement_outcomes]}]}

Where:

  • branch_id: id to call when plotting specific branches

  • branch_probability: probability branch occured

  • qubit: qubit number

  • resets_and_measurement_outcomes: the outcome of measurements for this branch in order. Also includes when a reset occured.

Returns:

A dictionary mapping branch ids to their associated measurements.

Return type:

dict

get_tensor(ops=None)
model: RealtimeSimHardwareModel
optimize(instructions)

Runs optimization passes specific to this hardware.

plot_dynamics(operator_info=None, branches=None, step=1)

Plot the dynamics of operator expectation values for a simulation run on this hardware. By default the pauli operators will be plot for each qubit but custom operators can be specified.

Parameters:
  • operator_info (Optional[List[Union[OperatorInfo, int]]]) – Use the OperatorInfo object to specify an operator to plot, the id of the qubit the operator should act on and the name of the operator. Alternatively qubit indices (int) can be specified in which case the Pauli x, y and z expectations will be plotted for these qubits. If None then the Pauli operators for every qubit will be plotted. Defaults to None.

  • branches (Optional[List[int]]) – Specify a list of indices for the branches you wish to plot. This is only really relevent if the circuit includes mid-circuit measurements, in which case there will be a different trajectory for each possible measurement outcome. If None then the first trajectory will be plotted which is identical to all other trajectories for circuits without mid-circuit measurements. Defaults to None.

  • step (int) – The step length between expectation calculations along the trajectory. 1 gives the highest resolution but takes longer to calculate. Defaults to 1.

plot_pulses(channels=None)

Plot pulses used to drive the system. Pulses are shown before being transformed by the baseband frequnecy.

Parameters:

channels (Optional[List[str]]) – List of channel ids to plot. If None then all channels are plotted. Defaults to None.

process_reset(position)

When the superclass process_reset is implemented, it should remain empty for the simulator.

class RealtimeSimHardwareModel(shot_limit=10000, acquire_mode=None, repeat_count=1000, repetition_period=0.0001, error_mitigation=None)

Bases: QuantumHardwareModel

add_couplings(*args)
couplings: List[RTCSCoupling] = [r0<->q0, q0<->q1, q1<->r1]
create_engine()
class Section(indices, qubits, control_type, simulation_time=None, drive_hamiltonian=<factory>)

Bases: object

control_type: ControlType
drive_hamiltonian: List[Qobj]
indices: List[int]
qubits: List[str]
simulation_time: List[float] = None
add_qubit_coupling(hw, qubit1, qubit2, frequency)
add_qubit_stack(hw, frequency, anharmonicity, N)
apply_setup_to_hardware(hw, rotating_frame=True)

Apply the default real-time chip sim hardware setup to the passed-in hardware.

create_subplots(plot_num)
get_default_RTCS_hardware(repeats=1000, rotating_frame=True)
get_resonator_response_segments(buffers, resets)
get_resonator_response_signal_segment(resonator_input, resonator_dt, width, res_freq, shift, lo_freq)
get_resonator_response_splicing_indices(buffer_segments)

Take the buffer segments and parse them to find where the qubit buffer needs to be split in order to perform mid-circuit measurements.

get_simple_resonator_response(qubit_dt, qubit_z, resonator_dt, resonator_iq, width, res_freq, shift, lo_freq)
random() x in the interval [0, 1).
spline_time(dt, sim_t, buffer)

Perform a cubic spline on the buffer to make the number of points the same as the number of points in the simulation time

tukey_window(N, alpha=0.1)