playout

Contents

playout#

pulserver.ir.playout()[source]#

Play the cache beside a sequence file as a segmented playout plays it, recording both stages.

The stages are the C library’s, pulseg_playout_prepare and pulseg_playout_scan, over a backend that plays nothing: it keeps what the first stage prepares at each segment position, a model of the waveform memory the waves are loaded into, and the registers the scan loop sets on each block, with the samples its wave reads from that memory when it is set. The waves are held as plan_waves() lays them out for budget, or, without one, as the cache lays them out.

With prescan, the scan loop plays that receive-gain calibration instead. It waits for no trigger, drives no digital output, and plays at zero every gradient whose amplitude varies across repetitions.

Returns:

  • mode, memory_samples, slots: how plan_waves() holds the waves, the samples per axis it reserves, and the slots of a position’s ring;

  • positions: per prepared segment position, in segment order, segment and position; where the position plays no wave, its gradient events as corners at unit amplitude, event_time_us from the block’s start and event_shape, with event_span (positions, 3, 2) into them; where it does, slot_offset (positions, slots, 3), slot_samples and slot_start_us: its ring of slots, or, with offsets -1, the span every resident wave it plays covers;

  • blocks: per played block, in play order, subsequence, segment, position, instance (instances of its segment played before its own), slot (of its position’s ring, -1 unless the waves are streamed), rotate (0 where NOROT keeps the prescription rotation out), await_trigger, first_position (the execution-stream position of its instance’s first block) and duration_us; the registers rf_amp_hz, rf_phase_rad, rf_freq_hz, rf_shim, rf_use, gradient_hz_per_m (blocks, 3), adc, adc_freq_hz, adc_phase_rad and digitalout, and gradient_variable, where the amplitude of that gradient varies across repetitions; and its wave, wave (-1 without one) at wave_amp_hz_per_m, from the region wave_offset, wave_samples and wave_start_us, with the samples it reads there in wave_read, wave_read_span (blocks, 3, 2) into them. With waveforms, also what each block plays, keyed as play() keys it: the RF pulse and readout its position prepares, the pulse at the block’s amplitude, the readout’s phase modulation, and the gradients: the events its position prepares at the block’s amplitudes, or the samples its wave reads at the centres of the raster intervals, the first and last held over the half intervals at its two ends;

  • instances and loads: the segment instances played and the loads into waveform memory;

  • overwrites: loads that wrote over memory the instance in play was reading, and unloaded: samples a block read where nothing was loaded. Both are 0 where every block plays what was loaded for it;

  • rf_shims: per subsequence, each RF shim’s complex channel weights, which a block’s rf_shim indexes.

Return type:

dict of str to Any

Raises:

ValueError – If the cache cannot be loaded, if the waves do not fit the budget or cannot be loaded in time, or if the prescan’s subsequence does not exist.