-
Notifications
You must be signed in to change notification settings - Fork 131
Add Mirror RB experiment #842
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
Open
paco-ri
wants to merge
26
commits into
qiskit-community:main
Choose a base branch
from
albertzhu01:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b493b29
add mirror RB experiment and analysis files
albertzhu01 11b8af2
edit appropriate mirrorRB-relevant files for PR
albertzhu01 f3121eb
update docstrings
albertzhu01 b4e6072
delete commented series code
albertzhu01 aef0379
fix pygsti version
albertzhu01 933bc7b
remove outcomes setting
albertzhu01 094ebd0
remove prints and add paper ref
paco-ri 0e1ec4d
remove prints and add paper ref
paco-ri f28cdb7
move coupling map outside loop, delete elements_without_inv and int_c…
albertzhu01 281b777
Merge branch 'main' of https://github.com/albertzhu01/qiskit-experiments
albertzhu01 9a4602a
reformat files with black and lint
albertzhu01 1c9b350
cleaned RB tutorial
paco-ri 66c6f3e
cleaned RB tutorial
paco-ri 374fc2e
moved Clifford sampling in edgegrab algo
paco-ri 34e2cb7
use full connectivity for coupling map if coupling map is not provided
albertzhu01 fefc4ba
resolved some merge conflits
paco-ri b8ab48d
changed AnalysisResult imports
paco-ri 5cd64e5
edited BitGenerator and SeedSequence imports
paco-ri b43325a
removed MirrorRBPyGSTi from library init file
paco-ri f172c9b
fix full connectivity map generation code
albertzhu01 d0feba2
remove MirrorRBPyGSTi from mirror_rb_experiment.py, rb tutorial, and …
albertzhu01 d069f5d
fix oupling map full connectivity generation and update aer imports i…
albertzhu01 6846e12
fix merge conflicts with upstream main branch
albertzhu01 ddfcbaf
reformat imports (temporarily) to pass lint with merged code from ups…
albertzhu01 1124ea8
merged main
coruscating 057de84
merged main branch
coruscating File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
include LICENSE.txt | ||
include requirements.txt | ||
include qiskit_experiments/VERSION.txt | ||
include qiskit_experiments/library/randomized_benchmarking/data/*.npz | ||
exclude qiskit_experiments/library/randomized_benchmarking/data/generate_clifford_data.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# This code is part of Qiskit. | ||
# | ||
# (C) Copyright IBM 2021, 2023. | ||
# | ||
# 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. | ||
|
||
""" | ||
Documentation extension for visualization classes. | ||
""" | ||
|
||
from typing import Any | ||
|
||
from docs._ext.custom_styles.styles import VisualizationDocstring | ||
from qiskit.exceptions import QiskitError | ||
from qiskit_experiments.visualization import BasePlotter, BaseDrawer | ||
from sphinx.application import Sphinx | ||
from sphinx.ext.autodoc import ClassDocumenter | ||
|
||
|
||
class VisualizationDocumenter(ClassDocumenter): | ||
"""Sphinx extension for the custom documentation of the standard visualization classes.""" | ||
|
||
objtype = "visualization" # Must be overwritten by subclasses. | ||
directivetype = "class" | ||
priority = 10 + ClassDocumenter.priority | ||
option_spec = dict(ClassDocumenter.option_spec) | ||
|
||
def add_content(self, more_content: Any, no_docstring: bool = False) -> None: | ||
sourcename = self.get_sourcename() | ||
try: | ||
class_doc, init_doc = self.get_doc() | ||
except ValueError: | ||
raise QiskitError( | ||
f"Documentation of {self.name} doesn't match with the expected format." | ||
"Please run sphinx build without using the visualization template." | ||
) | ||
|
||
# format visualization class documentation into the visualization style | ||
class_doc_parser = VisualizationDocstring( | ||
target_cls=self.object, | ||
docstring_lines=class_doc, | ||
config=self.env.app.config, | ||
indent=self.content_indent, | ||
) | ||
|
||
# write introduction | ||
for i, line in enumerate(self.process_doc(class_doc_parser.generate_class_docs())): | ||
self.add_line(line, sourcename, i) | ||
self.add_line("", sourcename) | ||
|
||
# write init method documentation | ||
self.add_line(".. rubric:: Initialization", sourcename) | ||
self.add_line("", sourcename) | ||
for i, line in enumerate(self.process_doc([init_doc])): | ||
self.add_line(line, sourcename, i) | ||
self.add_line("", sourcename) | ||
|
||
# method and attributes | ||
if more_content: | ||
for line, src in zip(more_content.data, more_content.items): | ||
self.add_line(line, src[0], src[1]) | ||
|
||
|
||
class PlotterDocumenter(VisualizationDocumenter): | ||
"""Sphinx extension for the custom documentation of plotter classes.""" | ||
|
||
objtype = "plotter" | ||
|
||
@classmethod | ||
def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool: | ||
return isinstance(member, BasePlotter) | ||
|
||
|
||
class DrawerDocumenter(VisualizationDocumenter): | ||
"""Sphinx extension for the custom documentation of drawer classes.""" | ||
|
||
objtype = "drawer" | ||
|
||
@classmethod | ||
def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool: | ||
return isinstance(member, BaseDrawer) | ||
|
||
|
||
def setup(app: Sphinx): | ||
# Add plotter documenter | ||
existing_documenter = app.registry.documenters.get(PlotterDocumenter.objtype) | ||
if existing_documenter is None or not issubclass(existing_documenter, PlotterDocumenter): | ||
app.add_autodocumenter(PlotterDocumenter, override=True) | ||
|
||
# Add drawer documenter | ||
existing_documenter = app.registry.documenters.get(DrawerDocumenter.objtype) | ||
if existing_documenter is None or not issubclass(existing_documenter, DrawerDocumenter): | ||
app.add_autodocumenter(DrawerDocumenter, override=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{% if referencefile %} | ||
.. include:: {{ referencefile }} | ||
{% endif %} | ||
|
||
{{ objname }} | ||
{{ underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autodrawer:: {{ objname }} | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: | ||
|
||
{% block attributes_summary %} | ||
{% if attributes %} | ||
|
||
.. rubric:: Attributes | ||
|
||
.. autosummary:: | ||
:toctree: ../stubs/ | ||
{% for item in all_attributes %} | ||
{%- if not item.startswith('_') %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block methods_summary %} | ||
{% if methods %} | ||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
:toctree: ../stubs/ | ||
{% for item in all_methods %} | ||
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
{% for item in inherited_members %} | ||
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% if referencefile %} | ||
.. include:: {{ referencefile }} | ||
{% endif %} | ||
|
||
{{ objname }} | ||
{{ underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoplotter:: {{ objname }} | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: | ||
|
||
{% block attributes_summary %} | ||
{% if attributes %} | ||
|
||
.. rubric:: Attributes | ||
|
||
.. autosummary:: | ||
:toctree: ../stubs/ | ||
{% for item in all_attributes %} | ||
{%- if not item.startswith('_') %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block methods_summary %} | ||
{% if methods %} | ||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
:toctree: ../stubs/ | ||
|
||
{% for item in all_methods %} | ||
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
{% for item in inherited_members %} | ||
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} | ||
{{ name }}.{{ item }} | ||
{%- endif -%} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to this file look unnecessary; please revert them if so.