quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

heatmap.py #6625

Closed AbdullahKazi500 closed 5 months ago

AbdullahKazi500 commented 5 months ago

HighlightedHeatmap: Extends the cirq.Heatmap class to incorporate the highlighting functionality. It accepts an additional parameter, selected_qubits, which is a list of qubits to be highlighted on the heatmap.

HighlightedTwoQubitInteractionHeatmap: Similar to HighlightedHeatmap, but extends the cirq.TwoQubitInteractionHeatmap class instead. This class is specifically designed for visualizing interactions between pairs of qubits in quantum devices.

Plotting Method:

Both custom classes override the plot method inherited from their respective parent classes. Within the plot method, the code checks if selected_qubits are provided. If so, it adjusts the edge colors and widths of the heatmap to highlight the specified qubits. Example Usage:

The example usage section demonstrates how to create a heatmap with selected qubits highlighted. It initializes the HighlightedHeatmap class with error rates for the qubits and specifies the selected qubits to highlight. Then, it plots the heatmap using Matplotlib. Visualization:

The resulting heatmap visualizes error metrics for qubits in a quantum device. Selected qubits are highlighted with distinct colors or thicker borders, making them stand out for easier identification and analysis.

google-cla[bot] commented 5 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

AbdullahKazi500 commented 5 months ago

fixes #4691

AbdullahKazi500 commented 5 months ago

thanks @NoureldinYosri I will make the neccesary changes can I get assigned since this issue is near completion

AbdullahKazi500 commented 5 months ago

Hi @NoureldinYosri signed CLA Added functionalities added the plots images I am not able to locate the unit test can you add the test

NoureldinYosri commented 5 months ago

@AbdullahKazi500 I don't see any file changes since my last comment ... please address my comment your changes should be in cirq-core/cirq/vis/heatmap.py and cirq-core/cirq/vis/heatmap_test.py

AbdullahKazi500 commented 5 months ago

Hi @NoureldinYosri apologies about it I did not knew the location of the directory to commit the PR I will move the files there