Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resonator spectroscopy #583

Merged
merged 82 commits into from
Feb 4, 2022
Merged

Conversation

eggerdj
Copy link
Contributor

@eggerdj eggerdj commented Dec 17, 2021

Summary

This PR will replace #90 which is rather old now. The experiment can be run as follows.

spec = ResonatorSpectroscopy(0, frequencies=np.linspace(-10e6, 10e6, 51), backend=backend)
exp_data = spec.run()

Details and comments

This experiment requires special data processing to correct for the fact that the IQ points rotate around in the IQ plane.

image

image

TODOs:

  • Analysis class
  • Get qubit != 0 case working
  • Data processing
  • Tests

@eggerdj eggerdj changed the title [WIP] Resonator spectroscopy Resonator spectroscopy Jan 17, 2022
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Daniel. This is great start. I added couple of change requests for documentation and simplification. I feel this experiment motivate us to separate processor from analysis so that it can be flexibly configured.

qiskit_experiments/data_processing/nodes.py Outdated Show resolved Hide resolved
qiskit_experiments/data_processing/processor_library.py Outdated Show resolved Hide resolved
qiskit_experiments/data_processing/processor_library.py Outdated Show resolved Hide resolved

return schedule, freq_param

def circuits(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason we cannot reuse superclass method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in resonator spectroscopy we are attaching the pulse schedule to the measurement instruction which does not have a parameter. Therefore, we can not do:

circuit.add_calibration("measure", self.physical_qubits, sched_)
assigned_circ = circuit.assign_parameters({freq_param: freq_shift}, inplace=False)

for example, the following simple test case will raise:

import qiskit.pulse as pulse
from qiskit.circuit import Parameter
from qiskit import QuantumCircuit

param = Parameter("amp")

with pulse.build(backend=None) as sched:
    pulse.play(pulse.Drag(160, param, 2,0, 40), pulse.DriveChannel(2))
    
circ = QuantumCircuit(1, 1)
circ.measure(0, 0)
circ.add_calibration("measure", (2, ), sched)
circ.assign_parameters({param: 0.2345566}, inplace=False)

Copy link
Collaborator

@wshanks wshanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but I think all of Naoki's points are good.

I do wonder how the measurement is working here -- is the backend demodulating based on the shifted frequency of the drive or is it always demodulating at the nominal measure frequency.

Copy link
Collaborator

@wshanks wshanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments

@wshanks wshanks mentioned this pull request Jan 20, 2022
4 tasks
Copy link
Collaborator

@wshanks wshanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put a few minor comments in. I think this is very close to done. Besides those comments, there is my previous comment about acquisition duration and delay. Also, perhaps someone from #387 will weigh in.

Besides that, I think this is ready, though I was also hoping to see backend support added for this experiment before it was merged so I could try it out. My understanding is that the backend team has been trying to push out this support all week but has not been able to get the update through the QA pipeline without errors.


circuit.metadata = {
"experiment_type": self._type,
"qubits": self.physical_qubits,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the circuit metadata used for? Does it matter that for the resonator spectroscopy the qubit is not really part of the experiment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The qubits entry does not matter. Tests run fine without it. The only crucial part of the metadata is the xval since this is what is used in the curve analysis. I think we can tacitly interpret this as being the qubit for which we are doing readout spec. Alternatively we could override the _add_metadata function in ResonatorSpectroscopy to change this field but this sounds like a bit too much.

qiskit_experiments/curve_analysis/fit_function.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with minor documentation changes. Please address my final comments and feel free to merge with @wshanks 's approval.

from .analysis.resonator_spectroscopy_analysis import ResonatorSpectroscopyAnalysis


class ResonatorSpectroscopy(Spectroscopy):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use #section: examples to write some code. As you mentioned, we cannot set default value to run option since this is provider dependent. Even if we don't assume non-IBM provider for experiments, simulator may crash with invalid options (probably meas level and meas return are okey since they are defined in OpenPulse spec).

test/test_resonator_spectroscopy.py Outdated Show resolved Hide resolved
test/test_resonator_spectroscopy.py Outdated Show resolved Hide resolved
@eggerdj eggerdj merged commit f76213d into qiskit-community:main Feb 4, 2022
@eggerdj eggerdj deleted the resonator_spec branch February 4, 2022 08:19
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* This PR introduces the resonator spectroscopy experiment which scans the frequency 
  of a pulse applied to the readout resonator. It also switches the default resonance
  analysis to a Lorentzian fit instead of a Gaussian fit. Smaller changes allow developers
  to set resonators as target devices.

Co-authored-by: Naoki Kanazawa <[email protected]>
Co-authored-by: Will Shanks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants