sim_rf#
- pypulseqpp.sim_rf()[source]#
Simulate an RF pulse versus off-resonance without relaxation.
Follows MATLAB Pulseq’s
simRf: a hard-pulse approximation with no selection gradient, so frequency maps to position only for a constant selection gradient.- Parameters:
rf (SimpleNamespace or RfEvent) – Its
freq_ppmandphase_ppmare converted with the default system’s gamma and B0, with a warning.rephase_factor (float, default=None) – Free precession after the pulse, as a signed fraction of its duration. Defaults to zero when
rf.use == "refocusing"and to-(shape_dur - center) / shape_dur, the slice-select rephaser, otherwise.prephase_factor (float, default=0.0) – The same, before the pulse.
df (float, default=1.0) – In Hz: the axis holds
round(bandwidth / df)points, so their spacing is aboutbandwidth_multiplier * df.bandwidth_multiplier (float, default=4.0) – Width of the frequency axis, in bandwidths. The bandwidth is
calc_rf_bandwidth()at half maximum plus|freq_offset|; the axis is centred onfreq_offset.dt (float, default=None) – Simulation raster, in s. Chosen from the bandwidth when omitted.
- Returns:
mz_z (numpy.ndarray) –
Mzafter the pulse, starting from+z.mz_xy (numpy.ndarray) –
Mx + i Myafter the pulse, starting from+z.f (numpy.ndarray) – The frequency axis, in Hz.
ref_eff (numpy.ndarray) – Complex refocusing efficiency: its magnitude is the refocused fraction and its phase twice the azimuth of the refocusing axis.
mx_xy, my_xy (numpy.ndarray) –
Mx + i Mystarting from+xand from+y.
- Warns:
UserWarning – If the pulse carries a ppm offset, which is read against the gamma and B0 of the default system.
Examples
>>> import numpy as np >>> import pypulseqpp as pp
A hard 90 takes
+zinto the transverse plane, on resonance:>>> rf = pp.make_block_pulse(np.pi / 2, duration=0.5e-3) >>> mz_z, mz_xy, f = pp.sim_rf(rf)[:3] >>> on_resonance = int(np.argmin(abs(f))) >>> bool(abs(mz_z[on_resonance]) < 0.15), bool(abs(mz_xy[on_resonance]) > 0.85) (True, True)
A hard 180 inverts it:
>>> mz_z, _, f = pp.sim_rf(pp.make_block_pulse(np.pi, duration=0.7e-3))[:3] >>> bool(mz_z[int(np.argmin(abs(f)))] < -0.85) True
See also
calc_rf_bandwidththe width alone, from the envelope’s transform.