Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion examples/scripts/write_2Dt1_mprage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
apodization=0.5,
time_bw_product=4,
return_gz=True,
use='excitation',
)

flip90 = 90 * pi / 180
rf90 = pp.make_block_pulse(flip_angle=flip90, system=system, duration=500e-6, time_bw_product=4)
rf90 = pp.make_block_pulse(flip_angle=flip90, system=system, duration=500e-6, time_bw_product=4, use='preparation')

# =========
# Readout
Expand Down
6 changes: 4 additions & 2 deletions examples/scripts/write_3Dt1_mprage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
# RF preparatory, excitation
# =========
flip_exc = 12 * pi / 180
rf = pp.make_block_pulse(flip_angle=flip_exc, system=system, duration=250e-6, time_bw_product=4)
rf = pp.make_block_pulse(flip_angle=flip_exc, system=system, duration=250e-6, time_bw_product=4, use='excitation')

flip_prep = 90 * pi / 180
rf_prep = pp.make_block_pulse(flip_angle=flip_prep, system=system, duration=500e-6, time_bw_product=4)
rf_prep = pp.make_block_pulse(
flip_angle=flip_prep, system=system, duration=500e-6, time_bw_product=4, use='preparation'
)

# =========
# Readout
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_epi.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'epi_p
time_bw_product=4,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Define other gradients and ADC events
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_epi_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'epi_l
time_bw_product=4,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Define trigger
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_epi_se.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'epi_s
time_bw_product=4,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Define other gradients and ADC events
Expand Down
2 changes: 2 additions & 0 deletions examples/scripts/write_epi_se_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'epi_s
bandwidth=np.abs(sat_freq),
freq_offset=sat_freq,
delay=system.rf_dead_time,
use='saturation',
)
gz_fs = pp.make_trapezoid(channel='z', system=system, delay=pp.calc_duration(rf_fs), area=1 / 1e-4)

Expand All @@ -70,6 +71,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'epi_s
time_bw_product=4,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Create 90 degree slice refocusing pulse and gradients
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_gre.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_p
system=system,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)
# Define other gradients and ADC events
delta_k = 1 / fov
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_gre_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_l
system=system,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Define other gradients and ADC events
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_haste.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'haste
phase_offset=rfex_phase,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)
GS_ex = make_trapezoid(
channel='z',
Expand Down
11 changes: 9 additions & 2 deletions examples/scripts/write_mprage.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'mprag
ax.n3 = xyz.index(ax.d3)

# Create alpha-degree hard pulse and gradient
rf = pp.make_block_pulse(flip_angle=alpha * np.pi / 180, system=system, duration=rf_len, delay=system.rf_dead_time)
rf = pp.make_block_pulse(
flip_angle=alpha * np.pi / 180, system=system, duration=rf_len, delay=system.rf_dead_time, use='excitation'
)
rf180 = pp.make_adiabatic_pulse(
pulse_type='hypsec', system=system, duration=10.24e-3, dwell=1e-5, delay=system.rf_dead_time
pulse_type='hypsec',
system=system,
duration=10.24e-3,
dwell=1e-5,
delay=system.rf_dead_time,
use='inversion',
)

# Define other gradients and ADC events
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_radial_gre.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'gre_r
time_bw_product=4,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Define other gradients and ADC events
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_tse.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'tse_p
phase_offset=rf_ex_phase,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)
gs_ex = pp.make_trapezoid(
channel='z',
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/write_ute.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def main(plot: bool = False, write_seq: bool = False, seq_filename: str = 'ute_p
system=system,
return_gz=True,
delay=system.rf_dead_time,
use='excitation',
)

# Align RO asymmetry to ADC samples
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pypulseq"
version = "1.4.2.post1"
version = "1.5.0"
authors = [{ name = "Keerthi Sravan Ravi", email = "ks3621@columbia.edu" }]
maintainers = [
{ name = "Bilal Tasdelen" },
Expand Down
21 changes: 20 additions & 1 deletion src/pypulseq/Sequence/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def set_block(self, block_index: int, *args: SimpleNamespace) -> None:
# Now we add the ID
new_block[6] = extension_id

# TODO: replace with independent function (#PR 289)
# =========
# PERFORM GRADIENT CHECKS
# =========
Expand Down Expand Up @@ -263,11 +264,15 @@ def set_block(self, block_index: int, *args: SimpleNamespace) -> None:
and abs(grad_to_check.stop[0] - duration) > 1e-7
):
raise RuntimeError("A gradient that doesn't end at zero needs to be aligned to the block boundary.")
# =========
# END GRADIENT CHECKS
# =========

self.block_events[block_index] = new_block
self.block_durations[block_index] = float(duration)


# TODO: refactor to get_raw_block_content_id + get_block
def get_block(self, block_index: int) -> SimpleNamespace:
"""
Returns PyPulseq block at `block_index` position in `self.block_events`.
Expand Down Expand Up @@ -673,8 +678,19 @@ def register_rf_event(self, event: SimpleNamespace) -> Tuple[int, List[int]]:
use = event.use[0]
else:
use = 'u'
else:
raise ValueError('Parameter "use" is not optional since v1.5.0')

data = (amplitude, *shape_IDs, event.delay, event.freq_offset, event.phase_offset)
data = (
amplitude,
*shape_IDs,
event.center,
event.delay,
event.freq_ppm,
event.phase_ppm,
event.freq_offset,
event.phase_offset,
)

if may_exist:
rf_id, found = self.rf_library.find_or_insert(new_data=data, data_type=use)
Expand All @@ -686,4 +702,7 @@ def register_rf_event(self, event: SimpleNamespace) -> Tuple[int, List[int]]:
else:
rf_id = self.rf_library.insert(key_id=0, new_data=data, data_type=use)

if hasattr(event, 'name'):
self.rf_id_to_name_map[rf_id] = event.name

return rf_id, shape_IDs
Loading
Loading