qiskit-community / qiskit-experiments

Qiskit Experiments
https://qiskit-community.github.io/qiskit-experiments/
Apache License 2.0
154 stars 125 forks source link

Minimal working code example in experiment API docs #1238

Open coruscating opened 1 year ago

coruscating commented 1 year ago

Following the template in #1221, add minimal working code examples for all experiments for ease of use.

Naohnakazawa commented 1 year ago

Hello @coruscating, can I work on this issue?

Naohnakazawa commented 1 year ago

Hi @coruscating, if my understanding of this issue (and #1221) is correct, I have to add a ‘ #section: example ‘ and a sample code for the experiment( for example, T1) on the source(/library/characterization/t1.py). Even if it would help for user to do the experiment (T1), the information is duplicated because ‘#section: manual’ cites /manuals/characterization/t1. The use of :hide-code: means that the choice of the backend still remains in the source. I am happy if you have an alternative good idea?

coruscating commented 1 year ago

Yes, there will be a bit of duplicate code in the case where experiments have manuals, but most of the existing experiments don't have a separate manual. The purpose of this code example and the manual are also different: the example is meant to be a really quick code snippet that users can copy and paste to get an experiment running, whereas the manual is supposed to cover more advanced usage and detailed technical info about the experiment.

I think keeping the backend in the source and hiding it in the output is fine—we're only using simulators for documentation, so the idea is that users will instantiate their own backend on which to run the experiment. Do you have more concerns/ideas about this?

Naohnakazawa commented 1 year ago

How many experiments do you want to add the code snippet?

coruscating commented 1 year ago

@Naohnakazawa Ideally all experiments, but if that's too much work at once, you can make a PR for a single category of experiments, for example all characterization experiments.

Naohnakazawa commented 4 months ago

Hello @coruscating, I have accidentally clicked the button on assignees, and unassigned myself. Can I continue working on this issue?

coruscating commented 4 months ago

@Naohnakazawa Yes, of course. Reassigned you, thanks.