Skip to content

Fix swap-time aware fidelity timing and add validation notebook#359

Closed
amlabdr wants to merge 1 commit into
sequence-toolbox:RnDfrom
amlabdr:master
Closed

Fix swap-time aware fidelity timing and add validation notebook#359
amlabdr wants to merge 1 commit into
sequence-toolbox:RnDfrom
amlabdr:master

Conversation

@amlabdr

@amlabdr amlabdr commented May 31, 2026

Copy link
Copy Markdown

Summary

Fixes timing handling in entanglement swapping fidelity and adds a small validation notebook.

Changes

  • sequence/entanglement_management/swapping.py
    • Refreshes left/right memory fidelity at swap time in EntanglementSwappingA (bds_decohere() before degradation * f1 * f2).
    • Adds swap_time to swap result messages.
    • EntanglementSwappingB now treats msg.fidelity as the fidelity value at swap time (not at receive time).
      When the swap-result message arrives, the protocol:
      1. reconstructs the Bell-diagonal swapped state from msg.fidelity,
      2. sets the state last_update_time to swap_time,
      3. applies BDS decoherence over the transit interval (receive_time - swap_time),
      4. uses the resulting fidelity as the final end-memory fidelity.

This ensures message transit delay is reflected in delivered fidelity.

  • example/demo_for_beginners/swapping_fidelity_wait_time_fix.ipynb
    • Demonstrates stock timing vs wait-aware timing with real SeQUeNCe protocol runs.
    • Shows contribution of waiting loss and classical-result transit loss.

Outcome

  • Stock timing stays nearly flat vs waiting.
  • Wait-aware timing decreases with waiting, matching expected decoherence behavior.

Author: Abderrahim Amlou

@hayekr hayekr changed the base branch from master to RnD June 5, 2026 16:38
@hayekr

hayekr commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Hello, thank you for your contribution. Your changes modify an outdated version of the swapping protocol; and therefore conflict with the current version. Please review the RnD branch for the most recent developement source code.

@caitaozhan

caitaozhan commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Hi Abderrahim,

Thank you for using SeQUeNCe and your Pull Request. Your PR is about adding the decoherence during the swapping protocol. However, we already introduced a new protocol called EntanglementSwappingA_BDS and EntanglementSwappingB_BDS in the RnD branch, and the new protocols include the changes you made in this PR. Please check out https://github.com/sequence-toolbox/SeQUeNCe/blob/RnD/sequence/entanglement_management/swapping/swapping_bds.py#L207

We have been using the BDS version of the swapping protocol for a while. Also, the whole swapping module was refactored earlier this year, see https://github.com/sequence-toolbox/SeQUeNCe/tree/RnD/sequence/entanglement_management/swapping. But those changes were not introduced to the master branch yet. It is now in the RnD branch and will be merged into the master branch very soon.

Also, we will remove the RnD branch soon, so that the master branch is always the latest branch.

Thanks,
Caitao

@hayekr

hayekr commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Closing

@hayekr hayekr closed this Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants