read_vops

Contents

read_vops#

pypulseqpp.safety.read_vops()[source]#

Read VOPs and the global SAR matrices from a .mat or .npz file.

The VOPs are the array named VOP, VOPm, vops, VOPs, VOP_matrices, Q10g or Q, a stack of one Nc by Nc matrix per point: MARIE’s (N, Nc, Nc) and MATLAB’s (Nc, Nc, N) are both read, and a lone matrix is read as one point. The global SAR matrices are the array named Sglobal, global_matrix, Qglobal or Q_global, a single matrix or one per body model as mariepy’s vop.write stores a population’s. An .npz file’s metadata, a JSON string, is read onto the model; its safety_factor multiplies every local SAR and its global_safety_factor every global SAR. MATLAB v7.3 (HDF5) files are not read.

Parameters:

path (str or os.PathLike) – .mat or .npz file to read.

Returns:

The VOPs and, where the file carries them, the global SAR matrices and the metadata, for check_sar() to take as its model.

Return type:

VopModel

Raises:
  • ValueError – If the file holds no recognised VOP array, or one whose shape is not a stack of square matrices, or a safety factor is below 1.

  • OSError – If the file cannot be read, a MATLAB v7.3 file among them.