check_sar#
- pypulseqpp.safety.check_sar()[source]#
Check window-averaged local and global SAR against their limits.
- Parameters:
seq (Sequence) – Sequence to check.
model (VopModel) – VOPs and optional global matrix, in W/kg per unit drive squared; see
read_vops()andexample_vops().drive_per_hz (float or array_like) – Channel drive per Hz of RF amplitude, in the VOPs’ drive unit: one value, or one per channel.
local_limit (float, default=10.0) – W/kg; IEC 60601-2-33 normal-mode head limits by default.
global_limit (float, default=3.2) – W/kg; IEC 60601-2-33 normal-mode head limits by default.
default_shim (array_like, default=None) – Channel weights of a single-channel pulse played without an RF shim; all ones by default.
reference (Sequence or report, default=None) – What to compare with, in the same model and calibration: a sequence, such as a CP-mode FID, evaluated here with the same drive and default shim; or the report of an earlier call. Its worst window’s per-VOP SAR, global SAR and duration are the reference.
- Returns:
is_ok (bool) – True when every window’s largest VOP SAR is within
local_limitand, with a global matrix, its global SAR withinglobal_limit.report (SimpleNamespace) – The limits;
tr_sizeandtr_start(blocks);windows, arraysfirst,last(1-based blocks),duration(s),local_sar,vopandglobal_sar(W/kg), and with a referencereference_ratio;worst_localandworst_global, each thesar,windowand itsfirstandlastblock, or None (worst_localalso itsvopandper_vop, the SAR of every VOP in that window); andreference, or None without one.referencecarriessar_ratio, the largest over windows and VOPs of a VOP’s SAR over the reference’s for the same VOP, with itsvopandwindow;energy_ratio, the largest of that ratio times the window’s duration over the reference’s, with itsenergy_window; andglobal_sar_ratioandglobal_energy_ratioalike for the global matrix, or None. Every window counts, prologue and tail included.
- Raises:
ValueError – If a reference sequence plays nothing to compare with, or a shim weighs a different number of channels than the model has.
Notes
SAR is averaged over each window: the blocks before the first full repetition, each repetition the block definitions repeat with, and any blocks after the last; or the whole sequence when it does not repeat. Every window is compared with the limits. A pulse drives channel
cwithdrive_c * s_c * b_c(t):bits waveform in Hz, resampled every microsecond aspypulseqpp.calc_rf_power()does (one channel’s waveform on every channel for a single-channel pulse), andsits block’s RF shim,default_shimor ones.The scale of
drive_per_hzand of the VOPs cancels in the reference ratios; relative channel gains do not. With a reference lasting its minimum TR,energy_ratioscales that minimum TR to this sequence’s repetition, at the energy each repetition deposits. For a sequence played only in the default shim, every VOP’s ratio is the ratio of RF energy.