gigablochs.bloch.construct_B_field#
- gigablochs.bloch.construct_B_field(rf_am, G=0, position=0, *, off_resonance=0, B1_sensitivity=1, rf_fm=0, time_axis=0, space_axis=-1)[source]#
Construct the magnetic field vector from the RF and gradient waveforms.
- Parameters:
rf_am (ndarray) – RF amplitude waveform in Tesla.
G (ndarray, optional) – Gradient waveform in Tesla/m. The length of the time axis should match
rf_am. Default is 0.position (ndarray, optional) – Spatial position vector in meters. Shape should match
G. Default is 0.off_resonance (float, optional) – Off-resonance frequency in Hz. Default is 0.
B1_sensitivity (float or ndarray, optional) – B1 sensitivity factor. Default is 1.
rf_fm (ndarray, optional) – RF frequency waveform in Hz. Default is 0.
time_axis (int, optional) – Axis along the input arrays which represents the time axis. Default is 0.
space_axis (int, optional) – Axis along the field array which represents the 2D or 3D spatial field vector. Also used for the dot product between gradient and position vectors. Default is -1.
- Returns:
B_eff – Magnetic field vector in Tesla. Shape is extended from rf_am by \(G \cdot position\), off_resonance, B1_sensitivity, and coordinates for the spatial axis. Explicitly, when space_axis=-1, the shape of the magnetic field vector is (time, …, dB0, dB1, 3), where time is
len(rf_am),dB0 = len(off_resonance),dB1 = len(B1_sensitivity),3is the spatial axis (x, y, z), andrepresents any extra dimensions inrf_am(for example to parametrize bandwidth), followed by any extra dimensions indot(G, position, space_axis)(for example to parametrize spin motion).- Return type:
ndarray
Notes
As this function uses numpy-style broadcasting, the input arrays should have unique shapes, for example, parametrized dimensions like
len(off_resonance)should NOT matchlen(rf_am), the number of time steps.The magnetic field vector is computed as:
\[ \begin{align}\begin{aligned}B_x = \Delta B_1 \Re{RF_{AM}}\\B_y = \Delta B_1 \Im{RF_{AM}}\\B_z = \vec{G} \cdot \vec{r} + \frac{RF_{FM}}{\gammabar} + \frac{\Delta f}{\gammabar}\end{aligned}\end{align} \]where \(B_x\), \(B_y\), and \(B_z\) are the magnetic field components, \(\Delta B_1\) is the unitless B1 sensitivity factor, \(RF_{AM}\) is the RF amplitude modulation waveform in Tesla, \(\vec{G}\) is the gradient waveform in Tesla/m, \(\vec{r}\) is the spin’s spatial position waveform in meters, \(RF_{FM}\) is the RF frequency modulation waveform in Hz, \(\gammabar\) is the reduced gyromagnetic ratio in Hz/T, and \(\Delta f\) is the off-resonance frequency in Hz.