-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f90665
commit da81c48
Showing
3 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import numpy as np | ||
import pytest | ||
from quam.components.pulses import WaveformPulse | ||
|
||
|
||
def test_waveform_pulse_length(): | ||
pulse = WaveformPulse(waveform_I=[1, 2, 3]) | ||
assert pulse.length == 3 | ||
|
||
pulse.waveform_I = [1, 2, 3, 4] | ||
|
||
with pytest.raises(AttributeError): | ||
pulse.length = 5 | ||
|
||
assert pulse.length == 4 | ||
|
||
|
||
def test_waveform_pulse_IQ(): | ||
pulse = WaveformPulse(waveform_I=[1, 2, 3], waveform_Q=[4, 5, 6]) | ||
assert np.all( | ||
pulse.waveform_function() == np.array([1, 2, 3]) + 1.0j * np.array([4, 5, 6]) | ||
) | ||
|
||
|
||
def test_waveform_pulse_IQ_mismatch(): | ||
pulse = WaveformPulse(waveform_I=[1, 2, 3], waveform_Q=[4, 5]) | ||
with pytest.raises(ValueError): | ||
pulse.waveform_function() | ||
|
||
|
||
def test_waveform_pulse_to_dict(): | ||
pulse = WaveformPulse(waveform_I=[1, 2, 3], waveform_Q=[4, 5, 6]) | ||
assert pulse.to_dict() == { | ||
"waveform_I": [1, 2, 3], | ||
"waveform_Q": [4, 5, 6], | ||
} |
da81c48
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.
@nulinspiratie
At line. 23, maybe need to add
"WaveformPulse",
?from quam.components.pulses import WaveformPulse
didn't find the added class on my env. Maybe it is editor dependent.da81c48
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.
Fixed, thanks!