# How to use backend.run() with a constant pulse shape in order to get the results of a measurement?

I have formed a constant pulse and then I ran a measurement on the pulse. Now, I want to run a job to access the results of the measurement. Attached is a picture of the pulse and measurement. Now, at the end of the post I have code from Chapter 6.1 of the qiskit textbook(subsection 3.2 Determining 0 vs 1, which shows a job being run in regards to a pulse shape and measurement. How would you change the first line of the backend.run() command, the schedules parameter, in order to use it for measurement for a constant pulse shape in the code that I have? The schedules parameter from the given code represents a frequency sweep that was defined earlier in the qiskit textbook. I want to keep the other parameters of backend.run the same and change the schedules partly to something else and use this command on the constant pulse shape. I don't know exactly how to modify the schedules part of the command properly.

num_shots_per_frequency = 1024 job = backend.run(schedules, meas_level=1, meas_return='avg', shots=num_shots_per_frequency)

• Hello, could you put your code directly instead of a screenshot? It would be easier for the users to test :)
– Lena
Jul 27 at 7:56

Just like running circuits you must build and submit your schedules to be run (note this code has not been tested and there may be minor bugs).

with pulse.build(backend) as measure:
pulse.play(pulse.MeasureChannel(0), pulse.Constant(22800, 0.2))
pulse.acquire(pulse.AcquireChannel(0), pulse.MemorySlot(0))
with pulse.build(backend) as ground:
pulse.call(measure)
with pulse.build(backend) as excited:
pulse.x(0)
pulse.call(measure)

job = backend.run([ground, excited], meas_level=1)
result = job.result()
print(f"Ground results: {result.get_memory(0)}")
print(f"Excited results: {result.get_memory(1)}")


Note that the type of result data returned is different as the measurement discriminator is not trained for your custom measurement pulse on the backend. To get counts data with your custom pulse you would need to train your own discriminator using something like Qiskit Ignis's discriminators.

• When I run the code, I get an error message saying type error: must be real number not Measure Channel for the second line. Jul 27 at 16:22