qiboteam / qibolab

Quantum hardware module and drivers for Qibo.
https://qibo.science
Apache License 2.0
41 stars 12 forks source link

Turn `Waveform` into a bare array #774

Closed alecandido closed 7 months ago

alecandido commented 7 months ago

Now Waveform is only useful as a type hint.

There is only one caveat: Waveform was hashable, np.ndarray is not (because mutable). The gap was filled by calling array.tobytes() (since the generated bytes are immutable, as a snapshot of an array at a specific time). It's not optimal, since it's still a hash of an actually mutable object, but we just have to be consistent.

However, I'm still using the trick explicitly in QM. Are you aware of any other place where the Waveform had to be hashable?

codecov[bot] commented 7 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (a5b7248) 61.94% compared to head (ba476ee) 61.68%.

Files Patch % Lines
src/qibolab/pulses/shape.py 82.60% 4 Missing :warning:
src/qibolab/instruments/qblox/sequencer.py 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## simplify-pulse-7 #774 +/- ## ==================================================== - Coverage 61.94% 61.68% -0.26% ==================================================== Files 52 51 -1 Lines 5723 5690 -33 ==================================================== - Hits 3545 3510 -35 - Misses 2178 2180 +2 ``` | [Flag](https://app.codecov.io/gh/qiboteam/qibolab/pull/774/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/qiboteam/qibolab/pull/774/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | `61.68% <82.05%> (-0.26%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.