Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fbca0d1
bump RF storage to v1.5.x
mcencini Jun 19, 2025
3093ab1
add (now mandatory) 'use' parameter to examples
mcencini Jun 20, 2025
2d7af67
Bump ADC storage to v1.5.x
mcencini Jun 20, 2025
f577a62
Bump gradient storage to v1.5.x
mcencini Jun 20, 2025
c8e0d17
Bump plot to 1.5.x (RF only)
mcencini Jun 23, 2025
fbd3a96
Merge branch 'v1.5.0-adc' of github.com:mcencini/pypulseq into v1.5.0…
mcencini Jun 23, 2025
31b514c
Bump plot to v1.5.x (inluding ADC)
mcencini Jun 23, 2025
5b5f96d
add missing entry in supported rf use
mcencini Jun 23, 2025
5d13676
Merge branch 'v1.5.0-rf' of github.com:mcencini/pypulseq into v1.5.0-adc
mcencini Jun 23, 2025
8e9bb38
sync with v1.5.0_dev
mcencini Jun 23, 2025
5239327
Merge branch 'v1.5.0-adc' into v1.5.0-grad
mcencini Jun 24, 2025
7caae64
Merge branch 'v1.5.0-adc' into v1.5.0-plot
mcencini Jun 24, 2025
a28d04a
fix add_gradients
mcencini Jun 26, 2025
d8d956f
update plot with custom tips (via optional dependency)
mcencini Jun 26, 2025
fbe3974
safer custom datatip
mcencini Jun 26, 2025
d2d72de
Merge remote-tracking branch 'origin/v1.5.0_dev' into v1.5.0-grad
mcencini Jun 26, 2025
c2e586e
add optional safety check in scale_grad
mcencini Jun 27, 2025
53d79c3
Merge remote-tracking branch 'origin/v1.5.0-grad' into v1.5.0-plot
mcencini Jun 27, 2025
de8058c
merge v1.5.0-grad
mcencini Jun 27, 2025
495a5b3
add paper_plot
mcencini Jun 27, 2025
04f7db9
update waveform_exports
mcencini Jul 11, 2025
6e89a65
Merge branch 'v1.5.0_dev' into v1.5.0-plot
mcencini Jul 11, 2025
8c38b3f
fix UserWarning for GridSpec
mcencini Jul 11, 2025
d1528aa
bug fix in paperPlot - now reproduces MATLAB exactly
mcencini Jul 11, 2025
d64eeed
enable multiple datatips
mcencini Jul 11, 2025
1701b6f
move *plot to pypulseq.utils + fix seq.plot() return hint
mcencini Jul 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/scripts/write_gre.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pypulseq as pp


def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_pypulseq.seq'):
def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_pypulseq.seq', paper_plot: bool = False):
# ======
# SETUP
# ======
Expand Down Expand Up @@ -121,7 +121,10 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_p
# VISUALIZATION
# ======
if plot:
seq.plot()
if paper_plot:
seq.paper_plot()
else:
seq.plot()

seq.calculate_kspace()

Expand All @@ -144,4 +147,4 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_p


if __name__ == '__main__':
main(plot=False, write_seq=True)
seq = main(plot=True, paper_plot=True, write_seq=False)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies = [

[project.optional-dependencies]
sigpy = ["sigpy>=0.1.26"]
mplcursors = ["mplcursors"]
test = [
"coverage",
"codecov",
Expand Down
46 changes: 45 additions & 1 deletion src/pypulseq/Sequence/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,51 @@ def set_block(self, block_index: int, *args: SimpleNamespace) -> None:
self.block_durations[block_index] = float(duration)


# TODO: refactor to get_raw_block_content_id + get_block
def get_raw_block_content_IDs(self, block_index: int) -> SimpleNamespace:
"""
Returns PyPulseq block content IDs at `block_index` position in `self.block_events`.

No block events are created, only the IDs of the objects are returned.

Parameters
----------
block_index : int
Index of PyPulseq block to be retrieved from `self.block_events`.

Returns
-------
block : SimpleNamespace
PyPulseq block content IDs at 'block_index' position in `self.block_events`.
"""
raw_block = SimpleNamespace(block_duration=0, rf=0, gx=0, gy=0, gz=0, adc=0, ext=[])
event_ind = self.block_events[block_index]

# Extensions
if event_ind[6] > 0:
next_ext_id = event_ind[6]
while next_ext_id != 0:
ext_data = self.extensions_library.data[next_ext_id]
raw_block.ext.append(ext_data[:2])
next_ext_id = ext_data[2]
raw_block.ext = np.stack(raw_block.ext, axis=-1)

# RF
if event_ind[1] > 0:
raw_block.rf = event_ind[1]

# Gradients
grad_channels = ['gx', 'gy', 'gz']
for i in range(len(grad_channels)):
if event_ind[2 + i] > 0:
setattr(raw_block, grad_channels[i], event_ind[2 + i])

# ADC
if event_ind[5] > 0:
raw_block.adc = event_ind[5]

return raw_block


def get_block(self, block_index: int) -> SimpleNamespace:
"""
Returns PyPulseq block at `block_index` position in `self.block_events`.
Expand Down
Loading
Loading