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

T2 experiment with Hahn echoes #365

Merged
merged 118 commits into from
Jan 31, 2022
Merged

Conversation

ItamarGoldman
Copy link
Contributor

@ItamarGoldman ItamarGoldman commented Aug 22, 2021

Summary

A class for T2 experiment.

Details and comments

Two class will be added:

  1. T2Hahn - T2 Experiment handler
  2. T2Analysis - Analysis for the experiment

remaining tasks

  • implement mock backend
  • support different time scales
  • remove multibit support
  • integrate curve analysis
  • Add testing
  • autodocstring
  • tutorial

@eliarbel eliarbel linked an issue Aug 26, 2021 that may be closed by this pull request
Closed
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
qiskit_experiments/library/characterization/T2Hahn.py Outdated Show resolved Hide resolved
Excluded quality check for num_echoes=0 since it needs to be bad. The reason it is still there is to make sure the backend still compatible with 0 echoes.
Copy link
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the tutorial, fourth cell:

  1. What's the straight line?
  2. Why is there a warning about sqrt?

docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
@ItamarGoldman ItamarGoldman changed the title [WIP] T2 experiment with Hahn echoes T2 experiment with Hahn echoes Jan 13, 2022
Copy link
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's close to approval 😃

docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
test/test_t2hahn.py Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Outdated Show resolved Hide resolved
docs/tutorials/t2hahn_characterization.ipynb Show resolved Hide resolved
@yaelbh yaelbh mentioned this pull request Jan 31, 2022
Copy link
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ItamarGoldman 😃

@yaelbh yaelbh merged commit c211b01 into qiskit-community:main Jan 31, 2022
@chriseclectic chriseclectic added the Changelog: New Feature Include in the "Added" section of the changelog label Feb 1, 2022
@ItamarGoldman ItamarGoldman deleted the T2_Hahn_Echo branch April 18, 2022 11:27
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* Add template for T2 exp, still need to check results

* Made the code cleaner

* cleared RB documantation

* Fixed errors and for 1 echo the circuit is generated (need to work on options)

Changed rotation to Pi/2
This code support only n_echoes=1 for further testing

* Changed the Echo pulse to pi instead of pi/2

* Changed the class to support only single qubit

Changed the class to support only single qubit and added checks to verify parameters

* added options instead of fields

* Pylint and Black

* used base class attribute for qubit

used base class attribute to store the qubit and not through options

* Updated code to be as in other experiments

* Added the Analysis class

* Base analysis class draft + fixes

* Update T2Hahn.py

* Update t2hahn.py

* Update t2hahn.py

* Added Backend template from t2ramsey

* Update t2hahn_backend.py

* fixed doc string and input check function

* the circuit is now working on qubit '0' exclusively

* Update t2hahn.py

* Added operation for 'RX' gate

* Removed duplicate length from verify parameters

* changed documentation suggestions

* changed documanttion

* Removed * from T_2

* changed basis gate 'h', 'p' to 'ry', 'rx'

* Update t2hahn_backend.py

* Added Ry, Rx and measure gates

* Changed every t2ramsy to t2hahn (WIP)

* changed "T2Hahn" to "T2"

* added tests (still not working)

* Delay now applied once

By using the model for this backhand if I do two delays we get the following probability for measuring '0':

P('0') = (1-P(err))^2 + 0.5 * P(err) * (2 - P(err) )
we can see that the fitting isn't the same as one we expected (as P(err) is approximate by e^(-t/[tau]) so this probability isn't the same. hence' we will use 1 noise for delay so we will get the approximated fitting)

* added tests for T2hahn Echo

* Applied black

* Update t2hahn_backend.py

* Update t2hahn_backend.py

* Changed the gate op to be a function and added time evolution of the state

* Added output types

* Added measurement on "ZY" plane in Z basis

* Added angle parameter for rotation and fixed bugs

Changed last Ry gate angle to pi/2 (instead of -pi/2 because the number of echoes we do is odd)
Added angle to the rotations gate for precision.
added initialization error

* changed "==" to "np.isclose()"

* Pass pylint

* Pylint + black

* cleaned code

* incomplete change to backend

* deleted unnecessary fit parameters and changed input for backend

* changes to use only Rx without Ry

* Experiment Working Up to tau that is not correct

* Update comment Y90 to X90

Co-authored-by: Yael Ben-Haim <[email protected]>

* Deleted extra space from measurement function in the backend

Co-authored-by: Yael Ben-Haim <[email protected]>

* changed the backend as Yael review comments

* Test are working

Test are working.

Need to add:
 * Parallel Experiment

Could be a problem:
The meta data right now is for the cumulative delay time.

* Passed Black and Lint

* Update t2hahn_backend.py

* deleted the abs as the projection is a real number

* Black and pylint

* Added comments

* Added tutorial

* Added tutorial and fix bug for echoes

* Added Parallel experiment to the test and backend

* Changed that the analysis class will be passed to constructor

* Added release notes

* Changed the code dor recent changes (added config, removed unit, etc)

Add Hahn analysis class to the lists under __init__ both in "characterization" and "characterization\analysis".
Removed the support in units.
Added experiment.config test and serialization.

* Passed black and pylint

* passed pylint and black

* fixed bug

* fixed docs

fixed docs spaces and blank lines

* Update t2hahn.py

* Raising error when delay applied and the qubit isn't in the XY plain or theta isn't pi or 0

* Update test_t2hahn.py

* edited comment and change 'plain' to 'plane'

* added tests for number of echoes

* Fixed Black

* rerun pylint

* Added to tutorial both experiments

* updated code + tutorial per instructions

There is one thing missing, The analysis of Hahn echo doesn't work for num_echoes=0.

* fixed a bug for 0 echoes case.

* fixed issue

added explanation about the frequency.
added experiment with 0 echoes.

* In the test excluded quality check for num_echoes=0

Excluded quality check for num_echoes=0 since it needs to be bad. The reason it is still there is to make sure the backend still compatible with 0 echoes.

* Changed tutorial text and a bit of code

* Added bounds and removed p0 from analysis, finished tutorial

* Edited tutorial as reviewed

* Update t2hahn_characterization.ipynb

* fixed test to be with "self.json_equiv" and fixed lint

* added cosmetic fixes to the tutorial

* Added text and changed functions

I have added linking to Ramsey experiment.
Added the term detuning frequency.
Changed number of echoes in the comparation to '1 v.s. 0' instead then '4 v.s. 0'. I removed it because the there is no pint in doing 4 echoes in mock backend without T1 noise.

* updated feature text.

* black version 22.1.0 pass

* fixed angles to be of absolute value and not previous ones.

* updated text in the tutorial.

* changed doc string year to 2022

* updated tutorial text

* fixed text

Co-authored-by: Yael Ben-Haim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CPMG
5 participants