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

Flexible measurements #282

Closed
giangiac opened this issue Dec 19, 2022 · 2 comments
Closed

Flexible measurements #282

giangiac opened this issue Dec 19, 2022 · 2 comments
Assignees
Labels
enhancement Request for a new feature or a change to an existing feature
Milestone

Comments

@giangiac
Copy link

I am not sure if what I am asking is already possible, but I could not find the documentation to implement it.

Situation:
I would like to create a model with local noise such that the measurement layer is not 'Mdefault' but can be customized using two types of measurements:

  1. single qubit measurement in the Z basis
  2. two-qubit parity measurement (returning 0 for the even subspace and 1 for the odd subspace)

Furthermore, I would like to explicitly indicate which qubit are measured with single-qubit measurements, which pairs of qubit undergo a parity measurement, and which qubits are left unmeasured.

If this is already possible, could you provide an example?
Otherwise is there interest in such extension?

@giangiac giangiac added the enhancement Request for a new feature or a change to an existing feature label Dec 19, 2022
@sserita sserita self-assigned this May 17, 2023
@aristaeus
Copy link

aristaeus commented Jun 29, 2023

I don't know if there's a better way to do this, but the workaround I have found is to extract the density matrix and do the measurement myself.

I found the functions to go to and from a numpy array in this notebook: https://github.com/pyGSTio/pyGSTi/blob/master/jupyter_notebooks/Tutorials/objects/advanced/Operators.ipynb

Rough code example, needs a bit of polishing to be generally useful

rho = mdl.operation_blks['layers'][('Gh', 0)].acton(rho)
dm = p_z0 * pygsti.tools.ppvec_to_stdmx(rho) # multiply by our projector
dm = dm / np.trace(dm) # renormalise
rho = pygsti.modelmembers.states.StaticState(pygsti.tools.stdmx_to_ppvec(dm))

@sserita sserita modified the milestones: 0.9.13, 0.9.12.1 Nov 29, 2023
@sserita sserita modified the milestones: 0.9.12.1, 0.9.13 Feb 6, 2024
@sserita sserita modified the milestones: 0.9.13, 0.9.12.2 Mar 26, 2024
@sserita
Copy link
Contributor

sserita commented Apr 2, 2024

Apologies on the super delayed response to this. In fact, this sort of thing is of interest and we have incorporated it into pyGSTi. There is now a tutorial notebook on custom POVMs, including mixing computational basis and parity measurements as of pyGSTi 0.9.12.1: https://github.com/sandialabs/pyGSTi/blob/master/jupyter_notebooks/Tutorials/objects/advanced/CustomPOVM.ipynb

@sserita sserita closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for a new feature or a change to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants