Skip to content

Commit

Permalink
Replace waveform hash, since NumPy array are unhashable (because muta…
Browse files Browse the repository at this point in the history
…ble)
  • Loading branch information
alecandido committed Jan 29, 2024
1 parent f060c4b commit e3a5813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qibolab/instruments/qm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def register_waveform(self, pulse, mode="i"):
self.waveforms[serial] = {"type": "constant", "sample": pulse.amplitude}
else:
waveform = getattr(pulse, f"envelope_waveform_{mode}")(SAMPLING_RATE)
serial = hash(waveform)
serial = hash(waveform.tobytes())
if serial not in self.waveforms:
self.waveforms[serial] = {
"type": "arbitrary",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_instruments_qm.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def test_qmopx_register_pulse(dummy_qrc, pulse_type, qubit):
"operation": "control",
"length": pulse.duration,
"waveforms": {
"I": hash(pulse.envelope_waveform_i()),
"Q": hash(pulse.envelope_waveform_q()),
"I": hash(pulse.envelope_waveform_i().tobytes()),
"Q": hash(pulse.envelope_waveform_q().tobytes()),
},
}

Expand Down

0 comments on commit e3a5813

Please sign in to comment.