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 examples in Experiment API docs #1494

Merged
merged 217 commits into from
Dec 18, 2024

Conversation

Naohnakazawa
Copy link
Contributor

@Naohnakazawa Naohnakazawa commented Nov 19, 2024

Summary

This change adds minimal working code examples to the API pages for Experiments,
EFSpectroscopy,
EFRabi,
StarkRamseyXYAmpScan,
FineAmplitudeCal,
FineXAmplitudeCal,
FineSXAmplitudeCal,
FineDragCal,
FineXDragCal,
FineSXDragCal,
FineFrequencyCal,
FrequencyCal,
HalfAngleCal,
RoughAmplitudeCal,
RoughXSXAmplitudeCal,
EFRoughXSXAmplitudeCal,
RoughDragCal,
RoughFrequencyCal,
QuantumVolume,
InterleavedRB,
LayerFidelity,
StandardRB,
MitigatedProcessTomography,
MitigatedStateTomography,
ProcessTomography,
StateTomography and
TomographyExperiment.

Details and comments

  • This PR covers many remaining experiments in issue#1238 and 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. By default, backends used in the code examples, are simulators such as, SingleTransmonTestBackend() and AerSimulator(FakePerth()).

Naohnakazawa and others added 30 commits September 15, 2023 09:17
…periments into main

