-
Notifications
You must be signed in to change notification settings - Fork 135
Resonator spectroscopy #583
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
Changes from 20 commits
117fdb1
b6821f5
4b00b55
f568738
660766a
c36d329
6786c83
3db95ee
e1de77f
a807b10
d3674a1
7f920fd
7331ae0
2c1c124
fb3eaf1
a0072d8
2355825
c42dcf8
5515f2d
5a07e94
bde77fb
a2bc3da
8bdce88
e9f7ae4
dfe3149
b5bce85
6d487cc
c438b15
be7b264
26dfd60
0ef184b
bab4a73
13d5bb2
cd436f8
58f9535
256c3f6
86001af
67865cd
7c44dd1
b8b99d6
26848e3
373dfd3
7d7fa8e
a357bf0
62ce701
7524359
8796b32
723202c
dac1681
4461880
ead7c55
a994631
e7ccdf0
9dbe059
3e258cb
fd97988
5d9f0b4
4b7715d
73eaa4e
d38558e
8eb9d20
c09f9bf
9a6417f
6e7c915
a999744
40dd598
fac4995
9358a2b
da67d69
35e5af4
45f6dac
c947b2a
83a1b3e
9990736
77e8fb4
322ed86
072c40d
ba5d9ac
30e0898
0664a21
2904da9
cd795b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2021. | ||
| # | ||
| # This code is licensed under the Apache License, Version 2.0. You may | ||
| # obtain a copy of this license in the LICENSE.txt file in the root directory | ||
| # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # Any modifications or derivative works of this code must retain this | ||
| # copyright notice, and modified files need to carry a notice indicating | ||
| # that they have been altered from the originals. | ||
|
|
||
| """Spectroscopy analysis class for resonators.""" | ||
|
|
||
| from typing import List, Tuple | ||
| import numpy as np | ||
|
|
||
| import qiskit_experiments.curve_analysis as curve | ||
| from qiskit_experiments.curve_analysis import ResonanceAnalysis | ||
| from qiskit_experiments.framework import AnalysisResultData, ExperimentData | ||
| from qiskit_experiments.framework.matplotlib import get_non_gui_ax | ||
|
|
||
|
|
||
| class ResonatorSpectroscopyAnalysis(ResonanceAnalysis): | ||
| """Class to analysis resonator spectroscopy.""" | ||
|
|
||
| @classmethod | ||
| def _default_options(cls): | ||
| options = super()._default_options() | ||
| options.dimensionality_reduction = "ToAbs" | ||
| options.result_parameters = [curve.ParameterRepr("freq", "meas_freq", "Hz")] | ||
|
wshanks marked this conversation as resolved.
Outdated
eggerdj marked this conversation as resolved.
Outdated
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #171 had proposed adding non-qubit components and flagged this experiment as likely the first experiment to add such a component. Do we want to set the component for the result to be a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense. It does not seem straight forward to implement without a small change to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks good to me. It is preferrable to the current patch in #387 because it allows making the resonator the only component whereas #387 would result in a qubit and resonator component (unless you unset Should we propose this change in #387 since a different set of reviewers were interested there?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| options.plot_iq_data = True | ||
|
eggerdj marked this conversation as resolved.
|
||
| return options | ||
|
|
||
| def _run_analysis( | ||
| self, experiment_data: ExperimentData | ||
| ) -> Tuple[List[AnalysisResultData], List["pyplot.Figure"]]: | ||
| """Wrap the analysis to optionally plot the IQ data.""" | ||
| analysis_results, figures = super()._run_analysis(experiment_data) | ||
|
|
||
| if self.options.plot_iq_data: | ||
| axis = get_non_gui_ax() | ||
| figure = axis.get_figure() | ||
| figure.set_size_inches(*self.options.style.figsize) | ||
|
|
||
| iqs = [] | ||
|
|
||
| for datum in experiment_data.data(): | ||
| if "memory" in datum: | ||
|
wshanks marked this conversation as resolved.
|
||
| mem = np.array(datum["memory"]) | ||
|
|
||
| # Average single-shot data. | ||
| if len(mem.shape) == 3: | ||
| iqs.append(np.average(mem.reshape(mem.shape[0], mem.shape[2]), axis=0)) | ||
|
wshanks marked this conversation as resolved.
Outdated
|
||
|
|
||
| iqs = np.array(iqs) | ||
| axis.scatter(iqs[:, 0], iqs[:, 1], color="b") | ||
| axis.set_xlabel("In phase [arb. units]", fontsize=self.options.style.axis_label_size) | ||
| axis.set_ylabel("Quadrature [arb. units]", fontsize=self.options.style.axis_label_size) | ||
| axis.tick_params(labelsize=self.options.style.tick_label_size) | ||
| axis.grid(True) | ||
|
|
||
| figures.append(figure) | ||
|
|
||
| return analysis_results, figures | ||
Uh oh!
There was an error while loading. Please reload this page.