-
Notifications
You must be signed in to change notification settings - Fork 1.1k
T1 decay for simulator #4326
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
T1 decay for simulator #4326
Conversation
@@ -228,6 +202,39 @@ def test_curve_fit_plot_warning(): | |||
bad_fit.plot(include_fit=True) | |||
|
|||
|
|||
@pytest.mark.parametrize('t1', [200, 500, 700]) | |||
def test_noise_model_constant(t1): | |||
class GradualDecay(cirq.NoiseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using cirq.NoiseModel.from_noise_model_like(cirq.amplitude_damp(...))
may provide a stronger demonstration here, since the new simulator-based experiment also works with duration-agnostic noise models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really a huge fan of making the experiments require the user to provide a simulator=True/False
flag that subtly changes how the experiment would be constructed in order to artificially simulate more noise.
I think the responsibility should fall on whoever made the simulator and accompanying noise model to take into consideration the increasing duration of the wait gate instead of artificially adding more waits to the experiment.
Can we leave the t1_decay
code unchanged and still get the expected results on this test ? (maybe increasing the repetitions and tightening up the tolerance a bit too ?)
Unfortunately, doing this right would require something along the lines of #2749, as our current noise models are agnostic to the duration of the gates involved. Making a model sensitive to Essentially, the issue here is that some noise models (which may otherwise provide an accurate model of hardware) produce nonsense results here because the test assumes noise is continuous (rather than discretized). We'd like to be able to estimate T1 for these models, which requires discretizing the WaitGate. Would changing the parameter name to something like |
Why can't we just modify these existing noise models to check if the operation is a wait gate and then act accordingly ? Looking at the interfaces for |
We can - but again, doing so correctly amounts to solving #2749. If a noise model can recognize that I think I understand your concern with this PR, though - it essentially "canonicalizes" the per-gate noise as a correct use case for this experiment, which is misleading. If we want to avoid that, I would support a version of this PR that only adds tests: |
Sure that makes a bit more sense to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one last nit.
probs = data['true_count'] / (data['true_count'] + data['false_count']) | ||
|
||
# Check that there is no decay in probability over time | ||
assert np.all(np.isclose(np.mean(probs), probs, 0.2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automerge cancelled: A required status check is not present. Missing statuses: ['Build docs', 'Build protos', 'Changed files test', 'Coverage check', 'Doc test', 'Format check', 'Lint check', 'Misc check', 'Notebook formatting', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Type check', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage'] |
When using a simulator, noise is applied after each gate. Previously, in the t1 decay method, there's only one wait gate, which means that noise is not properly applied "over time" when using a simulator. I've updated the method to add a number of wait gates proportional to the length of the delay when using a simulator. Related to Issue #[4264](quantumlib#4264) As always, any feedback is appreciated!
When using a simulator, noise is applied after each gate. Previously, in the t1 decay method, there's only one wait gate, which means that noise is not properly applied "over time" when using a simulator. I've updated the method to add a number of wait gates proportional to the length of the delay when using a simulator. Related to Issue #[4264](quantumlib#4264) As always, any feedback is appreciated!
When using a simulator, noise is applied after each gate. Previously, in the t1 decay method, there's only one wait gate, which means that noise is not properly applied "over time" when using a simulator. I've updated the method to add a number of wait gates proportional to the length of the delay when using a simulator.
Related to Issue #4264
As always, any feedback is appreciated!