I'm trying to simulate a basic circuit using the PulseSimulator
in Qiskit. The following Qiskit Pulse code works when I run it on the real device, but not when using the PulseSimulator
. The job monitor tells me Job Status: job incurred error
and nothing else.
Trying to run any gates native to the device causes an issue. If I remove schedule += inst_sched_map.get('u2', [qubit], P0=0.0, P1=np.pi)
then it runs fine, but I can't figure out what I'm doing wrong. I'd deeply appreciate any support. I'm using qiskit 0.23.2
#Essential Imports
import numpy as np
# Qiskit Imports
from qiskit.providers.aer import PulseSimulator
from qiskit import IBMQ, assemble
from qiskit.tools.monitor import job_monitor
import qiskit.pulse as pulse
# Connect to an IBMQ Account and Backend
API_TOKEN = ''
IBMQ.save_account(API_TOKEN, overwrite=True)
IBMQ.load_account()
provider = IBMQ.get_provider()
backend = provider.get_backend("ibmq_armonk")
backend_pulse_simulator = PulseSimulator.from_backend(backend) #backend
# Get information about the backend
qubit = 0
backend_defaults = backend.defaults()
backend_properties = backend.properties()
qubit_frequency_updated = backend_properties.qubit_property(qubit, 'frequency')[0]
inst_sched_map = backend_defaults.instruction_schedule_map
measure_schedule = inst_sched_map.get('measure', qubits=[qubit])
# Assemble a job - circuit with a single qubit-> u2 gate -> measurement
num_shots_per_point = 1024
drive_chan = pulse.DriveChannel(qubit)
schedule = pulse.Schedule()
schedule += inst_sched_map.get('u2', [qubit], P0=0.0, P1=np.pi) # Removing this solves the issue - why?
schedule += measure_schedule << schedule.duration
pulse_program = assemble(schedule,
backend=backend_pulse_simulator,
meas_level=2, meas_return="single",
shots=num_shots_per_point,
schedule_los=[{drive_chan: qubit_frequency_updated}])
# Run the job
job = backend_pulse_simulator.run(pulse_program)
job_monitor(job)