qiskit-community / povm-toolbox

A toolbox for the implementation of positive operator-valued measures (POVMs).
https://qiskit-community.github.io/povm-toolbox/
Apache License 2.0
6 stars 0 forks source link

How to interpret `shots` and `num_batches` ? #4

Closed timmintam closed 1 month ago

timmintam commented 2 months ago

We could either do this, or reverse it and interpret the user-provided shots value (which is the input here) as num_batches and then document that the actual number of shots that will be run on the hardware equals:

actual_shots = user_provided_shots * self.shot_batch_size

I don't have a strong opinion on this. This suggestion would avoid the requirement of a ValueError and ensures that all values for shots are valid. But this is at the expense of a user potentially over-committing their shots.

Originally posted by @oss-zurich in internal IBM GIthub

-> Pending question, to be discussed in the Tuesday meeting.

mrossinek commented 1 month ago

I just saw this again. I actually think that, provided we document this well, the above suggestion would be better than the current implementation. I stumbled a little bit when I did some quick testing and did not pay attention to the fact that the user_provided_shots must be a multiple of shot_batch_size. While that is technically documented it did not stand out very much.

If we instead apply the suggestion above, all values of user_provided_shots and shot_batch_size will be valid. The default is shot_batch_size=1 which also means that the user_provided_shots value equals the number of shots that will be actually run. If a user now deliberately overwrites shot_batch_size they must have read its docs to understand what this does. That would be a natural place to document the behavior w.r.t. the increased number of physical shots submitted to the backend :+1: