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

Add calibration result plotting functions #234

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Conversation

paulQM
Copy link
Collaborator

@paulQM paulQM commented Oct 22, 2024

Added tools to plot the mixer calibration results.

show_lo_result() and show_if_result() plot the calibration data of the LO leakage and image sideband as well as the chosen calibration parameters: I_0, Q_O, dc_gain and dc_phase.

Copy link

github-actions bot commented Oct 22, 2024

Unit Test Results

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit 86734f8.

♻️ This comment has been updated with latest results.

@paulQM
Copy link
Collaborator Author

paulQM commented Oct 22, 2024

Missing:

  • Modify changelog
  • Write Readme documentation
  • Docstrings
  • Tests

@paulQM paulQM requested a review from TheoLaudatQM October 22, 2024 14:41
Copy link
Contributor

@TheoLaudatQM TheoLaudatQM 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, can we also add a function to extract the resulting LO leakage and image in dBm?

CHANGELOG.md Outdated Show resolved Hide resolved
qualang_tools/octave_tools/README.md Outdated Show resolved Hide resolved
qualang_tools/octave_tools/README.md Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@TheoLaudatQM TheoLaudatQM left a comment

Choose a reason for hiding this comment

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

I started the review and many comments apply to all functions, namely:

  • instead of an empty return, I think that raising an error makes more sense since it indicates to the user that something went wrong and it also indicates what.
  • In general it would be nice to add comments explaining what the different parts of the code do so that we (CS) can maintain it later.
  • It looks like there are a lot of sections that are common to the different functions, isn't it possible to break them down into small private functions (def _function_name()) that can be called in the main functions. It will make the code more readable and easier to test and maintain.
    I even think that using a class could make sense here, what do you think?

qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
qualang_tools/octave_tools/calibration_result_plotter.py Outdated Show resolved Hide resolved
@paulQM paulQM force-pushed the octave-tools-plotter branch from 47de2b1 to 5cc1468 Compare January 31, 2025 11:29
Copy link
Contributor

@TheoLaudatQM TheoLaudatQM left a comment

Choose a reason for hiding this comment

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

Great job, after these we'll be ready to merge :)


## show_lo_leakage_calibration_result()
Plot the LO leakage calibration data.
The produced plot shows the LO leakage signal as a function of the `I_0` and `Q_O` dc offsets for an initial coarse scan and a finer zoom-in scan on the minima. A third plot shows the fit error of the fine scan.
Copy link
Contributor

Choose a reason for hiding this comment

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

minimum instead of minimum since there is only one


### Outputs:

![image](https://github.com/user-attachments/assets/329755f9-cbdc-4a73-aff5-0e6417c41924)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would place the dc gain and phase under the "current results" instead for better visibility


### Outputs:

![image](https://github.com/user-attachments/assets/329755f9-cbdc-4a73-aff5-0e6417c41924)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also specify that the displayed powers correspond to the powers measured by the OPX after up and down conversion and may differ significantly from the power outputted by the Octave, or something along these lines


plotter = CalibrationResultPlotter(calibration_output)

plotter.show_lo_leakage_calibration_result()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would make sense to return the fig object so that people can modify it and save it easily for instance, what do you think?


## show_image_rejection_calibration_result()
Plot the image sideband calibration data.
The produced plot shows the image sideband signal as a function of the `dc_gain` and `dc_phase` parameters for an initial coarse scan and a finer zoom-in scan on the minima. A third plot shows the fit error of the fine scan.
Copy link
Contributor

Choose a reason for hiding this comment

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

minimum instead of minimum since there is only one

Comment on lines +364 to +365
This method generates a series of subplots that visualize the coarse and fine scans of the IF image calibration
and returns the achieved image suppression in dB.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also specify that the displayed powers correspond to the powers measured by the OPX after up and down conversion and may differ significantly from the power outputted by the Octave, or something along these lines
A well as the meaning of dB here "Here the returned value is with respect to before the calibration (so taking into account the previously load calibration parameters), or without any parameters?"

Comment on lines +527 to +528
If the LO frequency is not given, the first LO frequency in the data is used.
If the IF frequency is not given, the first IF frequency in the data is used.
Copy link
Contributor

Choose a reason for hiding this comment

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

The Lo and IF are not part of the input arguments, are they?

if_freq (Optional[float]): The IF frequency in Hz. If not provided, the first IF frequency in data is used.

Returns:
float: The reduction of Image sideband power before vs after calibration in dB units.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would again specify in dB with respect to what

Comment on lines +559 to +561
If the LO frequency is not given, the first LO frequency in the data is used.
If the IF frequency is not given, the first IF frequency in the data is used.

Copy link
Contributor

Choose a reason for hiding this comment

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

The Lo and IF are not part of the input arguments, are they?

If the IF frequency is not given, the first IF frequency in the data is used.

Returns:
float: The reduction of LO leakage power before vs after calibration in dB units.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would again specify in dB with respect to what

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.

2 participants