pyquil icon indicating copy to clipboard operation
pyquil copied to clipboard

Mcm measurement buffers

Open Skoricius opened this issue 1 year ago • 0 comments

Description

Updating how the memory regions are adapted to support repeated measurements on the same qubit. When the same qubit is measured multiple times, the received buffer is of the length num_shots*n_mmts where sequential measurements are done in blocks of n_mmts. The returned ro_sources then contain multiple MemoryReference with the same name and key, but different offset.

What I do in this PR is first construct the list of all relevant sources. Which filters out the unrequested ro_sources as well as lists all MemoryReference objects that refer to the same key. This then lets me deduce the correct num_shots (length of the buffer divided by the number of MemoryReference referring to that buffer). Also, to get the correct ordering of the entries in the buffer, I needed to sort the MemoryReference by their offset (I am less sure if this is the correct thing to do, but it seems to work).

I am unsure about how to test this for the complex buffers, but it might work as is.

Checklist

  • [ ] The PR targets the master branch
  • [x] The above description motivates these changes.
  • [x] The change is atomic and can be described by a single commit (your PR will be squashed on merge).
  • [ ] All changes to code are covered via unit tests.
  • [x] Parameters and return values have type hints with PEP 484 syntax.
  • [x] Functions and classes have useful Sphinx-style docstrings.
  • [ ] (Bugfix) The associated issue is referenced above using auto-close keywords.

Skoricius avatar Aug 07 '23 16:08 Skoricius