check_sar

Contents

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() and example_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_limit and, with a global matrix, its global SAR within global_limit.

  • report (SimpleNamespace) – The limits; tr_size and tr_start (blocks); windows, arrays first, last (1-based blocks), duration (s), local_sar, vop and global_sar (W/kg), and with a reference reference_ratio; worst_local and worst_global, each the sar, window and its first and last block, or None (worst_local also its vop and per_vop, the SAR of every VOP in that window); and reference, or None without one.

    reference carries sar_ratio, the largest over windows and VOPs of a VOP’s SAR over the reference’s for the same VOP, with its vop and window; energy_ratio, the largest of that ratio times the window’s duration over the reference’s, with its energy_window; and global_sar_ratio and global_energy_ratio alike 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 c with drive_c * s_c * b_c(t): b its waveform in Hz, resampled every microsecond as pypulseqpp.calc_rf_power() does (one channel’s waveform on every channel for a single-channel pulse), and s its block’s RF shim, default_shim or ones.

The scale of drive_per_hz and of the VOPs cancels in the reference ratios; relative channel gains do not. With a reference lasting its minimum TR, energy_ratio scales 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.