result = job.result() assert result.status == 'COMPLETED' assert result.success is True compare_statevector(result, circuits, targets) # Run unitary simulator circuits = cx_gate_circuits_deterministic(final_measure=False) targets = cx_gate_unitary_deterministic() job = execute(circuits, UnitarySimulator(), shots=1, basis_gates=['u1', 'u2', 'u3', 'cx']) result = job.result() assert result.status == 'COMPLETED' assert result.success is True compare_unitary(result, circuits, targets) # Run pulse simulator system_model, schedule = model_and_pi_schedule() backend_sim = PulseSimulator() qobj = assemble([schedule], backend=backend_sim, qubit_lo_freq=[5.0], meas_level=1, meas_return='avg', shots=1) results = backend_sim.run(qobj, system_model).result() state = results.get_statevector(0) assertAlmostEqual(state[0], 0, delta=10**-5) assertAlmostEqual(state[1], -1j, delta=10**-5)
# instantiate the pulse simulator backend_sim = PulseSimulator() # compute frequencies from the Hamiltonian qubit_lo_freq = two_qubit_model.hamiltonian.get_qubit_lo_from_drift() rabi_qobj = assemble(rabi_experiments, backend=backend, qubit_lo_freq=qubit_lo_freq, meas_level=1, meas_return='avg', shots=256) # run the simulation rabi_result = backend_sim.run(rabi_qobj, two_qubit_model).result() rabifit = RabiFitter(rabi_result, rabi_amps, qubits, fit_p0=[0.5, 0.5, 0.6, 1.5]) plt.figure(figsize=(15, 10)) q_offset = 0 multiplier = 0.5 for qubit in qubits: ax = plt.subplot(2, 2, qubit + 1) #Xvmin, Xvmax = ax.xaxis.get_data_interval() #Yvmin, Yvmax = ax.yaxis.get_data_interval() #print(Xvmin, Xvmax,Yvmin, Yvmax) Xvmin = multiplier * np.floor(0.1 / multiplier)