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

Sequence building #1026

Merged
merged 10 commits into from
Sep 13, 2024
Merged

Sequence building #1026

merged 10 commits into from
Sep 13, 2024

Conversation

alecandido
Copy link
Member

Just missing tests.

@alecandido alecandido linked an issue Sep 3, 2024 that may be closed by this pull request
2 tasks
@alecandido alecandido added this to the Qibolab 0.2.0 milestone Sep 3, 2024
@alecandido alecandido added the enhancement New feature or request label Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.47%. Comparing base (40b09e4) to head (18ec55d).
Report is 11 commits behind head on 0.2.

Additional details and impacted files
@@            Coverage Diff             @@
##              0.2    #1026      +/-   ##
==========================================
+ Coverage   51.13%   51.47%   +0.33%     
==========================================
  Files          56       56              
  Lines        2726     2745      +19     
==========================================
+ Hits         1394     1413      +19     
  Misses       1332     1332              
Flag Coverage Δ
unittests 51.47% <100.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alecandido alecandido marked this pull request as ready for review September 5, 2024 18:00
@alecandido
Copy link
Member Author

The tests/integration/ folder is a mini showcase of what I have in mind for #1021. I did not really want to enter that chapter, but I wanted a comprehensive test to showcase the interface as I believe it could be used in Qibocal, and this was not a unit test neither for native nor for sequence, but spanning both.
That's why I created the additional folder, but I don't want to face the more general issue right now.

@@ -93,17 +94,36 @@ def pulse_channels(self, pulse_id: int) -> list[ChannelId]:
"""Find channels on which a pulse with a given id plays."""
return [channel for channel, pulse in self if pulse.id == pulse_id]

def concatenate(self, other: "PulseSequence") -> None:
def concatenate(self, other: Iterable[_Element]) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Why do we accept any iterable here? Isn't PulseSequence sufficient? Same for __or__ and __ior__.

Copy link
Member Author

Choose a reason for hiding this comment

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

seq = (
q1.RX()
| p12.CZ()
| [(ch1.drive, Delay(duration=6.5))]
| q2.RX()
| q0.RX12()
| p02.CZ()
)

The explicit pulse-like here (the Delay) is contained in a list, which is perfectly homogeneous to a PulseSequence (since PulseSequence is a list subclass), but it's not a PulseSequence.

In general, it is very cheap to support, and quite user-friendly (e.g. even an iterator over _Element would work, so you can use literals such as list comprehension and generators, that otherwise should be manually wrapped in a PulseSequence).

src/qibolab/sequence.py Show resolved Hide resolved
src/qibolab/sequence.py Outdated Show resolved Hide resolved
@alecandido
Copy link
Member Author

On my side, I'm ok to merge. But there are still two open discussions.

@alecandido alecandido merged commit ff05ddb into 0.2 Sep 13, 2024
28 checks passed
@alecandido alecandido deleted the sequence-building branch September 13, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minor native & sequence improvements
2 participants