local/main updated (Qiskit-Extensions#1238)
@Naohnakazawa
Copy link
Contributor Author

Hello, @wshanks.
Is the run time of the docs build too long? It takes 12 minutes.

@wshanks
Copy link
Collaborator

wshanks commented Dec 17, 2024

The PR looks ready except one suggestion about the RB analysis names.

Is the run time of the docs build too long? It takes 12 minutes.

It feels a bit long to me, but we can can go with it for now. We will remove the pulse experiments soon from the main branch to prepare for pulse being removed in Qiskit 2.0 and that will bring the time down some. It would be nice if we could log the time of each jupyter-execute run to see where all the time is going. There might be some way to do that with sphinx and jupyter-sphinx but I don't know how. We have our JupyterCellCheckEnv override but that happens in a sphinx layer before the jupyter kernel executes the code. Not knowing how to add logging to sphinx, what I would do is write a script to find all the .ipynb files under docs/_build/jupyter_execute and run jupyter execute on them and time how long each takes. If you are interested, you could write the script. It would be nice to add to the tools/ directory.

@Naohnakazawa
Copy link
Contributor Author

Hi, @wshanks.
The PR is now updated. Thank you for your help.

@wshanks wshanks added the backport stable potential The issue or PR might be minimal and/or import enough to backport to stable label Dec 18, 2024
Copy link
Collaborator

@wshanks wshanks left a comment

Choose a reason for hiding this comment

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

Thanks @Naohnakazawa! I think it looks good now!

@wshanks wshanks added this pull request to the merge queue Dec 18, 2024
Merged via the queue into qiskit-community:main with commit cc258d7 Dec 18, 2024
11 checks passed
mergify bot pushed a commit that referenced this pull request Dec 18, 2024
### Summary

This change adds minimal working code examples to the API pages for
Experiments,
    EFSpectroscopy,
    EFRabi,
    StarkRamseyXYAmpScan,
    FineAmplitudeCal,
    FineXAmplitudeCal,
    FineSXAmplitudeCal,
    FineDragCal,
    FineXDragCal,
    FineSXDragCal,
    FineFrequencyCal,
    FrequencyCal,
    HalfAngleCal,
    RoughAmplitudeCal,
    RoughXSXAmplitudeCal,
    EFRoughXSXAmplitudeCal,
    RoughDragCal,
    RoughFrequencyCal,
    QuantumVolume,
    InterleavedRB,
    LayerFidelity,
    StandardRB,
    MitigatedProcessTomography,
    MitigatedStateTomography,
    ProcessTomography,
    StateTomography and
    TomographyExperiment.

### Details and comments

- This PR covers many remaining experiments in `issue#1238` and
`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. By default, backends used in the code examples, are
simulators such as, SingleTransmonTestBackend() and
AerSimulator(FakePerth()).

---------

Co-authored-by: 中澤 直仁 <nakazawanaohito@nakazawa-iMac.local>
(cherry picked from commit cc258d7)
wshanks pushed a commit that referenced this pull request Dec 18, 2024
) (#1505)

### Summary

This change adds minimal working code examples to the API pages for
Experiments,
    EFSpectroscopy,
    EFRabi,
    StarkRamseyXYAmpScan,
    FineAmplitudeCal,
    FineXAmplitudeCal,
    FineSXAmplitudeCal,
    FineDragCal,
    FineXDragCal,
    FineSXDragCal,
    FineFrequencyCal,
    FrequencyCal,
    HalfAngleCal,
    RoughAmplitudeCal,
    RoughXSXAmplitudeCal,
    EFRoughXSXAmplitudeCal,
    RoughDragCal,
    RoughFrequencyCal,
    QuantumVolume,
    InterleavedRB,
    LayerFidelity,
    StandardRB,
    MitigatedProcessTomography,
    MitigatedStateTomography,
    ProcessTomography,
    StateTomography and
    TomographyExperiment.

### Details and comments

- This PR covers many remaining experiments in `issue#1238` and
`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. By default, backends used in the code examples, are
simulators such as, SingleTransmonTestBackend() and
AerSimulator(FakePerth()).
<hr>This is an automatic backport of pull request #1494 done by
[Mergify](https://mergify.com).

Co-authored-by: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com>
@wshanks
Copy link
Collaborator

wshanks commented Dec 18, 2024

The update versions are live now on the dev version of the docs: https://qiskit-community.github.io/qiskit-experiments/dev/apidocs/library.html

I backported the PR to the stable 0.8 branch as well. I want to get #1502 merged into 0.8 and then we can release 0.8.1 and the docs changes should appear on the stable version of the docs as well. I might not be able to find anyone to review #1502 before January though.

@wshanks
Copy link
Collaborator

wshanks commented Dec 18, 2024

@Naohnakazawa I wrote the script to check the jupyter execute times. Maybe the QV and RB experiments could be made a little faster (and the QV manual needs to be looked at) but otherwise the non-pulse experiments have similar times (a few notebooks failed because they use jupyter-input which still gets written into the notebook but does not run successfully):

/qiskit-experiments/docs/_build/jupyter_execute/howtos/artifacts.ipynb: 5.258906658971682 sec
/qiskit-experiments/docs/_build/jupyter_execute/howtos/cloud_service.ipynb (rc=1): 11.788806884083897 sec
/qiskit-experiments/docs/_build/jupyter_execute/howtos/figure_generation.ipynb (rc=1): 1.5247604299802333 sec
/qiskit-experiments/docs/_build/jupyter_execute/howtos/job_splitting.ipynb (rc=1): 1.3109210890252143 sec
/qiskit-experiments/docs/_build/jupyter_execute/howtos/rerun_analysis.ipynb (rc=1): 3.3558653329964727 sec
/qiskit-experiments/docs/_build/jupyter_execute/howtos/runtime_sessions.ipynb (rc=1): 3.3562829570146278 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.framework.ExperimentData.ipynb (rc=1): 1.3185771019198 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.EFRoughXSXAmplitudeCal.ipynb: 15.513518309919164 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineAmplitudeCal.ipynb: 4.1482639809837565 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineDragCal.ipynb: 4.134219745988958 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineFrequencyCal.ipynb: 4.564082365948707 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineSXAmplitudeCal.ipynb: 4.058366820099764 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineSXDragCal.ipynb: 4.385018727974966 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineXAmplitudeCal.ipynb: 3.934184434940107 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FineXDragCal.ipynb: 3.966541316942312 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.FrequencyCal.ipynb: 5.093576689017937 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.HalfAngleCal.ipynb: 4.059034834965132 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.RoughAmplitudeCal.ipynb: 8.434523954056203 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.RoughDragCal.ipynb: 7.037029551924206 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.RoughFrequencyCal.ipynb: 24.256941622006707 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.calibration.RoughXSXAmplitudeCal.ipynb: 8.828695923089981 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.CorrelatedReadoutError.ipynb: 4.356256708968431 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.EFRabi.ipynb: 10.02739149297122 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.EFSpectroscopy.ipynb: 54.71397043799516 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineAmplitude.ipynb: 4.510911262943409 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineDrag.ipynb: 4.449775071931072 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineFrequency.ipynb: 5.559963523992337 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineSXAmplitude.ipynb: 4.5086344899609685 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineSXDrag.ipynb: 4.560635166941211 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineXAmplitude.ipynb: 4.6506799350026995 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.FineXDrag.ipynb: 4.697082655038685 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.HalfAngle.ipynb: 4.729153872933239 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.LocalReadoutError.ipynb: 4.79627203498967 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.MultiStateDiscrimination.ipynb: 4.485124061931856 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.QubitSpectroscopy.ipynb: 26.108222590060905 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.Rabi.ipynb: 7.150285701965913 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.RamseyXY.ipynb: 9.616979919024743 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.ReadoutAngle.ipynb: 4.493455042946152 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.RoughDrag.ipynb: 11.757526983972639 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.T1.ipynb: 5.085119526949711 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.T2Hahn.ipynb: 4.845637563965283 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.T2Ramsey.ipynb: 6.19754111696966 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.Tphi.ipynb: 6.2569920079549775 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.characterization.ZZRamsey.ipynb: 7.798441197024658 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.quantum_volume.QuantumVolume.ipynb: 24.915182881988585 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.randomized_benchmarking.InterleavedRB.ipynb: 14.285832598921843 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.randomized_benchmarking.LayerFidelity.ipynb: 19.150157156051137 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.randomized_benchmarking.StandardRB.ipynb: 12.768361176014878 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.tomography.MitigatedProcessTomography.ipynb: 11.28246191504877 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.tomography.MitigatedStateTomography.ipynb: 6.384287246037275 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.tomography.ProcessTomography.ipynb: 11.748739090980962 sec
/qiskit-experiments/docs/_build/jupyter_execute/stubs/qiskit_experiments.library.tomography.StateTomography.ipynb: 5.724725369014777 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/calibrations.ipynb: 42.693148268037476 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/curve_analysis.ipynb (rc=1): 2.475412189029157 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/custom_experiment.ipynb (rc=1): 3.535353348008357 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/data_processor.ipynb: 10.335916055017151 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/getting_started.ipynb (rc=1): 7.175815726979636 sec
/qiskit-experiments/docs/_build/jupyter_execute/tutorials/visualization.ipynb (rc=1): 24.23371332406532 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/characterization/stark_experiment.ipynb (rc=1): 18.890956019982696 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/characterization/t1.ipynb: 8.079314351081848 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/characterization/t2hahn.ipynb: 11.915845172014087 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/characterization/t2ramsey.ipynb: 13.554813320050016 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/characterization/tphi.ipynb: 11.482215374009684 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/measurement/readout_mitigation.ipynb: 5.378361587994732 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/measurement/restless_measurements.ipynb: 10.064856598037295 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/verification/quantum_volume.ipynb: 132.17843462596647 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/verification/randomized_benchmarking.ipynb: 24.7293363759527 sec
/qiskit-experiments/docs/_build/jupyter_execute/manuals/verification/state_tomography.ipynb: 12.035055581014603 sec

@Naohnakazawa Naohnakazawa deleted the issue-#1238-draft2 branch December 19, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants