tx_device
tx_device
Implementation of transmit card.
TxCard
TxCard(path: str, max_amplitude: tuple[int, int, int, int], filter_type: tuple[int, int, int, int], sample_rate: int)
Bases: SpectrumDevice
Transmit card (arbitrary waveform generator).
Implementation of the abstract SpectrumDevice for the Spectrum Instrumentation M2p.65xx series,
developed and tested with the M2p.6546-x4 (4 channels, 512 MSample on-board memory, 2 bytes/sample).
The card replays the interleaved int16 waveform of an UnrolledSequence in FIFO single mode
(SPC_REP_FIFO_SINGLE). A host-side ring buffer of at most 1 GiB is streamed to the card in
chunks of notify_size bytes by a background thread. Channel 0 carries the RF waveform,
channels 1 to 3 carry the gradient waveforms. Bit 15 of channels 1, 2 and 3 is routed to the digital
outputs X1 (ADC gate), X2 (phase reference) and X3 (RF unblanking).
The card runs on an external clock, which is provided by the receive card, and sets its own sampling rate.
Initialize the transmit card.
Parameters:
-
path(str) –Path of the spectrum card device, e.g. /dev/spcm0
-
max_amplitude(tuple[int, int, int, int]) –Maximum output amplitude per channel in mV.
-
filter_type(tuple[int, int, int, int]) –Output filter setting per channel.
-
sample_rate(int) –Card sampling rate in MHz.
Source code in src/console/spcm_control/tx_device.py
setup_card
Set up spectrum card in transmit (TX) mode.
The card is reset and its type is verified (M2p.65xx). The trigger is set to software, the clock to external (50 Ohm, 1.5 V threshold), and the sampling rate is set from the class attribute. All 4 channels are enabled and configured with the max. amplitude and filter values from the class attributes. The digital outputs X1, X2 and X3 are driven by bit 15 of the analog channels 1, 2 and 3. If an IO expansion module is present, the ADC gate and the unblanking signal are additionally routed to X12 and X13.
Raises:
-
Warning–The actual set sample rate deviates from the corresponding class attribute to be set, class attribute is overwritten.
Source code in src/console/spcm_control/tx_device.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
set_gradient_offsets
set_gradient_offsets(offsets: Dimensions, is_50ohms: bool = False) -> None
Set offset values of the gradient output channels.
Parameters:
-
offsets(Dimensions) –Offset values given by Dimensions interface with integers in mV
-
is_50ohms(bool, default:False) –Boolean flag indicating if the gradient outputs are terminated into 50 ohms or into high impedance.
Returns:
-
List of integer values read from card for x, y and z offset values–
Source code in src/console/spcm_control/tx_device.py
start_operation
start_operation(data: UnrolledSequence | None = None) -> None
Start transmit (TX) card operation.
Steps: (1) Setup the transmit card (2) Clear emergency stop flag, reset to False (3) Start worker thread (card streaming mode), with provided replay data
Parameters:
-
data(UnrolledSequence | None, default:None) –Sequence replay data as int16 numpy array in correct order. Checkout
prepare_sequencefunction for reference of correct replay data format. This value is None per default
Raises:
-
ValueError–Raised if replay data is not provided as numpy int16 values
Source code in src/console/spcm_control/tx_device.py
stop_operation
Stop card operation by thread event and stop card.