コード例 #1
0
    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)
コード例 #2
0
                                             pulse_width=meas_duration,
                                             pulse_sigma=meas_sigma,
                                             drives=meas_channels,
                                             inst_map=inst_map,
                                             meas_map=[[0, 1]])
rabi_experiments[10].draw()

#ground_freq_sweep_job = backend.run(ground_freq_sweep_program)
#print(ground_freq_sweep_job.job_id())
#job_monitor(ground_freq_sweep_job)
# Get the job data (average)
#ground_freq_sweep_data = get_job_data(ground_freq_sweep_job, average=True)
#To simulate the Rabi experiments, assemble the Schedule list into a qobj. When assembling, pass the PulseSimulator as the backend.#To simulate the Rabi experiments, assemble the Schedule list into a qobj. When assembling, pass the PulseSimulator as the backend.

# 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,