Skip to content

Device configuration

The device configuration describes the hardware of the MRI system: the measurement cards, the amplifiers, the gradient coils and the system limits. It is read from a YAML file when AcquisitionControl is created and remains fixed for the session. Parameters that change between measurements, such as the Larmor frequency, are passed with every sequence as AcquisitionParameter.

flowchart LR
    Y(["YAML file"]) -->|"load_nexus_config"| N["NexusConfiguration"]
    N -->|"TxConfiguration"| T["TxCard"]
    N -->|"RxConfiguration"| R["RxCard"]
    N -->|"RxConfiguration"| P["RxProcessor"]
    N -->|"TxConfiguration,<br/>SystemLimits"| S["SequenceProvider"]
    N -->|"complete copy"| D["AcquisitionData"]

    classDef sw fill:#2f6bff22,stroke:#2f6bff,stroke-width:1.5px
    classDef iface fill:#8e44ad22,stroke:#8e44ad,stroke-width:1.5px
    class N,T,R,P,S,D sw
    class Y iface

The file is validated by NexusConfiguration and consists of the three sections described below. Unknown keys are ignored. A copy of the complete configuration is stored with every acquisition in meta["device_configuration"].

TxConfiguration

Transmit card (AWG), validated by TxConfiguration. channel_max_amplitude and channel_filter_type have four entries in the order [RF, gradient 1, gradient 2, gradient 3]; gradient_efficiency and gpa_gain have three entries, one per physical gradient channel.

Attribute Unit Description
device_path – Device path of the transmit card, e.g. /dev/spcm1
sampling_rate MHz Sampling rate of the transmit card as integer; may differ from RxConfiguration.sampling_rate (see note below)
channel_max_amplitude mV Output range per channel, 1–6000 mV into 50 Ω
channel_filter_type – Output filter setting per channel, 0–3 (see card manual)
rf_terminated_50ohm – true if the RF output is terminated into 50 Ω, false for high impedance (the output voltage doubles)
gradients_terminated_50ohm – true if the gradient outputs are terminated into 50 Ω, false for high impedance (the output voltage doubles)
gradient_efficiency T/m/A Gradient coil efficiency per physical gradient channel
gpa_gain A/V Transconductance of the gradient power amplifier per physical gradient channel
rf_to_mvolt mV/Hz Conversion of the PyPulseq RF amplitude to the output voltage
rf_gain_lut_path – Optional, default none. Path to a lookup table for the linearization of the RF power amplifier (.npy, 65536 int16 values)

RxConfiguration

Receive card (digitizer), validated by RxConfiguration. The parameters channel_enable, channel_max_amplitude and channel_terminated_50ohm are defined by a list containing one entry per physical channel (i.e. the length of the list should correspond to max_available_channels).

Attribute Unit Description
device_path – Device path of the receive card, e.g. /dev/spcm0
sampling_rate MHz Sampling rate of the receive card as integer; may differ from TxConfiguration.sampling_rate (see note below)
max_available_channels – Number of input channels of the card and length of all channel lists (8 for the M2p.5933-x4)
channel_enable – Enable flag per channel; 1, 2, 4 or 8 channels must be enabled
channel_max_amplitude mV Input range per channel: 200, 500, 1000, 2000, 5000 or 10000
channel_terminated_50ohm – Input termination per channel, true for 50 Ω, false for high impedance
num_processing_workers – Optional, default 1. Number of worker processes for the parallel processing of the receive data; 0 processes the data in the main process after the acquisition

Sampling rates of transmit and receive card

Both cards share the clock of the receive card, but each card sets its own sampling rate. The hardware therefore allows different sampling rates, e.g. 20 MHz for the receive card and 10 MHz for the transmit card. The current software version does not support this yet: the sequence calculation and the processing of the receive data assume a common sampling rate, so NexusConfiguration rejects a configuration in which TxConfiguration.sampling_rate and RxConfiguration.sampling_rate differ. Support for different sampling rates will be added in a future update.

SystemLimits

Limits of the MR system, validated by SystemLimits and passed to PyPulseq as Opts (AcquisitionControl.get_sequence_system()). max_grad, max_slew, block_duration_raster, grad_raster_time and adc_raster_time must be positive, all other values must not be negative. Numbers in exponent notation need a decimal point, e.g. 20.e-6: YAML reads 20e-6 as a string, which the model rejects.

