unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
359 stars 157 forks source link

Add a "plot()" method to the Factory class. #333

Closed andreamari closed 3 years ago

andreamari commented 4 years ago

Issue Description

Very often one is interested in qualitatively "seeing" the best fit generated by a ZNE factory. Currently it is possible to do this by hand: by extracting data from the factory and plotting it.

Proposed Solution

Maybe it could nice if Factory objects had a self.plot() method which directly produces a plot of the best fit with a some nice and fixed style. Perhaps we could also include additional data in the plot legend (e.g. zne limit, error, etc. ). In this way one would get a compact visualization of the full error mitigation process.

This idea is inspired by the lmfit package in which a similar feature exists. See, e.g., https://lmfit.github.io/lmfit-py/examples/example_emcee_Model_interface.html

Possible drawback: need to add matplotlib to the requirements.

rmlarose commented 4 years ago

+1.

Note matplotlib is already a requirement of Cirq https://github.com/quantumlib/Cirq/blob/master/requirements.txt#L6.

willzeng commented 4 years ago

Agreed, especially since we already have the dependency with cirq.

karalekas commented 3 years ago

@crazy4pi314 to sync up with @rmlarose

crazy4pi314 commented 3 years ago

As this has been merged, I'll close this now.