-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor bug fixes in sequence to allow plotting to work with show_block…
…s = True. Allow all uses for gauss pulse. Tests for both.
- Loading branch information
Showing
4 changed files
with
51 additions
and
6 deletions.
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,22 @@ | ||
"""Tests for the make_gauss_pulse module | ||
Will Clarke, University of Oxford, 2023 | ||
""" | ||
|
||
from types import SimpleNamespace | ||
|
||
import pytest | ||
|
||
from pypulseq import make_gauss_pulse | ||
from pypulseq.supported_labels_rf_use import get_supported_rf_uses | ||
|
||
|
||
def test_use(): | ||
|
||
with pytest.raises( | ||
ValueError, | ||
match=r"Invalid use parameter. Must be one of"): | ||
make_gauss_pulse(flip_angle=1, use='invalid') | ||
|
||
for use in get_supported_rf_uses(): | ||
assert isinstance(make_gauss_pulse(flip_angle=1, use=use), SimpleNamespace) |
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,23 @@ | ||
"""Tests for the make_gauss_pulse module | ||
Will Clarke, University of Oxford, 2023 | ||
""" | ||
|
||
|
||
from types import SimpleNamespace | ||
|
||
import pytest | ||
from unittest.mock import patch | ||
|
||
from pypulseq import Sequence | ||
from pypulseq import make_gauss_pulse | ||
|
||
|
||
@patch("matplotlib.pyplot.show") | ||
def test_plot(mock_show): | ||
seq = Sequence() | ||
seq.add_block( | ||
make_gauss_pulse(flip_angle=1)) | ||
assert seq.plot() is None | ||
|
||
assert seq.plot(show_blocks=True) is None |