Limitations of the system limits

When a Pulseq sequence is read from a file, it is loaded with this configuration. When a Sequence object is passed, its Opts object is likewise overwritten by this configuration. This may cause the sequence timing check to fail if the block durations stored in the sequence are incompatible with the raster times defined here. Note also that max_grad and max_slew are only used when building a sequence. A sequence passed as an existing Sequence object or read from a file is not checked for its maximum gradient amplitude or slew rate. An error is only raised during the calculation of the sequence waveforms if the maximum amplitude of a channel is exceeded.

Attribute Unit Description
max_grad Hz/m Maximum gradient amplitude
max_slew Hz/m/s Maximum gradient slew rate
rf_dead_time s Dead time before an RF pulse; the RF unblanking signal is set this time before the pulse
rf_ringdown_time s Ring-down time after an RF pulse
adc_dead_time s Dead time around an ADC event; the ADC gate is extended by this time on both sides
block_duration_raster s Raster time of block durations
rf_raster_time s Raster time of RF waveforms
grad_raster_time s Raster time of gradient waveforms
adc_raster_time s Raster time of ADC dwell times
B0 T Optional, default 0.05. Static magnetic field strength

Example

The example configuration of the repository must be adapted to the target system.

examples/example_device_config.yaml
# ========================================
# Configuration file for the Nexus-console
# ========================================

# NOTE: Parameters need to be adjusted for individual system

# >> TX DEVICE (AWG) M2p.6546-x4
TxConfiguration:
  # Could be extended to a list
  device_path: "/dev/spcm1"
  # Number of channels
  max_available_channels: 4
  # Device sampling rate in MHz
  sampling_rate: 20
  # Max. output amplitude per channel (RF, Gx, Gy, Gz) in mV
  channel_max_amplitude: [200, 6000, 6000, 6000]
  # Filter configuration per channel (RF, Gx, Gy, Gz)
  channel_filter_type: [0, 2, 2, 2]
  # Configure if RF/gradients are terminated into 50 ohm impedance (true == 50 ohm)
  rf_terminated_50ohm: True
  gradients_terminated_50ohm: False
  # Gradient efficiency per gradient channel (Gx, Gy, Gz) in T/m/A 
  gradient_efficiency: [0.37e-3, 0.451e-3, 0.4e-3]
  # Gradient power amplifier gain per gradient channel (Gx, Gy, Gz) in A/V
  gpa_gain: [1.5, 1.5, 1.5]
  # Scales RF in Hz (pulseq) to mV
  rf_to_mvolt: 5.e-3
  # rf_gain_lut_path: "/path/to/lut.npy"


# >> RX DEVICE (Digitizer) M2p.5933-x4
RxConfiguration:
  # Could be extended to a list
  device_path: "/dev/spcm0"
  # Number of channels
  max_available_channels: 8
  # Device sampling rate in MHz
  sampling_rate: 20
  # Enable the receive channels, length must be equal to max_available_channels
  channel_enable: [1, 0, 0, 0, 0, 0, 0, 0]
  # Set the max. amplitude per channel in mV, length must be equal to max_available_channels
  channel_max_amplitude: [200, 200, 200, 200, 1000, 1000, 1000, 1000]
  # Configure which channels are terminated into 50 ohm impedance (true == 50 ohm), length must be equal to max_available_channels
  channel_terminated_50ohm: [True, True, True, True, False, False, False, False]

SystemLimits:
  # Maximum gradient amplitude in Hz/m (PyPulseq system stores this unit)
  max_grad: 1703040.0 # equals 40 mT/m
  # Maximum slew rate in Hz/m/s (PyPulseq system stores this unit)
  max_slew: 2128800000.0 # equals 100 T/m/s
  # Dead time at the beginning of RF event in s, covered by rf_delay
  rf_dead_time: 20.e-6
  # Time delay at the end of an RF event in s
  rf_ringdown_time: 30.e-6
  # Time delay at the beginning of an ADC event in s
  adc_dead_time: 0.
  # Raster time for block durations
  block_duration_raster: 1.e-6
  # Raster time for RF pulses.
  rf_raster_time: 1.e-6
  # Raster time for gradient waveforms.
  grad_raster_time: 1.e-6
  # Raster time for ADC readout.
  adc_raster_time: 1.e-6