Skip to content

Spin-echo spectrum

A spin echo is acquired and its spectrum is calculated by a Fourier transform. The experiment tests the complete signal chain and is used to determine the Larmor frequency: a peak offset from 0 Hz in the spectrum corresponds to the deviation of console.parameter.larmor_frequency from the actual resonance frequency.

Sequence

The constructor se_spectrum.constructor creates a 90° excitation pulse and a 180° refocussing pulse (phase π/2) at TE/2. The ADC is either centered on the echo or, with use_fid=True, acquires the signal decay after the spin echo formation at TE.

Procedure

  1. Create an AcquisitionControl instance, which connects to the cards.
  2. Construct the sequence, set the calibrated Larmor frequency and \(B_1\) scaling.
  3. Unroll the sequence with set_sequence and run the acquisition.
  4. Calculate the spectrum from processed_data; the frequency axis follows from the dwell time RxData.dwell_time.
  5. Store the data with save() and disconnect the cards by deleting the instance.

Script

examples/spinecho_1d.py
"""Experiment to acquire a spin echo spectrum."""
# %%
import matplotlib.pyplot as plt
import numpy as np

import console
from console.interfaces.acquisition_data import AcquisitionData
from console.spcm_control.acquisition_control import AcquisitionControl
from console.utilities import sequences

# Create acquisition control instance, adapt the path to the device configuration of your system
config_file = "example_device_config.yaml"
acq = AcquisitionControl(configuration_file=config_file)

# Construct a spin echo based spectrum sequence
params = {
    "echo_time": 250e-3,
    "rf_duration": 200e-6,
    "use_sinc": False,
}
seq = sequences.se_spectrum.constructor(**params)

# Update global acquisition parameters
console.parameter.larmor_frequency = 2.0e6
console.parameter.b1_scaling = 2.43

# Run the acquisition
acq.set_sequence(sequence=seq, parameter=console.parameter)
acq_data: AcquisitionData = acq.run(store_unprocessed=True)

# Get decimated data from acquisition data object
rx_data = acq_data.receive_data[0]
data = rx_data.processed_data.squeeze()

# Calculate FFT, the frequency axis is given by the dwell time of the decimated data
data_fft = np.fft.fftshift(np.fft.fft(np.fft.fftshift(data)))
fft_freq = np.fft.fftshift(np.fft.fftfreq(data.size, rx_data.dwell_time))

# Plot spectrum
fig, ax = plt.subplots(1, 1, figsize=(10, 5))
ax.plot(fft_freq, np.abs(data_fft))
ax.set_ylabel("Abs. FFT Spectrum (a.u.)")
ax.set_xlabel("Frequency (Hz)")

# Add information to the acquisition data
acq_data.add_info({
    "note": "Example spin echo spectrum experiment",
})

# Write acquisition data object
acq_data.save()

# Delete the acquisition control, which disconnects from the measurement cards
del acq

# %%