read_acoustic_response

read_acoustic_response#

pypulseqpp.safety.read_acoustic_response()[source]#

Read a gradient coil’s acoustic transfer function from an HDF5 file.

The file holds the response of each physical axis to a gradient in G/cm, and an A-weighting filter, each as the N bins of the discrete Fourier transform of a waveform sampled every sampling_interval: two rows, real and imaginary part. The bins below the Nyquist frequency are kept.

Parameters:
  • path (str | os.PathLike) – The HDF5 file to read.

  • sampling_interval (float) – Sampling interval (s) the bins refer to; bin k lies at k / (N * sampling_interval) Hz.

Returns:

The response in Pa per mT/m, for check_spl() to take as its response.

Return type:

AcousticResponse

Raises:
  • ValueError – If sampling_interval is not positive, or the file lacks an axis or holds one of another shape than the others.

  • OSError – If the file cannot be read.

Warns:

UserWarning – If the file’s A-weighting departs from the IEC 61672 curve on the frequency axis sampling_interval sets, which is then likely not the interval the file was tabulated at.