check_pns#
- pypulseqpp.safety.check_pns()[source]#
Check peripheral nerve stimulation against a SAFE or chronaxie model.
- Parameters:
seq (Sequence) – Sequence to check.
model (ChronaxieModel, mapping, SAFE description, or path) – A
ChronaxieModelor a mapping of its fields; a SAFE description shaped like upstream’ssafe_example_hw(); or a.ascfile forread_safe_model().rotation (array_like, default=None) – 3x3 prescription rotation from logical to physical axes, applied after each block’s own rotation; identity (axial) by default.
system (pypulseqpp.Opts, default=None) – Source of the gyromagnetic ratio; the sequence’s own by default.
trace (bool, default=False) – Also return the response over time, which a diagnostic plot draws. The trace is one value per gradient raster interval over the whole sequence, so it costs four arrays of
sampleseach.
- Returns:
is_ok (bool) – True when the axis-combined response, as a fraction of the model’s threshold, stays below 1 at every sample.
report (SimpleNamespace) –
model("safe"or"chronaxie"),raster(s),samples,peak, the largest root-sum-square response, andaxes, the largest response of each of x, y and z. A peak carriesvalueas a fraction of threshold, the sampletime(s) and the 1-basedblockthat plays it. Undertrace,time(s),response– the root-sum-square, as a fraction of threshold – and each axis’s ownresponse, all of lengthsamples.
Notes
The gradient is sampled at the centres of the sequence’s own gradient raster, from rest, and its slew is the difference between neighbouring samples; this and the SAFE model are upstream PyPulseq’s
calc_pns. The response is evaluated over the whole sequence in one pass, carrying each model’s memory, in bounded storage.