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 minimal working code expample in experiment API docs #1433

Merged
merged 151 commits into from
May 10, 2024

Conversation

Naohnakazawa
Copy link
Contributor

Summary

This change adds minimal working code examples to the API pages for each experiment,especially in characterizaion experiments. The minimal working code example is a code snippet which users can copy and paste to run the experiment.

Details and comments

  • This change solves the issue#1238 (See also the issue#1221).
  • In the API pages, the documentation for each experiment has been updated with its code example. Users are required to specify a backend in the code example. As a default, the backend is a simulator such as GenericBackendV2(num_qubits=27).
  • In some experiments,
    CorrelatedReadoutError
    ResonatorSpectroscopy
    CrossResonanceHamiltonian and
    EchoedCrossResonanceHamiltonian,
    the backend is an IBM Quantum real device due to the backend.defaults() dependence of the code example.
    In these cases, the code example explicitly imports the module qiskit-ibm-provider in order to retrieve the job on IBM Quantum real devices.
    Therefore, requirements-dev.txt has been updated to add the dependency on qiskit-ibm-provider for running tests and building documentation.

PR checklist (template)

  • I have read the contributing guide CONTRIBUTING.md.
  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have added a release note file using reno if this change needs to be documented in the release notes.

PR checklist (additional in CONTRIBUTING.md)

  • The code follows the code style of the project and successfully passes the tests.
  • The API documentation has been updated accordingly.
  • You have updated the relevant documentation or written new docs. In case the PR needs
    to be merged without delay (e.g. for a high priority fix), open an issue for updating
    or adding the documentation later.
  • [] You've added tests that cover the changes you've made, if relevant.
  • [] If your change has an end user facing impact (new feature, deprecation, removal,
    etc.), you've added or updated a reno release note for that change and tagged the PR
    for the changelog.
  • If your code requires a change to dependencies, you've updated the corresponding
    requirements file: requirements.txt for core dependencies,
    requirements-extras.txt for dependencies for optional features, and requirements-dev.txt
    for dependencies required for running tests and building documentation.

Naohnakazawa and others added 30 commits September 15, 2023 09:17
@coruscating coruscating added this to the Release 0.7 milestone Apr 30, 2024
Copy link
Collaborator

@coruscating coruscating left a comment

Choose a reason for hiding this comment

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

Thank you @Naohnakazawa for your great contribution. The examples look good overall. Because these are meant to be minimal examples for users to get started quickly, there is no need to set the number of shots or print the circuits before running the experiment. I also suggest that we display the analysis results in the new dataframe format by adding exp_data.analysis_results(dataframe=True) at the end of each experiment.

I've made suggestions for the examples following this format. Let me know what you think.

qiskit_experiments/library/characterization/tphi.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/zz_ramsey.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/t2ramsey.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/t2hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/rabi.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/rabi.py Outdated Show resolved Hide resolved
@Naohnakazawa Naohnakazawa requested a review from coruscating May 2, 2024 23:15
Copy link
Collaborator

@coruscating coruscating left a comment

Choose a reason for hiding this comment

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

Thanks for the update @Naohnakazawa . The PR is almost ready to merge, I just have two last comments.

@Naohnakazawa
Copy link
Contributor Author

@coruscating, thank you for your review and suggestion, . The branch issue-#1238 has been updated.

@Naohnakazawa Naohnakazawa requested a review from coruscating May 9, 2024 22:03
Copy link
Collaborator

@coruscating coruscating 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, thank you @Naohnakazawa for your great work!

@coruscating coruscating added this pull request to the merge queue May 10, 2024
Merged via the queue into qiskit-community:main with commit 0ddfc91 May 10, 2024
11 checks passed
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